Whamcloud - gitweb
LU-1341 tests: recovery-small test_19* fixes
authorVitaly Fertman <vitaly_fertman@xyratex.com>
Tue, 26 Jun 2012 10:44:18 +0000 (14:44 +0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 27 Jun 2012 03:46:18 +0000 (23:46 -0400)
- 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 <alexander_zarochentsev@xyratex.com>
Reviewed-by: Alexander Lezhoev <Alexander_Lezhoev@xyratex.com>
Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Reviewed-on: http://review.whamcloud.com/2592
Tested-by: Hudson
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/recovery-small.sh
lustre/tests/test-framework.sh

index 5973990..6a2dc96 100755 (executable)
@@ -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)"
 
index 6980a99..e4d550d 100644 (file)
@@ -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() {