From e679a64ba3e622da4b4ea10df0baebe0b88e61af Mon Sep 17 00:00:00 2001 From: pschwan Date: Tue, 17 Sep 2002 19:00:13 +0000 Subject: [PATCH] b=596503 b=608680 Reenable bits of dentry caching by doing lock matching for LOOKUP intents in ll_revalidate2. --- lustre/llite/dcache.c | 28 +++++++++++++++++++++++++++- lustre/llite/namei.c | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 631dd9a..a0274d6 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -46,9 +46,35 @@ void ll_intent_release(struct dentry *de) int ll_revalidate2(struct dentry *de, int flags, struct lookup_intent *it) { + struct ll_sb_info *sbi = ll_s2sbi(de->d_sb); + struct lustre_handle lockh; + __u64 res_id[RES_NAME_SIZE] = {0}; + struct obd_device *obddev; ENTRY; - /* for debugging purposes, we currently always force client re-get */ + if (it) + RETURN(0); /* lookups will have NULL it */ + + if (!de->d_inode) + RETURN(0); + + obddev = class_conn2obd(&sbi->ll_mdc_conn); + res_id[0] = de->d_inode->i_ino; + + CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id[0]); + + if (ldlm_lock_match(obddev->obd_namespace, res_id, LDLM_MDSINTENT, + NULL, 0, LCK_PR, &lockh)) { + ldlm_lock_decref(&lockh, LCK_PR); + RETURN(1); + } + + if (ldlm_lock_match(obddev->obd_namespace, res_id, LDLM_MDSINTENT, + NULL, 0, LCK_PW, &lockh)) { + ldlm_lock_decref(&lockh, LCK_PW); + RETURN(1); + } + RETURN(0); } diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index d780ca4..b562dc6 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -115,7 +115,7 @@ int ll_lock(struct inode *dir, struct dentry *dentry, tgtlen = strlen(tgt); it->it_data = NULL; } else if (it->it_op & IT_LOOKUP) - lock_mode = LCK_CR; + lock_mode = LCK_PR; else { LBUG(); RETURN(-EINVAL); -- 1.8.3.1