From 41ad74ca9cde9926ce16cc1a8e1b1e56fb5ee6b0 Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Tue, 26 Jun 2012 14:44:18 +0400 Subject: [PATCH] LU-1341 tests: recovery-small test_19* fixes - test 19a uses ELC, so no eviction happens; - test 19b cancels conflicting lock in advance due to CLIO logic, no eviction again; fix tests to check what is expected - eviction must take place. Change-Id: Ib5365c9f90d1fc388fe81196661b262da5e7ad78 Xyratex-bug-id: MRP-482 Reviewed-by: Alexander Zarochentsev Reviewed-by: Alexander Lezhoev Signed-off-by: Vitaly Fertman Reviewed-on: http://review.whamcloud.com/2592 Tested-by: Hudson Reviewed-by: Jinshan Xiong Reviewed-by: Yu Jian Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/tests/recovery-small.sh | 43 ++++++++++++++++++++++++++++-------------- lustre/tests/test-framework.sh | 15 ++++++++------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 5973990..6a2dc96 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -337,28 +337,43 @@ test_18c() { run_test 18c "Dropped connect reply after eviction handing (14755)" test_19a() { - f=$DIR/$tfile - do_facet client mcreate $f || return 1 - drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected" + local BEFORE=`date +%s` + local EVICT - do_facet client checkstat -v -p 0777 $f || echo evicted - # let the client reconnect - sleep 5 - do_facet client "munlink $f" + mount_client $DIR2 + + do_facet client mcreate $DIR/$tfile || return 1 + drop_ldlm_cancel "chmod 0777 $DIR2" + + umount_client $DIR2 + do_facet client "munlink $DIR/$tfile" + + # let the client reconnect + sleep 5 + EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state | \ + awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }') + + [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] || error "no eviction" } run_test 19a "test expired_lock_main on mds (2867)" test_19b() { - f=$DIR/$tfile - do_facet client $MULTIOP $f Ow || return 1 - do_facet client $MULTIOP $f or || return 2 + local BEFORE=`date +%s` + local EVICT - cancel_lru_locks osc + mount_client $DIR2 - do_facet client $MULTIOP $f or || return 3 - drop_ldlm_cancel $MULTIOP $f Ow || echo "client evicted, as expected" + do_facet client $MULTIOP $DIR/$tfile Ow || return 1 + drop_ldlm_cancel $MULTIOP $DIR2/$tfile Ow + umount_client $DIR2 + do_facet client munlink $DIR/$tfile + + # let the client reconnect + sleep 5 + EVICT=$(do_facet client $LCTL get_param osc.$FSNAME-OST*.state | \ + awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }') - do_facet client munlink $f || return 4 + [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] || error "no eviction" } run_test 19b "test expired_lock_main on ost (2867)" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 6980a99..e4d550d 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1,6 +1,4 @@ #!/bin/bash -# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*- -# vim:shiftwidth=4:softtabstop=4:tabstop=4: trap 'print_summary && touch $TF_FAIL && \ echo "test-framework exiting on error"' ERR @@ -3039,11 +3037,14 @@ pause_bulk() { drop_ldlm_cancel() { #define OBD_FAIL_LDLM_CANCEL 0x304 - RC=0 - do_facet client lctl set_param fail_loc=0x304 - do_facet client "$@" || RC=$? - do_facet client lctl set_param fail_loc=0 - return $RC + local RC=0 + local list=$(comma_list $(mdts_nodes) $(osts_nodes)) + do_nodes $list lctl set_param fail_loc=0x304 + + do_facet client "$@" || RC=$? + + do_nodes $list lctl set_param fail_loc=0 + return $RC } drop_bl_callback() { -- 1.8.3.1