From 4f1b436b1f99dfd814076cc25378d5613fe8bedd Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Sun, 7 Nov 2021 15:38:49 -0500 Subject: [PATCH] LU-15200 llite: revalidate dentry if LOOKUP lock fetched 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 Change-Id: I847e16d64d605b91efc93925821bc29cbea20fa2 Reviewed-on: https://review.whamcloud.com/47598 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Yingjin Qian Reviewed-by: Andreas Dilger --- lustre/llite/dcache.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index ca37609..5272445 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -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); } -- 1.8.3.1