summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Parri <andrea.parri@amarulasolutions.com>2019-04-16 14:17:11 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-25 21:41:35 +0200
commit998267900cee901c5d1dfa029a6304d00acbc29f (patch)
treea2214323039127c20b8db1beb8c2093e42ba7e77
parent0d1a393d61e44e2755eeff2e62fc8e91f8b296b6 (diff)
downloadlinux-998267900cee901c5d1dfa029a6304d00acbc29f.tar.bz2
kernfs: fix barrier usage in __kernfs_new_node()
smp_mb__before_atomic() can not be applied to atomic_set(). Remove the barrier and rely on RELEASE synchronization. Fixes: ba16b2846a8c6 ("kernfs: add an API to get kernfs node from inode number") Cc: stable@vger.kernel.org Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/kernfs/dir.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index b84d635567d3..1e7a74b8e064 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -650,11 +650,10 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
kn->id.generation = gen;
/*
- * set ino first. This barrier is paired with atomic_inc_not_zero in
+ * set ino first. This RELEASE is paired with atomic_inc_not_zero in
* kernfs_find_and_get_node_by_ino
*/
- smp_mb__before_atomic();
- atomic_set(&kn->count, 1);
+ atomic_set_release(&kn->count, 1);
atomic_set(&kn->active, KN_DEACTIVATED_BIAS);
RB_CLEAR_NODE(&kn->rb);