Whamcloud - gitweb
LU-10059 tests: sanityn 32a error messages
[fs/lustre-release.git] / lustre / tests / sanityn.sh
index 0e8cdd5..d09a62f 100755 (executable)
@@ -877,13 +877,15 @@ test_32a() { # bug 11270
 
        log "checking cached lockless truncate"
        $TRUNCATE $DIR1/$tfile 8000000
-       $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
+       $CHECKSTAT -s 8000000 $DIR2/$tfile ||
+               error "cached truncate - wrong file size"
        [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
                error "cached truncate isn't lockless"
 
        log "checking not cached lockless truncate"
        $TRUNCATE $DIR2/$tfile 5000000
-       $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
+       $CHECKSTAT -s 5000000 $DIR1/$tfile ||
+               error "not cached truncate - wrong file size"
        [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
                error "not cached truncate isn't lockless"
 
@@ -891,7 +893,8 @@ test_32a() { # bug 11270
        enable_lockless_truncate 0
        clear_stats $OSC.*.${OSC}_stats
        $TRUNCATE $DIR2/$tfile 3000000
-       $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
+       $CHECKSTAT -s 3000000 $DIR1/$tfile ||
+               error "lockless truncate disabled - wrong file size"
        [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -eq 0 ] ||
                error "lockless truncate disabling failed"
        rm -f $DIR1/$tfile
@@ -5109,7 +5112,7 @@ check_mdt_xtimes()
        local mdt_xtimes=($(get_mdt_xtimes $mdtdev))
 
        echo "STAT a|m|ctime ${xtimes[*]}"
-       echo "MDT a|m|ctime ${xtimes[*]}"
+       echo "MDT a|m|ctime ${mdt_xtimes[*]}"
        [[ ${xtimes[0]} == ${mdt_xtimes[0]} ]] ||
                error "$DIR/$tfile atime (${xtimes[0]}:${mdt_xtimes[0]}) diff"
        [[ ${xtimes[1]} == ${mdt_xtimes[1]} ]] ||
@@ -5295,7 +5298,7 @@ test_106c() {
 }
 run_test 106c "Verify statx attributes mask"
 
-test_107() { # LU-1031
+test_107a() { # LU-1031
        dd if=/dev/zero of=$DIR1/$tfile bs=1M count=10
        local gid1=14091995
        local gid2=16022000
@@ -5308,7 +5311,7 @@ test_107() { # LU-1031
        local MULTIPID2=$!
        kill -USR1 $MULTIPID2
        sleep 2
-       if [[ `ps h -o comm -p $MULTIPID2` == "" ]]; then
+       if [[ $(ps h -o comm -p $MULTIPID2) == "" ]]; then
                error "First grouplock does not block second one"
        else
                echo "First grouplock blocks second one"
@@ -5317,7 +5320,82 @@ test_107() { # LU-1031
        wait $MULTIPID1
        wait $MULTIPID2
 }
-run_test 107 "Basic grouplock conflict"
+run_test 107a "Basic grouplock conflict"
+
+test_107b() {
+       dd if=/dev/zero of=$DIR1/$tfile bs=1M count=10
+       local gid1=14091995
+       local gid2=16022000
+
+       $LFS getstripe $DIR1/$tfile
+
+       multiop_bg_pause $DIR1/$tfile OG${gid1}_g${gid1}c || return 1
+       local MULTIPID1=$!
+       multiop $DIR2/$tfile Or10c &
+       local MULTIPID2=$!
+       sleep 2
+
+       if [[ $(ps h -o comm -p $MULTIPID2) == "" ]]; then
+               error "Grouplock does not block IO"
+       else
+               echo "Grouplock blocks IO"
+       fi
+
+       multiop $DIR2/$tfile OG${gid2}_g${gid2}c &
+       local MULTIPID3=$!
+       sleep 2
+       if [[ $(ps h -o comm -p $MULTIPID3) == "" ]]; then
+               error "First grouplock does not block second one"
+       else
+               echo "First grouplock blocks second one"
+       fi
+
+       kill -USR1 $MULTIPID1
+       sleep 2
+
+       if [[ $(ps h -o comm -p $MULTIPID3) == "" ]]; then
+               error "Second grouplock thread disappeared"
+       fi
+
+       if [[ $(ps h -o comm -p $MULTIPID2) == "" ]]; then
+               error "Second grouplock does not block IO"
+       else
+               echo "Second grouplock blocks IO"
+       fi
+
+       kill -USR1 $MULTIPID3
+       wait $MULTIPID1
+       wait $MULTIPID2
+       wait $MULTIPID3
+}
+run_test 107b "Grouplock is added to the head of waiting list"
+
+test_108a() {
+       local offset
+
+       $LFS setstripe -E 1M -c 1 -E -1 $DIR1/$tfile ||
+               error "Create $DIR1/$tfile failed"
+
+       dd if=/dev/zero of=$DIR1/$tfile bs=10000 count=1 ||
+               error "dd $DIR1/$tfile failed"
+       offset=$(lseek_test -d 5000 $DIR2/$tfile)
+       [[ $offset == 5000 ]] || error "offset $offset != 5000"
+
+       $TRUNCATE $DIR1/$tfile 2000
+       offset=$(lseek_test -l 1000 $DIR2/$tfile)
+       [[ $offset == 2000 ]] || error "offset $offset != 2000"
+
+       #define OBD_FAIL_OSC_DELAY_IO 0x414
+       $LCTL set_param fail_val=4 fail_loc=0x80000414
+       dd if=/dev/zero of=$DIR1/$tfile count=1 bs=8M conv=notrunc oflag=dsync &
+       local pid=$!
+       sleep 2
+
+       offset=$(lseek_test -l 8000 $DIR2/$tfile)
+       wait $pid
+       [[ $offset == 8388608 ]] || error "offset $offset != 8388608"
+}
+run_test 108a "lseek: parallel updates"
 
 log "cleanup: ======================================================"