Whamcloud - gitweb
b=24037 Remove iopen patch.
[fs/lustre-release.git] / lustre / tests / sanityn.sh
index 2058aa8..7ecfa9d 100644 (file)
@@ -26,7 +26,6 @@ SETSTRIPE=${SETSTRIPE:-lstripe}
 MCREATE=${MCREATE:-mcreate}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
-TRUNCATE=${TRUNCATE:-truncate}
 export TMP=${TMP:-/tmp}
 MOUNT_2=${MOUNT_2:-"yes"}
 CHECK_GRANT=${CHECK_GRANT:-"yes"}
@@ -65,7 +64,7 @@ rm -rf $DIR1/[df][0-9]* $DIR1/lnk
 # $RUNAS_ID may get set incorrectly somewhere else
 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
 
-check_runas_id $RUNAS_ID $RUNAS_ID $RUNAS
+check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
 
 build_test_filter
 
@@ -148,7 +147,7 @@ run_test 4 "fstat validation on multiple mount points =========="
 
 test_5() {
        mcreate $DIR1/f5
-       truncate $DIR2/f5 100
+       $TRUNCATE $DIR2/f5 100
        $CHECKSTAT -t file -s 100 $DIR1/f5 || error
        rm $DIR1/f5
 }
@@ -208,13 +207,13 @@ test_10b() {
        yes "R" | head -c 4000 >$TMP/f10b-seed
        dd if=$TMP/f10b-seed of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1"
 
-       truncate $DIR1/f10b 4096 || error "truncate 4096"
+       $TRUNCATE $DIR1/f10b 4096 || error "truncate 4096"
 
        dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2"
 
        # create a test file locally to compare
        dd if=$TMP/f10b-seed of=$TMP/f10b bs=3k count=1 || error "dd random"
-       truncate $TMP/f10b 4096 || error "truncate 4096"
+       $TRUNCATE $TMP/f10b 4096 || error "truncate 4096"
        cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare"
        rm $TMP/f10b $TMP/f10b-lustre $TMP/f10b-seed
 }
@@ -284,7 +283,7 @@ test_14b() { # bug 3192, 7040
        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=$!
-        truncate $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \
+        $TRUNCATE $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \
                error "expected truncate error, got success"
         kill -USR1 $MULTIOP_PID || return 2
         wait $MULTIOP_PID || return 3
@@ -473,13 +472,13 @@ test_25() {
        chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
 
        $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
-       setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #1"
+       setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #1"
        $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
-       setfacl -m u:$RUNAS_ID:r-x $DIR1/$tdir || error "setfacl $DIR2/$tdir #2"
+       setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir || error "setfacl $DIR2/$tdir #2"
        $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
-       setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #3"
+       setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #3"
        $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
-       setfacl -x u:$RUNAS_ID: $DIR1/$tdir || error "setfacl $DIR2/$tdir #4"
+       setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir || error "setfacl $DIR2/$tdir #4"
        $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
 
        rm -rf $DIR1/$tdir
@@ -773,13 +772,22 @@ run_test 33a "commit on sharing, cross crete/delete, 2 clients, benchmark"
 
 # End commit on sharing tests
 
+get_ost_lock_timeouts() {
+    local nodes=${1:-$(comma_list $(osts_nodes))}
+
+    local locks=$(do_nodes $nodes \
+        "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
+
+    echo $locks
+}
+
 test_34() { #16129
         local OPER
         local lock_in
         local lock_out
         for OPER in notimeout timeout ; do
                 rm $DIR1/$tfile 2>/dev/null
-                lock_in=$(do_nodes $(osts_nodes) "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
+                lock_in=$(get_ost_lock_timeouts)
                 if [ $OPER == "timeout" ] ; then
                         for j in `seq $OSTCOUNT`; do
                                 #define OBD_FAIL_PTLRPC_HPREQ_TIMEOUT    0x511
@@ -800,7 +808,7 @@ test_34() { #16129
                 dd of=/dev/null if=$DIR2/$tfile > /dev/null 2>&1
                 # wait for a lock timeout
                 sleep 4
-                lock_out=$(do_nodes $(osts_nodes) "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
+                lock_out=$(get_ost_lock_timeouts)
                 if [ $OPER == "timeout" ] ; then
                         if [ $lock_in == $lock_out ]; then
                                 error "no lock timeout happened"
@@ -1849,6 +1857,19 @@ test_46h() {
 }
 run_test 46h "pdirops: link vs readdir =============="
 
+test_50() {
+        trunc_size=4096
+        dd if=/dev/zero of=$DIR1/$tfile bs=1K count=10
+#define OBD_FAIL_OSC_CP_ENQ_RACE         0x410
+        do_facet client "lctl set_param fail_loc=0x410"
+        $TRUNCATE $DIR2/$tfile $trunc_size
+        do_facet client "lctl set_param fail_loc=0x0"
+        sleep 3
+        size=`stat -c %s $DIR2/$tfile`
+        [ $size -eq $trunc_size ] || error "wrong size"
+}
+run_test 50 "osc lvb attrs: enqueue vs. CP AST =============="
+
 log "cleanup: ======================================================"
 
 [ "$(mount | grep $MOUNT2)" ] && umount $MOUNT2