summaryrefslogtreecommitdiffstats
path: root/fs/notify/mark.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/notify/mark.c')
-rw-r--r--fs/notify/mark.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 06faf166c7ae..0830e0af997a 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -485,16 +485,24 @@ struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_mark_connector *conn,
struct fsnotify_group *group)
{
struct fsnotify_mark *mark;
+ spinlock_t *lock;
if (!conn)
return NULL;
+ if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
+ lock = &conn->inode->i_lock;
+ else
+ lock = &conn->mnt->mnt_root->d_lock;
+ spin_lock(lock);
hlist_for_each_entry(mark, &conn->list, obj_list) {
if (mark->group == group) {
fsnotify_get_mark(mark);
+ spin_unlock(lock);
return mark;
}
}
+ spin_unlock(lock);
return NULL;
}