ceph: update the dlease for the hashed dentry when removing
PATCH 1/1 ceph: update the dlease for the hashed dentry when removing
From: Xiubo Li <[email protected]>
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.
--- fs/ceph/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ceph/inode.c +3 -1
@@ -1467,10 +1467,12 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req) }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; }
Signature · 1 line
2.27.0
Quoted 19 lines · On Wed, 2022-03-30 at 13:49 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
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.
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/ceph/inode.c +0
-0@@ -1467,10 +1467,12 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req) }else if (have_lease) {if (d_unhashed (dn))d_add (dn,NULL );
fs/ceph/inode.c int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req) · line 1478
Quoted 10 lines
fs/ceph/inode.c +3
-1+ } + +if (!d_unhashed (dn) && have_lease)update_dentry_lease (dir, dn, rinfo->dlease, session, req->r_request_started); - } goto done; }
I think this makes sense, since we can have a lease for a negative dentry.
Quoted 24 lines · Jeff Layton
Quoted 23 lines · On Wed, 2022-03-30 at 13:49 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
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.
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/ceph/inode.c +3
-0@@ -1467,10 +1467,12 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req) }else if (have_lease) {if (d_unhashed (dn))d_add (dn,NULL ); + } + +if (!d_unhashed (dn) && have_lease) update_dentry_lease(dir, dn,
Quoted 8 lines
fs/ceph/inode.c int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req) · line 1478
Quoted 6 lines
fs/ceph/inode.c +0
-1rinfo->dlease, session, req->r_request_started); - } goto done; }I think this makes sense, since we can have a lease for a negative dentry.
Yeah, from the logs there really has many case will do that.
Thanks Jeff.
Quoted 3 lines
Reviewed-by Jeff Layton <[email protected]>