From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Matthew Bobrowski <mbobrowski@mbobrowski.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 01/16] inotify: show inotify mask flags in proc fdinfo
Date: Tue, 29 Mar 2022 10:48:49 +0300 [thread overview]
Message-ID: <20220329074904.2980320-2-amir73il@gmail.com> (raw)
In-Reply-To: <20220329074904.2980320-1-amir73il@gmail.com>
The inotify mask flags IN_ONESHOT and IN_EXCL_UNLINK are not "internal
to kernel" and should be exposed in procfs fdinfo so CRIU can restore
them.
Fixes: 6933599697c9 ("inotify: hide internal kernel bits from fdinfo")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
fs/notify/fdinfo.c | 11 ++---------
fs/notify/inotify/inotify.h | 12 ++++++++++++
fs/notify/inotify/inotify_user.c | 2 +-
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index 57f0d5d9f934..3451708fd035 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -83,16 +83,9 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);
inode = igrab(fsnotify_conn_inode(mark->connector));
if (inode) {
- /*
- * IN_ALL_EVENTS represents all of the mask bits
- * that we expose to userspace. There is at
- * least one bit (FS_EVENT_ON_CHILD) which is
- * used only internally to the kernel.
- */
- u32 mask = mark->mask & IN_ALL_EVENTS;
- seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x ",
+ seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:0 ",
inode_mark->wd, inode->i_ino, inode->i_sb->s_dev,
- mask, mark->ignored_mask);
+ inotify_mark_user_mask(mark));
show_mark_fhandle(m, inode);
seq_putc(m, '\n');
iput(inode);
diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h
index 2007e3711916..8f00151eb731 100644
--- a/fs/notify/inotify/inotify.h
+++ b/fs/notify/inotify/inotify.h
@@ -22,6 +22,18 @@ static inline struct inotify_event_info *INOTIFY_E(struct fsnotify_event *fse)
return container_of(fse, struct inotify_event_info, fse);
}
+/*
+ * INOTIFY_USER_FLAGS represents all of the mask bits that we expose to
+ * userspace. There is at least one bit (FS_EVENT_ON_CHILD) which is
+ * used only internally to the kernel.
+ */
+#define INOTIFY_USER_MASK (IN_ALL_EVENTS | IN_ONESHOT | IN_EXCL_UNLINK)
+
+static inline __u32 inotify_mark_user_mask(struct fsnotify_mark *fsn_mark)
+{
+ return fsn_mark->mask & INOTIFY_USER_MASK;
+}
+
extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
struct fsnotify_group *group);
extern int inotify_handle_inode_event(struct fsnotify_mark *inode_mark,
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 54583f62dc44..3ef57db0ec9d 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -110,7 +110,7 @@ static inline __u32 inotify_arg_to_mask(struct inode *inode, u32 arg)
mask |= FS_EVENT_ON_CHILD;
/* mask off the flags used to open the fd */
- mask |= (arg & (IN_ALL_EVENTS | IN_ONESHOT | IN_EXCL_UNLINK));
+ mask |= (arg & INOTIFY_USER_MASK);
return mask;
}
--
2.25.1
next prev parent reply other threads:[~2022-03-29 7:49 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-29 7:48 [PATCH v2 00/16] Evictable fanotify marks Amir Goldstein
2022-03-29 7:48 ` Amir Goldstein [this message]
2022-04-05 12:40 ` [PATCH v2 01/16] inotify: show inotify mask flags in proc fdinfo Jan Kara
2022-04-05 12:43 ` Jan Kara
2022-03-29 7:48 ` [PATCH v2 02/16] inotify: move control flags from mask to mark flags Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 03/16] fsnotify: pass flags argument to fsnotify_add_mark() via mark Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 04/16] fsnotify: remove unneeded refcounts of s_fsnotify_connectors Amir Goldstein
2022-04-05 12:54 ` Jan Kara
2022-04-05 13:09 ` Amir Goldstein
2022-04-06 17:47 ` Jan Kara
2022-04-06 18:19 ` Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 05/16] fsnotify: fix wrong lockdep annotations Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 06/16] fsnotify: create helpers for group mark_mutex lock Amir Goldstein
2022-04-07 14:35 ` Jan Kara
2022-04-07 14:53 ` Amir Goldstein
2022-04-08 8:38 ` Amir Goldstein
2022-04-11 10:31 ` Jan Kara
2022-03-29 7:48 ` [PATCH v2 07/16] inotify: use fsnotify group lock helpers Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 08/16] audit: " Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 09/16] nfsd: " Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 10/16] dnotify: " Amir Goldstein
2022-03-29 7:48 ` [PATCH v2 11/16] fsnotify: allow adding an inode mark without pinning inode Amir Goldstein
2022-03-29 7:49 ` [PATCH v2 12/16] fanotify: factor out helper fanotify_mark_update_flags() Amir Goldstein
2022-04-11 10:52 ` Jan Kara
2022-04-11 12:00 ` Amir Goldstein
2022-03-29 7:49 ` [PATCH v2 13/16] fanotify: implement "evictable" inode marks Amir Goldstein
2022-04-11 11:47 ` Jan Kara
2022-04-11 12:57 ` Amir Goldstein
2022-04-11 14:19 ` Jan Kara
2022-04-12 8:07 ` Amir Goldstein
2022-03-29 7:49 ` [PATCH v2 14/16] fanotify: add FAN_IOC_SET_MARK_PAGE_ORDER ioctl for testing Amir Goldstein
2022-04-11 12:53 ` Jan Kara
2022-04-11 13:07 ` Amir Goldstein
2022-03-29 7:49 ` [PATCH v2 15/16] fanotify: use fsnotify group lock helpers Amir Goldstein
2022-03-29 7:49 ` [PATCH v2 16/16] fanotify: enable "evictable" inode marks Amir Goldstein
2022-04-09 16:12 ` [PATCH v2 00/16] Evictable fanotify marks Amir Goldstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220329074904.2980320-2-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mbobrowski@mbobrowski.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).