mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: xiubli@redhat.com, dhowells@redhat.com, idryomov@gmail.com
Cc: marc.dionne@auristor.com, willy@infradead.org,
	keescook@chromium.org, kirill.shutemov@linux.intel.com,
	william.kucharski@oracle.com, linux-afs@lists.infradead.org,
	linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org,
	linux-cachefs@redhat.com, vshankar@redhat.com
Subject: Re: [PATCH v3 2/2] afs: unlock the folio when vnode is marked deleted
Date: Thu, 07 Jul 2022 06:56:08 -0400	[thread overview]
Message-ID: <f60dacead3da4ab78edd225749d698f8e621f577.camel@kernel.org> (raw)
In-Reply-To: <20220707045112.10177-3-xiubli@redhat.com>

On Thu, 2022-07-07 at 12:51 +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> The check_write_begin() should unlock the folio if return non-zero,
> otherwise locked.
> 
> URL: https://tracker.ceph.com/issues/56423
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/afs/file.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/afs/file.c b/fs/afs/file.c
> index afacce797fb9..b23e7b5a48ad 100644
> --- a/fs/afs/file.c
> +++ b/fs/afs/file.c
> @@ -379,7 +379,13 @@ static int afs_check_write_begin(struct file *file, loff_t pos, unsigned len,
>  {
>  	struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
>  
> -	return test_bit(AFS_VNODE_DELETED, &vnode->flags) ? -ESTALE : 0;
> +	if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
> +		folio_unlock(*folio);
> +		folio_put(*folio);

Don't you also need this?

	*folio = NULL;

> +		return -ESTALE;
> +	}
> +
> +	return 0;
>  }
>  
>  static void afs_free_request(struct netfs_io_request *rreq)

-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-07-07 10:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  4:51 [PATCH v3 0/2] netfs: fix the crash when unlocking the folio xiubli
2022-07-07  4:51 ` [PATCH v3 1/2] netfs: do not unlock and put the folio twice xiubli
2022-07-07  4:51 ` [PATCH v3 2/2] afs: unlock the folio when vnode is marked deleted xiubli
2022-07-07 10:56   ` Jeff Layton [this message]
2022-07-07 12:52   ` David Howells
2022-07-07 12:32 ` [PATCH v3 1/2] netfs: do not unlock and put the folio twice David Howells
2022-07-08  0:34   ` Xiubo Li
2022-07-07 12:53 ` David Howells
2022-07-07 13:21 ` [PATCH v4] " David Howells
2022-07-07 13:26   ` Matthew Wilcox
2022-07-11  4:19     ` Xiubo Li
2022-07-09  0:27   ` Xiubo Li

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=f60dacead3da4ab78edd225749d698f8e621f577.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=vshankar@redhat.com \
    --cc=william.kucharski@oracle.com \
    --cc=willy@infradead.org \
    --cc=xiubli@redhat.com \
    /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

all inboxes | Powered by JetHome®