From 61aea6d3f04db51fef41d205b55e8f2dd59b50fa Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Wed, 30 Mar 2022 12:21:12 +0800 Subject: [PATCH] ceph: update the dlease for the hashed dentry when removing The MDS will always refresh the dentry lease when removing the files or directories. And if the dentry is still hashed, we can update the dentry lease and no need to do the lookup from the MDS later. Reviewed-by: Jeff Layton Signed-off-by: Xiubo Li --- fs/ceph/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 3c7554d97093a..ebc936231ea24 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1467,10 +1467,12 @@ retry_lookup: } else if (have_lease) { if (d_unhashed(dn)) d_add(dn, NULL); + } + + if (!d_unhashed(dn) && have_lease) update_dentry_lease(dir, dn, rinfo->dlease, session, req->r_request_started); - } goto done; } -- 2.39.5