summaryrefslogtreecommitdiffstats
path: root/fs/notify/mark.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-03-15 09:41:15 +0100
committerJan Kara <jack@suse.cz>2017-04-10 17:37:35 +0200
commita03e2e4f078365428bb4317989cb5d1d6563cfe9 (patch)
treedaa8ada03fa6b829a06482cbda65ffd0da044421 /fs/notify/mark.c
parentf06fd98759451876f51607f60abd74c89b141610 (diff)
downloadlinux-stable-a03e2e4f078365428bb4317989cb5d1d6563cfe9.tar.gz
linux-stable-a03e2e4f078365428bb4317989cb5d1d6563cfe9.tar.bz2
linux-stable-a03e2e4f078365428bb4317989cb5d1d6563cfe9.zip
fsnotify: Determine lock in fsnotify_destroy_marks()
Instead of passing spinlock into fsnotify_destroy_marks() determine it directly in that function from the connector type. This will reduce code churn when changing lock protecting list of marks. Reviewed-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/mark.c')
-rw-r--r--fs/notify/mark.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 0830e0af997a..f32ca924c44e 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -572,14 +572,19 @@ void fsnotify_detach_group_marks(struct fsnotify_group *group)
}
}
-void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn,
- spinlock_t *lock)
+void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn)
{
struct fsnotify_mark *mark;
+ spinlock_t *lock;
if (!conn)
return;
+ if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
+ lock = &conn->inode->i_lock;
+ else
+ lock = &conn->mnt->mnt_root->d_lock;
+
while (1) {
/*
* We have to be careful since we can race with e.g.