]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fanotify: fix flush of mntns marks
authorAmir Goldstein <amir73il@gmail.com>
Fri, 18 Apr 2025 19:39:02 +0000 (21:39 +0200)
committerJan Kara <jack@suse.cz>
Thu, 24 Apr 2025 08:58:59 +0000 (10:58 +0200)
fanotify_mark(fd, FAN_MARK_FLUSH | FAN_MARK_MNTNS, ...) incorrectly
ends up causing removal inode marks.

Fixes: 0f46d81f2bce ("fanotify: notify on mount attach and detach")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20250418193903.2607617-2-amir73il@gmail.com
fs/notify/fanotify/fanotify_user.c
include/linux/fsnotify_backend.h

index f2d840ae4ded8870b46f6862ebe7f7886c73bd4c..87f861e9004f2d81b540c68deed7289e72bb376b 100644 (file)
@@ -1961,12 +1961,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
                return -EINVAL;
 
        if (mark_cmd == FAN_MARK_FLUSH) {
-               if (mark_type == FAN_MARK_MOUNT)
-                       fsnotify_clear_vfsmount_marks_by_group(group);
-               else if (mark_type == FAN_MARK_FILESYSTEM)
-                       fsnotify_clear_sb_marks_by_group(group);
-               else
-                       fsnotify_clear_inode_marks_by_group(group);
+               fsnotify_clear_marks_by_group(group, obj_type);
                return 0;
        }
 
index 6cd8d1d28b8be4406356a2ad3db02bbb9d674680..fc27b53c58c2e38b5bdb65ed2d6d0478f6594f0d 100644 (file)
@@ -907,21 +907,6 @@ extern void fsnotify_wait_marks_destroyed(void);
 /* Clear all of the marks of a group attached to a given object type */
 extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group,
                                          unsigned int obj_type);
-/* run all the marks in a group, and clear all of the vfsmount marks */
-static inline void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
-{
-       fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_VFSMOUNT);
-}
-/* run all the marks in a group, and clear all of the inode marks */
-static inline void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group)
-{
-       fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_INODE);
-}
-/* run all the marks in a group, and clear all of the sn marks */
-static inline void fsnotify_clear_sb_marks_by_group(struct fsnotify_group *group)
-{
-       fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_SB);
-}
 extern void fsnotify_get_mark(struct fsnotify_mark *mark);
 extern void fsnotify_put_mark(struct fsnotify_mark *mark);
 extern void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info);