Whamcloud - gitweb
LU-4093 tests: prevent zombie requests when stopping CT 57/8157/4
authorBruno Faccini <bruno.faccini@intel.com>
Fri, 8 Nov 2013 08:24:21 +0000 (09:24 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 14 Nov 2013 01:30:48 +0000 (01:30 +0000)
Fix to prevent any current requests to become zombie when stopping
copytool and thus not to sometimes to induce failures during next
sanity-hsm sub-tests.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I3274e5864469251e6f2040377b84429e4f218f47
Reviewed-on: http://review.whamcloud.com/8157
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-hsm.sh

index 04bcd65..8b89a18 100644 (file)
@@ -163,10 +163,34 @@ copytool_setup() {
 copytool_cleanup() {
        trap - EXIT
        local agents=${1:-$(facet_active_host $SINGLEAGT)}
+       local mdtno
+       local idx
+       local oldstate
+       local mdt_hsmctrl
 
        do_nodesv $agents "pkill -INT -x $HSMTOOL_BASE" || return 0
        sleep 1
        echo "Copytool is stopped on $agents"
+
+       # clean all CDTs orphans requests from previous tests
+       # that would otherwise need to timeout to clear.
+       for mdtno in $(seq 1 $MDSCOUNT); do
+               idx=$(($mdtno - 1))
+               mdt_hsmctrl="mdt.$FSNAME-MDT000${idx}.hsm_control"
+               oldstate=$(do_facet mds${mdtno} "$LCTL get_param -n " \
+                                  "$MDT_HSMCTRL")
+               # skip already stop[ed,ing] CDTs
+               echo $oldstate | grep stop || continue
+
+               do_facet mds${mdtno} "$LCTL set_param $mdt_hsmctrl=shutdown"
+               wait_result mds${mdtno} "$LCTL get_param -n $mdt_hsmctrl" \
+                       "stopped" 20 ||
+                       error "mds${mdtno} cdt state is not stopped"
+               do_facet mds${mdtno} "$LCTL set_param $mdt_hsmctrl=$oldstate"
+               wait_result mds${mdtno} "$LCTL get_param -n $mdt_hsmctrl" \
+                       "$oldstate" 20 ||
+                       error "mds${mdtno} cdt state is not $oldstate"
+       done
 }
 
 copytool_suspend() {