Whamcloud - gitweb
b=17524
authorgrev <grev>
Fri, 27 Feb 2009 14:04:37 +0000 (14:04 +0000)
committergrev <grev>
Fri, 27 Feb 2009 14:04:37 +0000 (14:04 +0000)
i=Adilger
exhaust_precreations, reset_enospc, test_27n, test_27s fixes

lustre/tests/sanity.sh

index deb70fb..be81189 100644 (file)
@@ -797,6 +797,7 @@ run_test 26f "rm -r of a directory which has recursive symlink ="
 test_27a() {
        echo '== stripe sanity =============================================='
        mkdir -p $DIR/d27 || error "mkdir failed"
+       $GETSTRIPE $DIR/d27
        $SETSTRIPE $DIR/d27/f0 -c 1 || error "lstripe failed"
        $CHECKSTAT -t file $DIR/d27/f0 || error "checkstat failed"
        pass
@@ -911,20 +912,27 @@ run_test 27m "create file while OST0 was full =================="
 
 # osc's keep a NOSPC stick flag that gets unset with rmdir
 reset_enospc() {
-       [ "$1" ] && FAIL_LOC=$1 || FAIL_LOC=0
+       local FAIL_LOC=${1:-0}
+       local OSTIDX=${2:-""}
+
        mkdir -p $DIR/d27/nospc
        rmdir $DIR/d27/nospc
-       do_nodes $(comma_list $(osts_nodes)) lctl set_param fail_loc=$FAIL_LOC
+       local list=$(comma_list $(osts_nodes))
+       [ "$OSTIDX" ] && \
+               { var=ost$((OSTIDX + 1))_HOST && list=${!var}; }
+
+       do_nodes $list lctl set_param fail_loc=$FAIL_LOC
 }
 
 exhaust_precreations() {
-       OSTIDX=$1
+       local OSTIDX=$1
+
+       local OST=$(lfs osts | grep ${OSTIDX}": " | \
+               awk '{print $2}' | sed -e 's/_UUID$//')
 
-       OST=$(lfs osts | grep ${OSTIDX}": " | \
-           awk '{print $2}' | sed -e 's/_UUID$//')
        # on the mdt's osc
-       last_id=$(do_facet mds lctl get_param -n osc.${OST}-osc.prealloc_last_id)
-       next_id=$(do_facet mds lctl get_param -n osc.${OST}-osc.prealloc_next_id)
+       local last_id=$(do_facet mds lctl get_param -n osc.${OST}-osc.prealloc_last_id)
+       local next_id=$(do_facet mds lctl get_param -n osc.${OST}-osc.prealloc_next_id)
 
        mkdir -p $DIR/d27/${OST}
        $SETSTRIPE $DIR/d27/${OST} -i $OSTIDX -c 1
@@ -933,7 +941,7 @@ exhaust_precreations() {
        echo "Creating to objid $last_id on ost $OST..."
        createmany -o $DIR/d27/${OST}/f $next_id $((last_id - next_id + 2))
        do_facet mds "lctl get_param -n osc.${OST}-osc.prealloc*" | grep '[0-9]'
-       reset_enospc $2
+       reset_enospc $2 $OSTIDX
 }
 
 exhaust_all_precreations() {
@@ -951,6 +959,7 @@ test_27n() {
 
        reset_enospc
        rm -f $DIR/d27/f27n
+       $SETSTRIPE $DIR/d27 -c 1 -i -1
        exhaust_precreations 0 0x80000215
 
        touch $DIR/d27/f27n || error
@@ -1033,7 +1042,10 @@ run_test 27r "stripe file with some full OSTs (shouldn't LBUG) ="
 
 test_27s() { # bug 10725
        mkdir -p $DIR/$tdir
-       $LSTRIPE $DIR/$tdir $((4096 * 1024 * 1024)) -1 2 && \
+       local stripe_size=$((4096 * 1024 * 1024))       # 2^32
+       local stripe_count=0
+       [ $OSTCOUNT -eq 1 ] || stripe_count=2 
+       $SETSTRIPE $DIR/$tdir -s $stripe_size -c $stripe_count && \
                error "stripe width >= 2^32 succeeded" || true
 }
 run_test 27s "lsm_xfersize overflow (should error) (bug 10725)"
@@ -1080,15 +1092,17 @@ test_27v() { # bug 4900
 
         touch $DIR/$tdir/$tfile
         #define OBD_FAIL_TGT_DELAY_PRECREATE     0x705
-        lctl set_param fail_loc=0x705
-        START=`date +%s`
-        for F in `seq 1 32`; do
-                touch $DIR/$tdir/$tfile.$F
+        # all except ost1
+        for (( i=0; i < OSTCOUNT; i++ )) ; do
+                do_facet ost$i lctl set_param fail_loc=0x705
         done
-        lctl set_param fail_loc=0
+        local START=`date +%s`
+        createmany -o $DIR/$tdir/$tfile 32
+
+        reset_enospc
 
-        FINISH=`date +%s`
-        TIMEOUT=`lctl get_param -n timeout`
+        local FINISH=`date +%s`
+        local TIMEOUT=`lctl get_param -n timeout`
         [ $((FINISH - START)) -ge $((TIMEOUT / 2)) ] && \
                error "$FINISH - $START >= $TIMEOUT / 2"