linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiubo Li <xiubli@redhat.com>
To: Jeff Layton <jlayton@kernel.org>, linux-fsdevel@vger.kernel.org
Cc: linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org,
	linux-cifs@vger.kernel.org, chuck.lever@oracle.com,
	viro@zeniv.linux.org.uk, hch@lst.de
Subject: Re: [PATCH 2/7] ceph: use locks_inode_context helper
Date: Thu, 17 Nov 2022 12:56:58 +0800	[thread overview]
Message-ID: <589a0fcc-569f-e5b2-0877-c1639736ae5e@redhat.com> (raw)
In-Reply-To: <20221116151726.129217-3-jlayton@kernel.org>


On 16/11/2022 23:17, Jeff Layton wrote:
> ceph currently doesn't access i_flctx safely. This requires a
> smp_load_acquire, as the pointer is set via cmpxchg (a release
> operation).
>
> Cc: Xiubo Li <xiubli@redhat.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>   fs/ceph/locks.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
> index 3e2843e86e27..f3b461c708a8 100644
> --- a/fs/ceph/locks.c
> +++ b/fs/ceph/locks.c
> @@ -364,7 +364,7 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count)
>   	*fcntl_count = 0;
>   	*flock_count = 0;
>   
> -	ctx = inode->i_flctx;
> +	ctx = locks_inode_context(inode);
>   	if (ctx) {
>   		spin_lock(&ctx->flc_lock);
>   		list_for_each_entry(lock, &ctx->flc_posix, fl_list)
> @@ -418,7 +418,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode,
>   				int num_fcntl_locks, int num_flock_locks)
>   {
>   	struct file_lock *lock;
> -	struct file_lock_context *ctx = inode->i_flctx;
> +	struct file_lock_context *ctx = locks_inode_context(inode);
>   	int err = 0;
>   	int seen_fcntl = 0;
>   	int seen_flock = 0;

Thanks Jeff!

Reviewed-by: Xiubo Li <xiubli@redhat.com>



  parent reply	other threads:[~2022-11-17  4:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 15:17 [PATCH 0/7] fs: fix inode->i_flctx accesses Jeff Layton
2022-11-16 15:17 ` [PATCH 1/7] filelock: add a new locks_inode_context accessor function Jeff Layton
2022-11-16 16:08   ` Christoph Hellwig
2022-11-16 17:43     ` Jeff Layton
2022-11-16 15:17 ` [PATCH 2/7] ceph: use locks_inode_context helper Jeff Layton
2022-11-16 16:08   ` Christoph Hellwig
2022-11-17  4:56   ` Xiubo Li [this message]
2022-11-16 15:17 ` [PATCH 3/7] cifs: " Jeff Layton
2022-11-16 16:09   ` Christoph Hellwig
2022-11-16 15:17 ` [PATCH 4/7] ksmbd: " Jeff Layton
2022-11-16 16:09   ` Christoph Hellwig
2022-11-16 23:45   ` Namjae Jeon
2022-11-16 15:17 ` [PATCH 5/7] lockd: " Jeff Layton
2022-11-16 16:09   ` Christoph Hellwig
2022-11-16 15:17 ` [PATCH 6/7] nfs: " Jeff Layton
2022-11-16 16:10   ` Christoph Hellwig
2022-11-16 15:17 ` [PATCH 7/7] nfsd: " Jeff Layton
2022-11-16 15:21   ` Chuck Lever III
2022-11-16 15:36     ` Jeff Layton
2022-11-16 16:10   ` Christoph Hellwig

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=589a0fcc-569f-e5b2-0877-c1639736ae5e@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=hch@lst.de \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).