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>
Wed, 25 May 2022 18:45:13 +0000 (20:45 +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.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/inode.c

index 63113e2..f9b68b2 100644 (file)
@@ -1466,10 +1466,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;
                }