[PATCH 1/2] netfs: release the folio lock and put the folio before retrying

From: xiubli
Date: Thu Jun 30 2022 - 22:30:10 EST


From: Xiubo Li <xiubli@xxxxxxxxxx>

The lower layer filesystem should always make sure the folio is
locked and do the unlock and put the folio in netfs layer.

URL: https://tracker.ceph.com/issues/56423
Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
---
fs/netfs/buffered_read.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c
index 42f892c5712e..257fd37c2461 100644
--- a/fs/netfs/buffered_read.c
+++ b/fs/netfs/buffered_read.c
@@ -351,8 +351,11 @@ int netfs_write_begin(struct netfs_inode *ctx,
ret = ctx->ops->check_write_begin(file, pos, len, folio, _fsdata);
if (ret < 0) {
trace_netfs_failure(NULL, NULL, ret, netfs_fail_check_write_begin);
- if (ret == -EAGAIN)
+ if (ret == -EAGAIN) {
+ folio_unlock(folio);
+ folio_put(folio);
goto retry;
+ }
goto error;
}
}
--
2.36.0.rc1