Whamcloud - gitweb
LU-15200 llite: revalidate dentry if LOOKUP lock fetched
authorLai Siyao <lai.siyao@whamcloud.com>
Sun, 7 Nov 2021 20:38:49 +0000 (15:38 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 22 Jun 2022 00:12:47 +0000 (00:12 +0000)
Once ll_inode_revalidate() fetches LOOKUP lock, it should revalidate
dentry, so subsequent lookup can find it in dcache.

It should also update lli_dir_depth.

Lustre-change: https://review.whamcloud.com/45599
Lustre-commit: 92fadf9cc1d06b21b482a262ff66f435814a13f8

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I847e16d64d605b91efc93925821bc29cbea20fa2
Reviewed-on: https://review.whamcloud.com/47598
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/dcache.c

index ca37609..5272445 100644 (file)
@@ -242,6 +242,8 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,
                            struct lookup_intent *it,
                            struct dentry *de)
 {
+       struct inode *inode = de->d_inode;
+       __u64 bits = 0;
        int rc = 0;
 
         ENTRY;
@@ -252,7 +254,18 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,
        if (it_disposition(it, DISP_LOOKUP_NEG))
                RETURN(-ENOENT);
 
-       rc = ll_prep_inode(&de->d_inode, &request->rq_pill, NULL, it);
+       rc = ll_prep_inode(&inode, &request->rq_pill, NULL, it);
+       if (rc)
+               RETURN(rc);
+
+       ll_set_lock_data(ll_i2sbi(inode)->ll_md_exp, inode, it,
+                        &bits);
+       if (bits & MDS_INODELOCK_LOOKUP) {
+               ll_update_dir_depth(de->d_parent->d_inode, inode);
+               if (ll_d_init(de) < 0)
+                       RETURN(-ENOMEM);
+               d_lustre_revalidate(de);
+       }
 
        RETURN(rc);
 }