From: xiubli@redhat.com
To: dhowells@redhat.com, idryomov@gmail.com, jlayton@kernel.org
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,
Xiubo Li <xiubli@redhat.com>
Subject: [PATCH v3 2/2] afs: unlock the folio when vnode is marked deleted
Date: Thu, 7 Jul 2022 12:51:12 +0800 [thread overview]
Message-ID: <20220707045112.10177-3-xiubli@redhat.com> (raw)
In-Reply-To: <20220707045112.10177-1-xiubli@redhat.com>
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);
+ return -ESTALE;
+ }
+
+ return 0;
}
static void afs_free_request(struct netfs_io_request *rreq)
--
2.36.0.rc1
next prev parent reply other threads:[~2022-07-07 4:52 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 ` xiubli [this message]
2022-07-07 10:56 ` [PATCH v3 2/2] afs: unlock the folio when vnode is marked deleted Jeff Layton
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=20220707045112.10177-3-xiubli@redhat.com \
--to=xiubli@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=dhowells@redhat.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--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 \
/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®