Whamcloud - gitweb
LU-1670 tests: Load in-tree osd-zfs when necessary
[fs/lustre-release.git] / lustre / tests / sanityn.sh
index dbeba23..f015397 100644 (file)
@@ -25,11 +25,11 @@ CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
 MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
+export MULTIOP=${MULTIOP:-multiop}
 export TMP=${TMP:-/tmp}
 MOUNT_2=${MOUNT_2:-"yes"}
 CHECK_GRANT=${CHECK_GRANT:-"yes"}
 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
-TSTUSR=${TSTUSR:-"quota_usr"}
 
 SAVE_PWD=$PWD
 
@@ -271,7 +271,7 @@ test_14a() {
        cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
         MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
         MULTIOP_PID=$!
-        multiop $DIR2/d14/multiop Oc && error "expected error, got success"
+        $MULTIOP $DIR2/d14/multiop Oc && error "expected error, got success"
         kill -USR1 $MULTIOP_PID || return 2
         wait $MULTIOP_PID || return 3
         rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
@@ -393,9 +393,9 @@ test_20() {
        mkdir $DIR1/d20
        cancel_lru_locks osc
        CNT=$((`lctl get_param -n llite.*.dump_page_cache | wc -l`))
-       multiop $DIR1/f20 Ow8190c
-       multiop $DIR2/f20 Oz8194w8190c
-       multiop $DIR1/f20 Oz0r8190c
+       $MULTIOP $DIR1/f20 Ow8190c
+       $MULTIOP $DIR2/f20 Oz8194w8190c
+       $MULTIOP $DIR1/f20 Oz0r8190c
        cancel_lru_locks osc
        CNTD=$((`lctl get_param -n llite.*.dump_page_cache | wc -l` - $CNT))
        [ $CNTD -gt 0 ] && \
@@ -898,38 +898,44 @@ test_35() { # bug 17645
 run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client"
 
 test_36() { #bug 16417
-    local SIZE
-    local SIZE_B
-    local i
+       local SIZE
+       local SIZE_B
+       local i
 
-    mkdir -p $DIR1/$tdir
-    $LFS setstripe -c -1 $DIR1/$tdir
-    i=0
-    SIZE=50
-    let SIZE_B=SIZE*1024*1024
-
-    while [ $i -le 10 ]; do
-        lctl mark "start test"
-        local before=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }')
-        dd if=/dev/zero of=$DIR1/$tdir/file000 bs=1M count=$SIZE
-        sync
-        sleep 1
-        local after_dd=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }')
-        multiop_bg_pause $DIR2/$tdir/file000 O_r${SIZE_B}c || return 3
-        read_pid=$!
-        rm -f $DIR1/$tdir/file000
-        kill -USR1 $read_pid
-        wait $read_pid
-        sleep 1
-        local after=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }')
-        echo "*** cycle($i) *** before($before):after_dd($after_dd):after($after)"
-        # this free space! not used
-        if [ $after_dd -ge $after ]; then
-            error "space leaked"
-            return 1;
-        fi
-        let i=i+1
-            done
+       mkdir -p $DIR1/$tdir
+       $LFS setstripe -c -1 $DIR1/$tdir
+       i=0
+       SIZE=50
+       let SIZE_B=SIZE*1024*1024
+
+       while [ $i -le 10 ]; do
+               lctl mark "start test"
+               local before=$($LFS df | awk '{if ($1 ~/^filesystem/) \
+                                              {print $5; exit} }')
+               dd if=/dev/zero of=$DIR1/$tdir/file000 bs=1M count=$SIZE
+               sync          # sync data from client's cache
+               sync_all_data # sync data from server's cache (delayed
+                             # allocation)
+               sleep 1
+               local after_dd=$($LFS df | awk '{if ($1 ~/^filesystem/) \
+                                                {print $5; exit} }')
+               multiop_bg_pause $DIR2/$tdir/file000 O_r${SIZE_B}c || return 3
+               read_pid=$!
+               rm -f $DIR1/$tdir/file000
+               kill -USR1 $read_pid
+               wait $read_pid
+               sleep 1
+               local after=$($LFS df | awk '{if ($1 ~/^filesystem/) \
+                                             {print $5; exit} }')
+               echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
+                       "after($after)"
+               # this free space! not used
+               if [ $after_dd -ge $after ]; then
+                       error "space leaked"
+                       return 1;
+               fi
+               let i=i+1
+       done
 }
 run_test 36 "handle ESTALE/open-unlink corectly"
 
@@ -1201,7 +1207,7 @@ run_test 40e "pdirops: rename and others =============="
 test_41a() {
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
        mkdir $DIR2/$tfile && error "mkdir must fail"
@@ -1214,10 +1220,10 @@ run_test 41a "pdirops: create vs mkdir =============="
 test_41b() {
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
-       multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
+       $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
        check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
        rm -r $DIR1/*
        return 0
@@ -1228,7 +1234,7 @@ test_41c() {
        touch $DIR1/$tfile-2
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
        link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
@@ -1241,7 +1247,7 @@ run_test 41c "pdirops: create vs link =============="
 test_41d() {
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
        rm $DIR2/$tfile || error "unlink must succeed"
@@ -1255,7 +1261,7 @@ test_41e() {
        touch $DIR1/$tfile-2
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
        mv $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
@@ -1268,7 +1274,7 @@ run_test 41e "pdirops: create and rename (tgt) =============="
 test_41f() {
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
        mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
@@ -1281,7 +1287,7 @@ run_test 41f "pdirops: create and rename (src) =============="
 test_41g() {
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
        stat $DIR2/$tfile > /dev/null || error "stat must succeed"
@@ -1294,7 +1300,7 @@ run_test 41g "pdirops: create vs getattr =============="
 test_41h() {
 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK    0x145
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
-       multiop $DIR1/$tfile oO_CREAT:O_RDWR:c &
+       $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
        PID1=$!
        sleep 1
        ls -lia $DIR2/ > /dev/null
@@ -1324,7 +1330,7 @@ test_42b() {
        mkdir $DIR1/$tfile &
        PID1=$!
        sleep 1
-       multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
+       $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
        check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
        rm -r $DIR1/*
        return 0
@@ -1433,7 +1439,7 @@ test_43b() {
        rm $DIR1/$tfile &
        PID1=$!
        sleep 1
-       multiop $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
+       $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
        check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
        rm -r $DIR1/*
        return 0
@@ -1548,7 +1554,7 @@ test_44b() {
        mv $DIR1/$tfile-2 $DIR1/$tfile &
        PID1=$!
        sleep 1
-       multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
+       $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
        check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
        rm -r $DIR1/*
        return 0
@@ -1665,7 +1671,7 @@ test_45b() {
        mv $DIR1/$tfile $DIR1/$tfile-2 &
        PID1=$!
        sleep 1
-       multiop $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
+       $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
        check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
        rm -r $DIR1/*
        return 0
@@ -1780,7 +1786,7 @@ test_46b() {
        link $DIR1/$tfile-2 $DIR1/$tfile &
        PID1=$!
        sleep 1
-       multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
+       $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
        check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
        rm -r $DIR1/*
        return 0
@@ -1926,7 +1932,7 @@ test_60() {
            error "chmod should not change data version: $version5 != $version6"
 
        # Chown do not change version
-       chown $TSTUSR $file2 || error "Could not chown $TSTUSR $file2"
+       chown $RUNAS_ID $file2 || error "Could not chown $RUNAS_ID $file2"
        version7=$($LFS data_version $file1)
        [ "$version5" == "$version7" ] ||
            error "chown should not change data version: $version5 != $version7"