Skip to content

Commit c73c670

Browse files
amir73iljankara
authored andcommitted
fanotify: fix flush of mntns marks
fanotify_mark(fd, FAN_MARK_FLUSH | FAN_MARK_MNTNS, ...) incorrectly ends up causing removal inode marks. Fixes: 0f46d81 ("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
1 parent 9c32cda commit c73c670

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

fs/notify/fanotify/fanotify_user.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,12 +1961,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
19611961
return -EINVAL;
19621962

19631963
if (mark_cmd == FAN_MARK_FLUSH) {
1964-
if (mark_type == FAN_MARK_MOUNT)
1965-
fsnotify_clear_vfsmount_marks_by_group(group);
1966-
else if (mark_type == FAN_MARK_FILESYSTEM)
1967-
fsnotify_clear_sb_marks_by_group(group);
1968-
else
1969-
fsnotify_clear_inode_marks_by_group(group);
1964+
fsnotify_clear_marks_by_group(group, obj_type);
19701965
return 0;
19711966
}
19721967

include/linux/fsnotify_backend.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -907,21 +907,6 @@ extern void fsnotify_wait_marks_destroyed(void);
907907
/* Clear all of the marks of a group attached to a given object type */
908908
extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group,
909909
unsigned int obj_type);
910-
/* run all the marks in a group, and clear all of the vfsmount marks */
911-
static inline void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
912-
{
913-
fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_VFSMOUNT);
914-
}
915-
/* run all the marks in a group, and clear all of the inode marks */
916-
static inline void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group)
917-
{
918-
fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_INODE);
919-
}
920-
/* run all the marks in a group, and clear all of the sn marks */
921-
static inline void fsnotify_clear_sb_marks_by_group(struct fsnotify_group *group)
922-
{
923-
fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_TYPE_SB);
924-
}
925910
extern void fsnotify_get_mark(struct fsnotify_mark *mark);
926911
extern void fsnotify_put_mark(struct fsnotify_mark *mark);
927912
extern void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info);

0 commit comments

Comments
 (0)