From ff36847e085ce7e0508e81c001a1dd422eb2b740 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Thu, 17 Dec 2009 15:37:33 +0800 Subject: [PATCH] b=17545 control DCACHE_LUSTRE_INVALID flag with MDS_INODELOCK_LOOKUP lock 1) "DCACHE_LUSTRE_INVALID" is controlled by "MDS_INODELOCK_LOOKUP" which is corresponding to "IT_LOOKUP", do not skip invalidate for other intent. 2) cleanup locks from former test cases for replay-single test_53d. i=robert.read i=jinshan.xiong --- lustre/llite/dcache.c | 3 +++ lustre/mdc/mdc_locks.c | 3 +-- lustre/tests/openunlink.c | 8 +++++--- lustre/tests/replay-single.sh | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index d685990..dd7e9c5 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -406,6 +406,9 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags, ll_frob_intent(&it, &lookup_it); LASSERT(it); + if (it->it_op == IT_LOOKUP && !(de->d_flags & DCACHE_LUSTRE_INVALID)) + GOTO(out_sa, rc = 1); + op_data = ll_prep_md_op_data(NULL, parent, de->d_inode, de->d_name.name, de->d_name.len, 0, LUSTRE_OPC_ANY, NULL); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 4fb239f..5606b46 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -1023,8 +1023,7 @@ int mdc_revalidate_lock(struct obd_export *exp, owner/group/acls are under lookup lock, we need both ibits for GETATTR. */ policy.l_inodebits.bits = (it->it_op == IT_GETATTR) ? - MDS_INODELOCK_UPDATE | MDS_INODELOCK_LOOKUP : - MDS_INODELOCK_LOOKUP; + MDS_INODELOCK_UPDATE : MDS_INODELOCK_LOOKUP; mode = ldlm_lock_match(exp->exp_obd->obd_namespace, LDLM_FL_BLOCK_GRANTED, &res_id, LDLM_IBITS, diff --git a/lustre/tests/openunlink.c b/lustre/tests/openunlink.c index d69dff3..aef0c3b 100644 --- a/lustre/tests/openunlink.c +++ b/lustre/tests/openunlink.c @@ -91,18 +91,20 @@ int main(int argc, char **argv) getc(stdin); } + fprintf(stderr, "accessing (1)\n"); if (access(fname, F_OK) == 0) { fprintf(stderr, "%s still exists\n", fname2); exit(1); } - fprintf(stderr, "resetting fd offset\n"); + fprintf(stderr, "seeking (1)\n"); rc = lseek(fd, 0, SEEK_SET); if (rc) { fprintf(stderr, "seek %s\n", strerror(errno)); exit(1); } + fprintf(stderr, "accessing (2)\n"); if (access(fname, F_OK) == 0) { fprintf(stderr, "%s still exists\n", fname); exit(1); @@ -138,7 +140,7 @@ int main(int argc, char **argv) exit(1); } - fprintf(stderr, "seeking\n"); + fprintf(stderr, "seeking (2)\n"); rc = lseek(fd, 0, SEEK_SET); if (rc) { fprintf(stderr, "seek (after unlink trunc) %s\n", @@ -154,7 +156,7 @@ int main(int argc, char **argv) exit(1); } - fprintf(stderr, "seeking\n"); + fprintf(stderr, "seeking (3)\n"); rc = lseek(fd, 0, SEEK_SET); if (rc) { fprintf(stderr, "seek (before unlink read) %s\n", diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index c6e8b11..2ddf988 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -1184,6 +1184,7 @@ test_53c() { run_test 53c "|X| open request and close request while two MDC requests in flight" test_53d() { + cancel_lru_locks mdc # cleanup locks from former test cases rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2 mkdir -p $DIR/${tdir}-1 -- 1.8.3.1