public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrea Parri <andrea.parri@amarulasolutions.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernfs: fix barrier usage in __kernfs_new_node()
Date: Tue, 16 Apr 2019 07:47:30 -0700	[thread overview]
Message-ID: <20190416144617.GA349476@devbig004.ftw2.facebook.com> (raw)
In-Reply-To: <1555417031-27356-1-git-send-email-andrea.parri@amarulasolutions.com>

On Tue, Apr 16, 2019 at 02:17:11PM +0200, Andrea Parri wrote:
> 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>
> ---
>  fs/kernfs/dir.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
> index b84d635567d38..1e7a74b8e0647 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);

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

--
tejun

      reply	other threads:[~2019-04-16 14:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 12:17 [PATCH] kernfs: fix barrier usage in __kernfs_new_node() Andrea Parri
2019-04-16 14:47 ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416144617.GA349476@devbig004.ftw2.facebook.com \
    --to=tj@kernel.org \
    --cc=andrea.parri@amarulasolutions.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox