History

Merge tag 'fsnotify_for_v6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull fsnotify fixes from Jan Kara: "Fixes for an inotify deadlock and a data race in fsnotify" * tag 'fsnotify_for_v6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: inotify: Fix possible deadlock in fsnotify_destroy_mark fsnotify: Avoid data race between fsnotify_recalc_mask() and fsnotify_object_watched()

Linus Torvalds committed 2 years ago

Commit e02f08e2 parents 4770119 cad3f4a8 files · +25 −34Browse files

Showing the changes to include (1 of 8 files). Show all

Unified · Split

include/linux/fsnotify_backend.h+3−7
@@ -217,7 +217,6 @@ struct fsnotify_group { · 216 unmodified lines
217217
218218 #define FSNOTIFY_GROUP_USER 0x01 /* user allocated group */
219219 #define FSNOTIFY_GROUP_DUPS 0x02 /* allow multiple marks per object */
220−#define FSNOTIFY_GROUP_NOFS 0x04 /* group lock is not direct reclaim safe */
221220 int flags;
222221 unsigned int owner_flags; /* stored flags of mark_mutex owner */
223222
@@ -268,22 +267,19 @@ struct fsnotify_group { · 44 unmodified lines
268267 static inline void fsnotify_group_lock(struct fsnotify_group *group)
269268 {
270269 mutex_lock(&group->mark_mutex);
271− if (group->flags & FSNOTIFY_GROUP_NOFS)
272− group->owner_flags = memalloc_nofs_save();
270+ group->owner_flags = memalloc_nofs_save();
273271 }
274272
275273 static inline void fsnotify_group_unlock(struct fsnotify_group *group)
276274 {
277− if (group->flags & FSNOTIFY_GROUP_NOFS)
278− memalloc_nofs_restore(group->owner_flags);
275+ memalloc_nofs_restore(group->owner_flags);
279276 mutex_unlock(&group->mark_mutex);
280277 }
281278
282279 static inline void fsnotify_group_assert_locked(struct fsnotify_group *group)
283280 {
284281 WARN_ON_ONCE(!mutex_is_locked(&group->mark_mutex));
285− if (group->flags & FSNOTIFY_GROUP_NOFS)
286− WARN_ON_ONCE(!(current->flags & PF_MEMALLOC_NOFS));
282+ WARN_ON_ONCE(!(current->flags & PF_MEMALLOC_NOFS));
287283 }
288284
289285 /* When calling fsnotify tell it if the data is a path or inode */