From patchwork Fri Nov 15 15:30:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13876442 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02E1CD68BC8 for ; Fri, 15 Nov 2024 15:31:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B58F06B008A; Fri, 15 Nov 2024 10:31:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE3BC6B0092; Fri, 15 Nov 2024 10:31:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90FA36B0093; Fri, 15 Nov 2024 10:31:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6B6C86B008A for ; Fri, 15 Nov 2024 10:31:31 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1D1041C63A8 for ; Fri, 15 Nov 2024 15:31:31 +0000 (UTC) X-FDA: 82788715590.20.6BB8AD7 Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) by imf10.hostedemail.com (Postfix) with ESMTP id 2ACD1C001F for ; Fri, 15 Nov 2024 15:31:08 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=FavfWOpf; dmarc=none; spf=none (imf10.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.182) smtp.mailfrom=josef@toxicpanda.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731684510; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5jVczlJ/TW6EECuU4gj9yYFP++VZ/oJUqPiY9P+PdPU=; b=N6JnYJxLB91kkHJU4+L9ySGslszlMoN/Sjb20CFjftWV6dSR/hzGmRBOce527Et70EvBqB k00PPFpLCmZX/5++tcmMiGnE0WOG6eWugk5zCHAqvbh2ju/esBvtW6JwFKrYv8v10dh5g3 dj9UxNFgotxVucA2C/9ZQ3jRpgP9Mp8= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=toxicpanda-com.20230601.gappssmtp.com header.s=20230601 header.b=FavfWOpf; dmarc=none; spf=none (imf10.hostedemail.com: domain of josef@toxicpanda.com has no SPF policy when checking 209.85.128.182) smtp.mailfrom=josef@toxicpanda.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731684510; a=rsa-sha256; cv=none; b=5326t7TqGXqKrmgX+sSnoob9SMTa0kGvX+rDQBUOaM5Mc/M2M54RvUNp7W1Zo4gBY1zxpJ HK6CehuOtobINOX6cUKEr+RaGMl+99PTOT3aCLcS5E9aN9gnX9ssQwh3z1ct1ZLcz9eWIL jlimlNiCfWhDSctNVQDBhViq/ejo0Yo= Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-6ea5003deccso21563847b3.0 for ; Fri, 15 Nov 2024 07:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1731684688; x=1732289488; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5jVczlJ/TW6EECuU4gj9yYFP++VZ/oJUqPiY9P+PdPU=; b=FavfWOpflLX/eaBZyuKnnMw66c0tNxhgSlh/ino2ZSPs3mkk65pamRV//EH5UKvsRG xv33bYWC+LOf8hHl6U7Uo1GGaVTP7efaGKy1C81y6RSSLdNXeJawXvcD/X5as81qdTM5 En9Ew1xzvWbeyK45RTnQPXhi9ZBEkVFElb087hu2nlc59mqSuOfVs5iMyoU7wIkWcVFj obFIYFKvZL53tCutHgAx8hOFoRQp+sFFonLUG09i1LgfzaTAjqw4qazH+dSRaZomvpcR N60aIXGLkoJy4k8I1qoeKuzm3KrPrYnWEKv1bJTjFNGMxOOZ0JyJAUqJ3zxCR0SKVJRG 8hsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731684688; x=1732289488; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5jVczlJ/TW6EECuU4gj9yYFP++VZ/oJUqPiY9P+PdPU=; b=lV4DSqONSPVNG8JIpouAR5qtBRj6nRU+6O1i69AtJMgEpTrB3asjwSPzfk3BHRn+HA FF3kGTQ4mAr++2e5CkzYI3gDuA1TzZeM68A/8bpbf5wuks6mz4/dA+aK8BcoXg/HfkUS +DBYp6TmB/ki6ydc7tj50ZUyn6UZUME6m4D5U4ZqFLnGxiDUymS/eCQ7qMkRjeyr9Q3q QObX4UARtV1JJW6gINCsuBf88Vqdy0q1t712tTK3rSvVQlDV7KBd+YIONUgD95f3LvOl 0FuSBkKmbR+EvICKs4OlapfiDNvR02eTemvNJ9VO/G4oCKUvNoDuT7adg+dXmZ/KGwqN ZD9w== X-Forwarded-Encrypted: i=1; AJvYcCXtW3L0eic+jrgcPHNr/CNL6Y1x0FxKXCu8NFiE8vIY5NL8ysMselA7oAdsaydhS1/dBxuaHAsT0g==@kvack.org X-Gm-Message-State: AOJu0YxiQjUe2VWr6X0McHbUcfEPm+PXMrvsaziRLlBRoTN85jlo5ZeF q3lX4JZ6+kSissQMb28UevHKRfVnxiNtulXiILS0BOgsiTr5vNYZq6hlT18lQuE= X-Google-Smtp-Source: AGHT+IEWEdrPnRli1gv+jVnLYsORdUcuZyTi/FsZKRBYcdcM64Io8ydfsi1gmscyy1vF3dAQcsDh6w== X-Received: by 2002:a05:690c:4c02:b0:6ea:2ac4:9df6 with SMTP id 00721157ae682-6ee55bbade0mr37073597b3.3.1731684688405; Fri, 15 Nov 2024 07:31:28 -0800 (PST) Received: from localhost (syn-076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6ee4449516asm7602087b3.124.2024.11.15.07.31.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 07:31:27 -0800 (PST) From: Josef Bacik To: kernel-team@fb.com, linux-fsdevel@vger.kernel.org, jack@suse.cz, amir73il@gmail.com, brauner@kernel.org, torvalds@linux-foundation.org, viro@zeniv.linux.org.uk, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org Subject: [PATCH v8 04/19] fanotify: don't skip extra event info if no info_mode is set Date: Fri, 15 Nov 2024 10:30:17 -0500 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2ACD1C001F X-Stat-Signature: g3kdy1to3j8yexxx6s1g8tt5sddgc1pj X-Rspam-User: X-HE-Tag: 1731684668-171819 X-HE-Meta: U2FsdGVkX180wd+0DI0Fya+5ldFQJ7osagJiRkQ621qELru6V0KE84OYodfVVafszm/l380E7ey9g72HIDBh1j8HQr2cKAWxyNirQvnh5ahpUSpZddWgiQ7zvI8pXcjk4szkHoOWtQuIGNGgc37BQZ1fnuGbqS/xIANQiysVR+pXBg3UVh87RZxhwXoCiqv2KHWVeoOrp6ubfr7o0NgpyENJCY3pMg1O6+d+2RaBcbVWWWyuD3KgWrSfnQqu07Y4ZKZdVSbedqTT+Qm8+8FrdWnrCzBE+DYpjLKzZ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cnf5dwRjcNF2qkMDvVgZTr8rLKKb+XyHHSXELWs9vw9ktaq8nJZxcelg6IDW8zzYziXcgB8Vl8eQ8OT8+XLgQCOEV0xA+RJr0IFZ6JCksZVD6eu8PRfo+aipIRXqQ7Q9bYwhcFUXyu7pVZeiXTkVt3Jw3UJs8ViGmznopY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Amir Goldstein Previously we would only include optional information if you requested it via an FAN_ flag at fanotify_init time (FAN_REPORT_FID for example). However this isn't necessary as the event length is encoded in the metadata, and if the user doesn't want to consume the information they don't have to. With the PRE_ACCESS events we will always generate range information, so drop this check in order to allow this extra information to be exported without needing to have another flag. Signed-off-by: Josef Bacik --- fs/notify/fanotify/fanotify_user.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 919ff59cb802..8fca5ec442e4 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -158,9 +158,6 @@ static size_t fanotify_event_len(unsigned int info_mode, int fh_len; int dot_len = 0; - if (!info_mode) - return event_len; - if (fanotify_is_error_event(event->mask)) event_len += FANOTIFY_ERROR_INFO_LEN; @@ -754,12 +751,10 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, buf += FAN_EVENT_METADATA_LEN; count -= FAN_EVENT_METADATA_LEN; - if (info_mode) { - ret = copy_info_records_to_user(event, info, info_mode, pidfd, - buf, count); - if (ret < 0) - goto out_close_fd; - } + ret = copy_info_records_to_user(event, info, info_mode, pidfd, + buf, count); + if (ret < 0) + goto out_close_fd; if (f) fd_install(fd, f);