Whamcloud - gitweb
bz-13725
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 16ef6f5..626e23e 100644 (file)
@@ -7,8 +7,8 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 4900 4900 2108 9789 3637 9789 3561 5188/5749 13310 10764
-ALWAYS_EXCEPT="                 27o 27q  42a  42b  42c  42d  45   68        74b   75 $SANITY_EXCEPT"
+# bug number for skipped test: 4900 4900 2108 9789 3637 9789 3561 13310 10764
+ALWAYS_EXCEPT="                 27o 27q  42a  42b  42c  42d  45   74b   75 $SANITY_EXCEPT"
 # bug number for skipped test: 2108 9789 3637 9789 3561 5188/5749 1443
 #ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"27m 42a 42b 42c 42d 45 68 76"}
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
@@ -2787,12 +2787,14 @@ test_67() {
 }
 run_test 67 "security test ====================================="
 
+LLOOP=
 cleanup_68() {
        trap 0
-       if [ "$LOOPDEV" ]; then
-               swapoff $LOOPDEV || error "swapoff failed"
-               losetup -d $LOOPDEV || error "losetup -d failed"
-               unset LOOPDEV LOOPNUM
+       if [ ! -z "$LLOOP" ]; then
+               swapoff $LLOOP || error "swapoff failed"
+               $LCTL blockdev_detach $LLOOP || error "detach failed"
+               rm -f $LLOOP
+               unset LLOOP
        fi
        rm -f $DIR/f68
 }
@@ -2805,6 +2807,7 @@ swap_used() {
        swapon -s | awk '($1 == "'$1'") { print $4 }'
 }
 
+
 # excercise swapping to lustre by adding a high priority swapfile entry
 # and then consuming memory until it is used.
 test_68() {
@@ -2812,20 +2815,24 @@ test_68() {
        grep -q obdfilter $LPROC/devices && \
                skip "local OST" && return
 
-       find_loop_dev
-       dd if=/dev/zero of=$DIR/f68 bs=64k count=1024
+       grep -q llite_lloop /proc/modules
+       [ $? -ne 0 ] && skip "can't find module llite_lloop" && return
+
+       LLOOP=$TMP/lloop.`date +%s`.`date +%N`
+       dd if=/dev/zero of=$DIR/f68 bs=64k seek=2047 count=1
+       mkswap $DIR/f68
+
+       $LCTL blockdev_attach $DIR/f68 $LLOOP || error "attach failed"
 
        trap cleanup_68 EXIT
 
-       losetup $LOOPDEV $DIR/f68 || error "losetup $LOOPDEV failed"
-       mkswap $LOOPDEV
-       swapon -p 32767 $LOOPDEV || error "swapon $LOOPDEV failed"
+       swapon -p 32767 $LLOOP || error "swapon $LLOOP failed"
 
-       echo "before: `swapon -s | grep $LOOPDEV`"
-       KBFREE=`meminfo MemTotal`
-       $MEMHOG $KBFREE || error "error allocating $KBFREE kB"
-       echo "after: `swapon -s | grep $LOOPDEV`"
-       SWAPUSED=`swap_used $LOOPDEV`
+       echo "before: `swapon -s | grep $LLOOP`"
+       MEMTOTAL=`meminfo MemTotal`
+       $MEMHOG $MEMTOTAL || error "error allocating $MEMTOTAL kB"
+       echo "after: `swapon -s | grep $LLOOP`"
+       SWAPUSED=`swap_used $LLOOP`
 
        cleanup_68
 
@@ -3540,22 +3547,22 @@ test_102b() {
 run_test 102b "getfattr/setfattr for trusted.lov EAs ============"
 
 test_102c() {
-       # b10930: get/set/list trusted.lov xattr
-       echo "get/set/list trusted.lov xattr ..."
+       # b10930: get/set/list lustre.lov xattr
+       echo "get/set/list lustre.lov xattr ..."
        [ "$OSTCOUNT" -lt "2" ] && skip "skipping 2-stripe test" && return
        mkdir -p $DIR/$tdir
        chown $RUNAS_ID $DIR/$tdir
        local testfile=$DIR/$tdir/$tfile
        $RUNAS $SETSTRIPE $testfile 65536 1 2
-       $RUNAS getfattr -d -m "^trusted" $testfile 2> /dev/null | \
-       grep "trusted.lov" || error "can't get trusted.lov from $testfile"
+       $RUNAS getfattr -d -m "^lustre" $testfile 2> /dev/null | \
+       grep "lustre.lov" || error "can't get lustre.lov from $testfile"
 
        local testfile2=${testfile}2
-       local value=`getfattr -n trusted.lov $testfile 2> /dev/null | \
-                    grep "trusted.lov" |sed -e 's/[^=]\+=//'  `
+       local value=`getfattr -n lustre.lov $testfile 2> /dev/null | \
+                    grep "lustre.lov" |sed -e 's/[^=]\+=//'  `
        
        $RUNAS $MCREATE $testfile2
-       $RUNAS setfattr -n trusted.lov -v $value $testfile2     
+       $RUNAS setfattr -n lustre.lov -v $value $testfile2      
        local tmp_file=${testfile}3
        $RUNAS $GETSTRIPE -v $testfile2 > $tmp_file
        local stripe_size=`grep "size"  $tmp_file| awk '{print $2}'`
@@ -3563,7 +3570,7 @@ test_102c() {
        [ $stripe_size -eq 65536 ] || error "stripe size $stripe_size != 65536"
        [ $stripe_count -eq 2 ] || error "stripe count $stripe_count != 2"
 }
-run_test 102c "non-root getfattr/setfattr for trusted.lov EAs ==========="
+run_test 102c "non-root getfattr/setfattr for lustre.lov EAs ==========="
 
 get_stripe_info() {
        stripe_size=0
@@ -4209,7 +4216,7 @@ test_120g() {
         lru_resize_disable
         count=10000
         echo create $count files
-        mkdir  $DIR/$tdir
+        mkdir -p $DIR/$tdir
         cancel_lru_locks mdc
         cancel_lru_locks osc
         t0=`date +%s`