Since connectors no longer hold inode references, there's no need to call fsnotify_recalc_mask() only because FSNOTIFY_MARK_FLAG_NO_IREF flag changed. Signed-off-by: Jan Kara --- fs/notify/fanotify/fanotify_user.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index b192ee068a7a..2c440ea96521 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -1202,9 +1202,7 @@ static int fanotify_remove_mark(struct fsnotify_group *group, static bool fanotify_mark_update_flags(struct fsnotify_mark *fsn_mark, unsigned int fan_flags) { - bool want_iref = !(fan_flags & FAN_MARK_EVICTABLE); unsigned int ignore = fan_flags & FANOTIFY_MARK_IGNORE_BITS; - bool recalc = false; /* * When using FAN_MARK_IGNORE for the first time, mark starts using @@ -1215,6 +1213,10 @@ static bool fanotify_mark_update_flags(struct fsnotify_mark *fsn_mark, if (ignore == FAN_MARK_IGNORE) fsn_mark->flags |= FSNOTIFY_MARK_FLAG_HAS_IGNORE_FLAGS; + /* NO_IREF may be removed from a mark, but not added */ + if (!(fan_flags & FAN_MARK_EVICTABLE)) + fsn_mark->flags &= ~FSNOTIFY_MARK_FLAG_NO_IREF; + /* * Setting FAN_MARK_IGNORED_SURV_MODIFY for the first time may lead to * the removal of the FS_MODIFY bit in calculated mask if it was set @@ -1224,21 +1226,10 @@ static bool fanotify_mark_update_flags(struct fsnotify_mark *fsn_mark, !(fsn_mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)) { fsn_mark->flags |= FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY; if (!(fsn_mark->mask & FS_MODIFY)) - recalc = true; + return true; } - if (fsn_mark->connector->type != FSNOTIFY_OBJ_TYPE_INODE || - want_iref == !(fsn_mark->flags & FSNOTIFY_MARK_FLAG_NO_IREF)) - return recalc; - - /* - * NO_IREF may be removed from a mark, but not added. - * When removed, fsnotify_recalc_mask() will take the inode ref. - */ - WARN_ON_ONCE(!want_iref); - fsn_mark->flags &= ~FSNOTIFY_MARK_FLAG_NO_IREF; - - return true; + return false; } static bool fanotify_mark_add_to_mask(struct fsnotify_mark *fsn_mark, -- 2.51.0