Whamcloud - gitweb
LU-283 Clean up trailing whitespace in sanity.sh
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 8c80eac..af6f7af 100644 (file)
@@ -9,7 +9,7 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 13297 2108 9789 3637 9789 3561 12622 12653 12653 5188 16260 19742 
+# bug number for skipped test: 13297 2108 9789 3637 9789 3561 12622 12653 12653 5188 16260 19742
 ALWAYS_EXCEPT="                27u   42a  42b  42c  42d  45   51d   65a   65e   68b  $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"}
@@ -47,8 +47,6 @@ READS=${READS:-"reads"}
 MUNLINK=${MUNLINK:-munlink}
 SOCKETSERVER=${SOCKETSERVER:-socketserver}
 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
-IOPENTEST1=${IOPENTEST1:-iopentest1}
-IOPENTEST2=${IOPENTEST2:-iopentest2}
 MEMHOG=${MEMHOG:-memhog}
 DIRECTIO=${DIRECTIO:-directio}
 ACCEPTOR_PORT=${ACCEPTOR_PORT:-988}
@@ -1331,6 +1329,8 @@ check_seq_oid()
                 local group=${lmm[$((j+3))]}
                 local dev=$(ostdevname $devnum)
                 local dir=${MOUNT%/*}/ost$devnum
+
+                stop ost$devnum
                 do_facet ost$devnum mount -t $FSTYPE $dev $dir $OST_MOUNT_OPTS ||
                         { error "mounting $dev as $FSTYPE failed"; return 3; }
 
@@ -1349,6 +1349,7 @@ check_seq_oid()
 
                 echo -e "\t\tost $obdidx, objid $objid, group $group"
                 do_facet ost$devnum umount -d $dev
+                start ost$devnum $dev $OST_MOUNT_OPTS
         done
 }
 
@@ -2228,7 +2229,7 @@ test_39e() {
        local mtime1=`stat -c %Y $DIR1/$tfile`
 
        touch -m -d @$TEST_39_MTIME $DIR1/$tfile
-       
+
        for (( i=0; i < 2; i++ )) ; do
                local mtime2=`stat -c %Y $DIR1/$tfile`
                [ $mtime2 = $TEST_39_MTIME ] || \
@@ -2266,7 +2267,7 @@ test_39g() {
 
        sleep 2
        chmod o+r $DIR1/$tfile
+
        for (( i=0; i < 2; i++ )) ; do
                local mtime2=`stat -c %Y $DIR1/$tfile`
                [ "$mtime1" = "$mtime2" ] || \
@@ -2361,7 +2362,7 @@ test_39k() {
 
        kill -USR1 $multipid
        wait $multipid || error "multiop close failed"
-               
+
        for (( i=0; i < 2; i++ )) ; do
                local mtime2=`stat -c %Y $DIR1/$tfile`
 
@@ -2441,8 +2442,6 @@ test_39m() {
                cancel_lru_locks osc
                if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
        done
-
-       
 }
 run_test 39m "test atime and mtime before 1970"
 
@@ -3187,7 +3186,7 @@ test_54e() {
 }
 run_test 54e "console/tty device works in lustre ======================"
 
-#The test_55 used to be iopen test and it was removed by bz#24037. 
+#The test_55 used to be iopen test and it was removed by bz#24037.
 #run_test 55 "check iopen_connect_dentry() ======================"
 
 test_56a() {   # was test_56
@@ -3439,7 +3438,7 @@ run_test 56q "check lfs find -gid and ! -gid ==============================="
 test_56r() {
        setup_56 $NUMFILES $NUMDIRS
        TDIR=$DIR/${tdir}g
-       
+
        EXPECTED=12
        NUMS=`$LFIND -size 0 -t f $TDIR | wc -l`
        [ $NUMS -eq $EXPECTED ] || \
@@ -3507,7 +3506,8 @@ test_57b() {
        sync
        sleep 1
        df $dir  #make sure we get new statfs data
-       local MDSFREE=$(do_facet $mymds lctl get_param -n osd.*MDT000$((num -1)).kbytesfree)
+       local MDSFREE=$(do_facet $mymds \
+               lctl get_param -n osd*.*MDT000$((num -1)).kbytesfree)
        local MDCFREE=$(lctl get_param -n mdc.*MDT000$((num -1))-mdc-*.kbytesfree)
        echo "opening files to create objects/EAs"
        local FILE
@@ -3521,7 +3521,8 @@ test_57b() {
 
        sleep 1  #make sure we get new statfs data
        df $dir
-       local MDSFREE2=$(do_facet $mymds lctl get_param -n osd.*MDT000$((num -1)).kbytesfree)
+       local MDSFREE2=$(do_facet $mymds \
+               lctl get_param -n osd*.*MDT000$((num -1)).kbytesfree)
        local MDCFREE2=$(lctl get_param -n mdc.*MDT000$((num -1))-mdc-*.kbytesfree)
        if [ "$MDCFREE2" -lt "$((MDCFREE - 8))" ]; then
                if [ "$MDSFREE" != "$MDSFREE2" ]; then
@@ -3851,7 +3852,7 @@ cleanup_68() {
        if [ ! -z "$LLITELOOPLOAD" ]; then
                rmmod llite_lloop
                unset LLITELOOPLOAD
-       fi 
+       fi
        rm -f $DIR/f68*
 }
 
@@ -3961,7 +3962,7 @@ test_71() {
 }
 run_test 71 "Running dbench on lustre (don't segment fault) ===="
 
-test_72() { # bug 5695 - Test that on 2.6 remove_suid works properly
+test_72a() { # bug 5695 - Test that on 2.6 remove_suid works properly
        check_kernel_version 43 || return 0
        [ "$RUNAS_ID" = "$UID" ] && skip_env "RUNAS_ID = UID = $UID -- skipping" && return
 
@@ -3984,7 +3985,35 @@ test_72() { # bug 5695 - Test that on 2.6 remove_suid works properly
        true
        rm -f $DIR/f72
 }
-run_test 72 "Test that remove suid works properly (bug5695) ===="
+run_test 72a "Test that remove suid works properly (bug5695) ===="
+
+test_72b() { # bug 24226 -- keep mode setting when size is not changing
+       local perm
+
+       [ "$RUNAS_ID" = "$UID" ] && \
+               skip_env "RUNAS_ID = UID = $UID -- skipping" && return
+       [ "$RUNAS_ID" -eq 0 ] && \
+               skip_env "RUNAS_ID = 0 -- skipping" && return
+
+       # Check that testing environment is properly set up. Skip if not
+       FAIL_ON_ERROR=false check_runas_id_ret $RUNAS_ID $RUNAS_ID $RUNAS || {
+               skip_env "User $RUNAS_ID does not exist - skipping"
+               return 0
+       }
+       touch $DIR/${tfile}-f{g,u}
+       mkdir $DIR/${tfile}-d{g,u}
+       chmod 770 $DIR/${tfile}-{f,d}{g,u}
+       chmod g+s $DIR/${tfile}-{f,d}g
+       chmod u+s $DIR/${tfile}-{f,d}u
+       for perm in 777 2777 4777; do
+               $RUNAS chmod $perm $DIR/${tfile}-fg && error "S/gid file allowed improper chmod to $perm"
+               $RUNAS chmod $perm $DIR/${tfile}-fu && error "S/uid file allowed improper chmod to $perm"
+               $RUNAS chmod $perm $DIR/${tfile}-dg && error "S/gid dir allowed improper chmod to $perm"
+               $RUNAS chmod $perm $DIR/${tfile}-du && error "S/uid dir allowed improper chmod to $perm"
+       done
+       true
+}
+run_test 72b "Test that we keep mode setting if without file data changed (bug 24226)"
 
 # bug 3462 - multiple simultaneous MDC requests
 test_73() {
@@ -5062,6 +5091,14 @@ test_105d() { # bug 15924
 }
 run_test 105d "flock race (should not freeze) ========"
 
+test_105e() { # bug 22660 && 22040
+       [ -z "`mount | grep \"$DIR.*flock\" | grep -v noflock`" ] && \
+               skip "mount w/o flock enabled" && return
+       touch $DIR/$tfile
+       flocks_test 3 $DIR/$tfile
+}
+run_test 105e "Two conflicting flocks from same process ======="
+
 test_106() { #bug 10921
        mkdir -p $DIR/$tdir
        $DIR/$tdir && error "exec $DIR/$tdir succeeded"
@@ -7329,15 +7366,15 @@ test_180a() {
         local rmmod_local=0
 
         if ! module_loaded obdecho; then
-            load_module obdecho/obdecho 
-            rmmod_local=1           
+            load_module obdecho/obdecho
+            rmmod_local=1
         fi
 
         local osc=$($LCTL dl | grep -v mdt | awk '$3 == "osc" {print $4; exit}')
         local host=$(awk '/current_connection:/ {print $2}' /proc/fs/lustre/osc/$osc/import)
         local target=$(awk '/target:/ {print $2}' /proc/fs/lustre/osc/$osc/import)
         target=${target%_UUID}
-        
+
         [[ -n $target ]]  && { setup_obdecho_osc $host $target || rc=1; } || rc=1
         [ $rc -eq 0 ] && { obdecho_create_test ${target}_osc client || rc=2; }
         [[ -n $target ]] && cleanup_obdecho_osc $target
@@ -7525,8 +7562,8 @@ run_test 201b "Remove all targets from a pool =========================="
 test_201c() {
        remote_mgs_nodsh && skip "remote MGS with nodsh" && return
        do_facet mgs $LCTL pool_destroy $FSNAME.$POOL
-       
-       sleep 2                        
+
+       sleep 2
     # striping on an empty/nonexistant pool should fall back to "pool of everything"
        touch ${POOL_DIR}/$tfile || error "failed to use fallback striping for missing pool"
        # setstripe on an empty pool should fail
@@ -7795,4 +7832,4 @@ check_and_cleanup_lustre
 if [ "$I_MOUNTED" != "yes" ]; then
        lctl set_param debug="$OLDDEBUG" 2> /dev/null || true
 fi
-exit_status 
+exit_status