mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-20 20:25:56 -04:00
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()
This commit is contained in:
@@ -217,7 +217,6 @@ struct fsnotify_group {
|
||||
|
||||
#define FSNOTIFY_GROUP_USER 0x01 /* user allocated group */
|
||||
#define FSNOTIFY_GROUP_DUPS 0x02 /* allow multiple marks per object */
|
||||
#define FSNOTIFY_GROUP_NOFS 0x04 /* group lock is not direct reclaim safe */
|
||||
int flags;
|
||||
unsigned int owner_flags; /* stored flags of mark_mutex owner */
|
||||
|
||||
@@ -268,22 +267,19 @@ struct fsnotify_group {
|
||||
static inline void fsnotify_group_lock(struct fsnotify_group *group)
|
||||
{
|
||||
mutex_lock(&group->mark_mutex);
|
||||
if (group->flags & FSNOTIFY_GROUP_NOFS)
|
||||
group->owner_flags = memalloc_nofs_save();
|
||||
group->owner_flags = memalloc_nofs_save();
|
||||
}
|
||||
|
||||
static inline void fsnotify_group_unlock(struct fsnotify_group *group)
|
||||
{
|
||||
if (group->flags & FSNOTIFY_GROUP_NOFS)
|
||||
memalloc_nofs_restore(group->owner_flags);
|
||||
memalloc_nofs_restore(group->owner_flags);
|
||||
mutex_unlock(&group->mark_mutex);
|
||||
}
|
||||
|
||||
static inline void fsnotify_group_assert_locked(struct fsnotify_group *group)
|
||||
{
|
||||
WARN_ON_ONCE(!mutex_is_locked(&group->mark_mutex));
|
||||
if (group->flags & FSNOTIFY_GROUP_NOFS)
|
||||
WARN_ON_ONCE(!(current->flags & PF_MEMALLOC_NOFS));
|
||||
WARN_ON_ONCE(!(current->flags & PF_MEMALLOC_NOFS));
|
||||
}
|
||||
|
||||
/* When calling fsnotify tell it if the data is a path or inode */
|
||||
|
||||
Reference in New Issue
Block a user