From: Xiubo Li <xiu...@redhat.com>

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 <xiu...@redhat.com>
---
 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

--
Linux-cachefs mailing list
Linux-cachefs@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-cachefs

Reply via email to