]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: update the dlease for the hashed dentry when removing
authorXiubo Li <xiubli@redhat.com>
Wed, 30 Mar 2022 04:21:12 +0000 (12:21 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 25 Apr 2022 09:07:47 +0000 (11:07 +0200)
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 <jlayton@kernel.org>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
fs/ceph/inode.c

index 3c7554d97093a4c2aa0234cc7e72cbaa96ca35a7..ebc936231ea24c98d81f13d5e984e68c9426eded 100644 (file)
@@ -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;
                }