On 4/12/22 12:30 AM, Luís Henriques wrote:
On Mon, Apr 11, 2022 at 08:14:26AM +0800, xiubli@xxxxxxxxxx wrote:
From: Xiubo Li <xiubli@xxxxxxxxxx>
Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
---
fs/ceph/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index a2ff964e332b..6788a1f88eb6 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2301,7 +2301,6 @@ static int fill_fscrypt_truncate(struct inode *inode,
pos = orig_pos;
ret = __ceph_sync_read(inode, &pos, &iter, &retry_op, &objver);
- ceph_put_cap_refs(ci, got);
if (ret < 0)
goto out;
@@ -2365,6 +2364,7 @@ static int fill_fscrypt_truncate(struct inode *inode,
out:
dout("%s %p size dropping cap refs on %s\n", __func__,
inode, ceph_cap_string(got));
+ ceph_put_cap_refs(ci, got);
kunmap_local(iov.iov_base);
if (page)
__free_pages(page, 0);
--
2.27.0
If the plan is to squash this into commit "ceph: add truncate size
handling support for fscrypt" it may be worth also fix the
kmap_local_page()/kunmap_local() as the first few 'goto out' jumps
shouldn't be doing the kunmap.
Good catch, will fix it in V3.
-- Xiubo
Cheers,
--
Luís