summaryrefslogtreecommitdiffstats
path: root/fs/notify/mark.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-05-01 18:05:11 +0200
committerJan Kara <jack@suse.cz>2019-05-01 18:05:11 +0200
commit11a6f8e2db26519b6468686411deafab81c14741 (patch)
tree0739bb2a32546805eb2e2665f17f384aec85cf14 /fs/notify/mark.c
parentb1da6a51871c6929dced1a7fad81990988b36ed6 (diff)
downloadlinux-11a6f8e2db26519b6468686411deafab81c14741.tar.gz
linux-11a6f8e2db26519b6468686411deafab81c14741.tar.bz2
linux-11a6f8e2db26519b6468686411deafab81c14741.zip
fsnotify: Clarify connector assignment in fsnotify_add_mark_list()
Add a comment explaining why WRITE_ONCE() is enough when setting mark->connector which can get dereferenced by RCU protected readers. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/mark.c')
-rw-r--r--fs/notify/mark.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 22acb0a79b53..b251105f646f 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -619,6 +619,11 @@ restart:
/* mark should be the last entry. last is the current last entry */
hlist_add_behind_rcu(&mark->obj_list, &last->obj_list);
added:
+ /*
+ * Since connector is attached to object using cmpxchg() we are
+ * guaranteed that connector initialization is fully visible by anyone
+ * seeing mark->connector set.
+ */
WRITE_ONCE(mark->connector, conn);
out_err:
spin_unlock(&conn->lock);