On Wed, 2022-03-30 at 13:49 +0800, xiubli@xxxxxxxxxx wrote: > From: Xiubo Li <xiubli@xxxxxxxxxx> > > 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@xxxxxxxxxx> > --- > 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 64b341f5e7bc..8cf55e6e609e 100644 > --- a/fs/ceph/inode.c > +++ b/fs/ceph/inode.c > @@ -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; > } > I think this makes sense, since we can have a lease for a negative dentry. Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>