inotify: show inotify mask flags in proc fdinfo
[ Upstream commit a32e697cda27679a0327ae2cafdad8c7170f548f ]
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: 6933599697
("inotify: hide internal kernel bits from fdinfo")
Link: https://lore.kernel.org/r/20220422120327.3459282-2-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
f2c68c5289
commit
94845fc422
@@ -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_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);
|
||||||
inode = igrab(fsnotify_conn_inode(mark->connector));
|
inode = igrab(fsnotify_conn_inode(mark->connector));
|
||||||
if (inode) {
|
if (inode) {
|
||||||
/*
|
seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:0 ",
|
||||||
* 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 ",
|
|
||||||
inode_mark->wd, inode->i_ino, inode->i_sb->s_dev,
|
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);
|
show_mark_fhandle(m, inode);
|
||||||
seq_putc(m, '\n');
|
seq_putc(m, '\n');
|
||||||
iput(inode);
|
iput(inode);
|
||||||
|
@@ -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);
|
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,
|
extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
|
||||||
struct fsnotify_group *group);
|
struct fsnotify_group *group);
|
||||||
extern int inotify_handle_inode_event(struct fsnotify_mark *inode_mark,
|
extern int inotify_handle_inode_event(struct fsnotify_mark *inode_mark,
|
||||||
|
@@ -88,7 +88,7 @@ static inline __u32 inotify_arg_to_mask(struct inode *inode, u32 arg)
|
|||||||
mask |= FS_EVENT_ON_CHILD;
|
mask |= FS_EVENT_ON_CHILD;
|
||||||
|
|
||||||
/* mask off the flags used to open the fd */
|
/* 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;
|
return mask;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user