Whamcloud - gitweb
LU-15200 llite: revalidate dentry if LOOKUP lock fetched 99/45599/4
authorLai Siyao <lai.siyao@whamcloud.com>
Sun, 7 Nov 2021 20:38:49 +0000 (15:38 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 11 Jan 2022 06:18:52 +0000 (06:18 +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.

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I847e16d64d605b91efc93925821bc29cbea20fa2
Reviewed-on: https://review.whamcloud.com/45599
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/dcache.c

index eeffcdb..4ab59da 100644 (file)
@@ -255,6 +255,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;
@@ -265,7 +267,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_setup(de, true))
+                       RETURN(-ENOMEM);
+               d_lustre_revalidate(de);
+       }
 
        RETURN(rc);
 }