From 4a42d2f821dd1617c3119660371eb1f64c5f9bb7 Mon Sep 17 00:00:00 2001 From: fanyong <fanyong> Date: Sat, 6 Dec 2008 03:29:47 +0000 Subject: [PATCH] Branch b1_6 b=15691 i=h.huang i=johann If there are too many locks on client-side, then some locks taken by statahead maybe dropped automatically before the real "revalidate" using them. Under such case the statahead should fail. --- lustre/llite/dcache.c | 7 +++++-- lustre/tests/sanity.sh | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 26a152a669..c0989f2e3c 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -453,7 +453,10 @@ do_lock: rc = mdc_intent_lock(exp, &op_data, NULL, 0, it, lookup_flags, &req, ll_mdc_blocking_ast, 0); if (it->it_op == IT_GETATTR && !first) - ll_statahead_exit(de, rc); + /* If there are too many locks on client-side, then some + * locks taken by statahead maybe dropped automatically + * before the real "revalidate" using them. */ + ll_statahead_exit(de, req == NULL ? rc : 0); else if (first == -EEXIST) ll_statahead_mark(de); @@ -578,7 +581,7 @@ out_sa: if (it && it->it_op == IT_GETATTR && rc == 1) { first = ll_statahead_enter(de->d_parent->d_inode, &de, 0); if (!first) - ll_statahead_exit(de, rc); + ll_statahead_exit(de, 1); else if (first == -EEXIST) ll_statahead_mark(de); } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 072d25cee6..fad85859df 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -4941,6 +4941,7 @@ test_123a() { # was test 123, statahead(bug 11401) for ((i=1, j=0; i<=$NUMFREE; j=$i, i=$((i * MULT)) )); do createmany -o $DIR/$tdir/$tfile $j $((i - j)) + swrong=`lctl get_param -n llite.*.statahead_stats | grep "statahead wrong:" | awk '{print $3}'` lctl get_param -n llite.*.statahead_max | grep '[0-9]' cancel_lru_locks mdc cancel_lru_locks osc @@ -4950,6 +4951,7 @@ test_123a() { # was test 123, statahead(bug 11401) delta_sa=$((etime - stime)) log "ls $i files with statahead: $delta_sa sec" lctl get_param -n llite.*.statahead_stats + ewrong=`lctl get_param -n llite.*.statahead_stats | grep "statahead wrong:" | awk '{print $3}'` max=`lctl get_param -n llite.*.statahead_max | head -n 1` lctl set_param -n llite.*.statahead_max 0 @@ -4963,6 +4965,9 @@ test_123a() { # was test 123, statahead(bug 11401) log "ls $i files without statahead: $delta sec" lctl set_param llite.*.statahead_max=$max + if [ $swrong -lt $ewrong ]; then + log "statahead was stopped, maybe too many locks held!" + fi if [ $delta_sa -gt $(($delta + 2)) ]; then log "ls $i files is slower with statahead!" error=1 -- GitLab