Skip to content

Commit

Permalink
kernfs: fix barrier usage in __kernfs_new_node()
Browse files Browse the repository at this point in the history
smp_mb__before_atomic() can not be applied to atomic_set().  Remove the
barrier and rely on RELEASE synchronization.

Fixes: ba16b28 ("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>
  • Loading branch information
Andrea Parri authored and Greg Kroah-Hartman committed Apr 25, 2019
1 parent 0d1a393 commit 9982679
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/kernfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9982679

Please sign in to comment.