Whamcloud - gitweb
LU-10059 tests: sanityn 32a error messages
[fs/lustre-release.git] / lustre / tests / sanityn.sh
index ec00a5e..d09a62f 100755 (executable)
@@ -753,7 +753,7 @@ test_27() {
        lctl clear
        dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
        DD2_PID=$!
-       usleep 50
+       sleep 0.5
        log "dd 1 started"
 
        dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
@@ -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
@@ -2932,10 +2935,10 @@ test_51b() {
 
        # delay glimpse so that layout has changed when glimpse finish
 #define OBD_FAIL_GLIMPSE_DELAY 0x1404
-       $LCTL set_param fail_loc=0x1404
+       $LCTL set_param fail_loc=0x1404 fail_val=4
        stat -c %s $DIR2/$tfile |tee $tmpfile &
        local pid=$!
-       sleep 1
+       sleep 0.2
 
        # extend layout of testing file
        dd if=/dev/zero of=$DIR1/$tfile bs=1M count=1 seek=2 conv=notrunc ||
@@ -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,6 +5298,105 @@ test_106c() {
 }
 run_test 106c "Verify statx attributes mask"
 
+test_107a() { # LU-1031
+       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_bg_pause $DIR2/$tfile O_G${gid2}r10g${gid2}c || return 2
+       local MULTIPID2=$!
+       kill -USR1 $MULTIPID2
+       sleep 2
+       if [[ $(ps h -o comm -p $MULTIPID2) == "" ]]; then
+               error "First grouplock does not block second one"
+       else
+               echo "First grouplock blocks second one"
+       fi
+       kill -USR1 $MULTIPID1
+       wait $MULTIPID1
+       wait $MULTIPID2
+}
+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: ======================================================"
 
 # kill and wait in each test only guarentee script finish, but command in script