X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fsanity.sh;h=2a2b650c261bf53d62079a54bf02581ef3d4dcde;hp=8b828d7e5ea04d9a75af0acb6ac5dcc3312af87e;hb=08ac163a04f0a9c5e4348174aa835796e2190e28;hpb=2b5caa112fcc4361b255105fa331b8fcbc11799a diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 8b828d7..2a2b650 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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} @@ -72,7 +70,6 @@ init_logging [ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24v 27m 36f 36g 36h 51b 51c 60c 63 64b 68 71 73 77f 78 101 103 115 120g 124b" -SANITYLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log} FAIL_ON_ERROR=false cleanup() { @@ -103,8 +100,6 @@ if [ "$ONLY" == "cleanup" ]; then exit 0 fi -[ "$SANITYLOG" ] && rm -f $SANITYLOG || true - check_and_setup_lustre DIR=${DIR:-$MOUNT} @@ -1334,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; } @@ -1352,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 } @@ -1444,12 +1442,30 @@ test_29() { } run_test 29 "IT_GETATTR regression ============================" -test_30() { +test_30a() { # was test_30 + cp `which ls` $DIR || cp /bin/ls $DIR + $DIR/ls / || error + rm $DIR/ls +} +run_test 30a "execute binary from Lustre (execve) ==============" + +test_30b() { cp `which ls` $DIR || cp /bin/ls $DIR - $DIR/ls / + chmod go+rx $DIR/ls + $RUNAS $DIR/ls / || error rm $DIR/ls } -run_test 30 "run binary from Lustre (execve) ===================" +run_test 30b "execute binary from Lustre as non-root ===========" + +test_30c() { # b=22376 + cp `which ls` $DIR || cp /bin/ls $DIR + chmod a-rw $DIR/ls + cancel_lru_locks mdc + cancel_lru_locks osc + $RUNAS $DIR/ls / || error + rm -f $DIR/ls +} +run_test 30c "execute binary from Lustre without read perms ====" test_31a() { $OPENUNLINK $DIR/f31 $DIR/f31 || error @@ -2055,15 +2071,26 @@ run_test 36f "utime on file racing with OST BRW write ==========" test_36g() { remote_ost_nodsh && skip "remote OST with nodsh" && return + local fmd_max_age + local fmd_before + local fmd_after mkdir -p $DIR/$tdir - export FMD_MAX_AGE=`do_facet ost1 lctl get_param -n obdfilter.*.client_cache_seconds 2> /dev/null | head -n 1` - FMD_BEFORE="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`" + fmd_max_age=$(do_facet ost1 \ + "lctl get_param -n obdfilter.*.client_cache_seconds 2> /dev/null | \ + head -n 1") + + fmd_before=$(do_facet ost1 \ + "awk '/ll_fmd_cache/ {print \\\$2}' /proc/slabinfo") touch $DIR/$tdir/$tfile - sleep $((FMD_MAX_AGE + 12)) - FMD_AFTER="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`" - [ "$FMD_AFTER" -gt "$FMD_BEFORE" ] && \ - echo "AFTER : $FMD_AFTER > BEFORE $FMD_BEFORE" && \ + sleep $((fmd_max_age + 12)) + fmd_after=$(do_facet ost1 \ + "awk '/ll_fmd_cache/ {print \\\$2}' /proc/slabinfo") + + echo "fmd_before: $fmd_before" + echo "fmd_after: $fmd_after" + [ "$fmd_after" -gt "$fmd_before" ] && \ + echo "AFTER: $fmd_after > BEFORE: $fmd_before" && \ error "fmd didn't expire after ping" || true } run_test 36g "filter mod data cache expiry =====================" @@ -2213,7 +2240,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 ] || \ @@ -2251,7 +2278,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" ] || \ @@ -2346,7 +2373,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` @@ -2409,6 +2436,26 @@ test_39l() { } run_test 39l "directory atime update ===========================" +test_39m() { + touch $DIR1/$tfile + sleep 2 + local far_past_mtime=$(date -d "May 29 1953" +%s) + local far_past_atime=$(date -d "Dec 17 1903" +%s) + + touch -m -d @$far_past_mtime $DIR1/$tfile + touch -a -d @$far_past_atime $DIR1/$tfile + + for (( i=0; i < 2; i++ )) ; do + local timestamps=$(stat -c "%X %Y" $DIR1/$tfile) + [ "$timestamps" = "$far_past_atime $far_past_mtime" ] || \ + error "atime or mtime set incorrectly" + + 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" + test_40() { dd if=/dev/zero of=$DIR/f40 bs=4096 count=1 $RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/f40 && error @@ -3150,7 +3197,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 @@ -3402,7 +3449,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 ] || \ @@ -3470,7 +3517,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 @@ -3484,7 +3532,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 @@ -3814,7 +3863,7 @@ cleanup_68() { if [ ! -z "$LLITELOOPLOAD" ]; then rmmod llite_lloop unset LLITELOOPLOAD - fi + fi rm -f $DIR/f68* } @@ -3924,7 +3973,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 @@ -3947,7 +3996,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() { @@ -5025,6 +5102,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" @@ -6758,14 +6843,9 @@ test_154() { } run_test 154 "Opening a file by FID" -test_155_load() { +test_155_small_load() { local temp=$TMP/$tfile local file=$DIR/$tfile - local list=$(comma_list $(osts_nodes)) - local big=$(do_nodes $list grep "cache" /proc/cpuinfo | \ - awk '{sum+=$4} END{print sum}') - - log big is $big K dd if=/dev/urandom of=$temp bs=6096 count=1 || \ error "dd of=$temp bs=6096 count=1 failed" @@ -6785,44 +6865,94 @@ test_155_load() { echo "12345" >>$file cmp $temp $file || error "$temp $file differ (append2)" - dd if=/dev/urandom of=$temp bs=$((big*2)) count=1k || \ - error "dd of=$temp bs=$((big*2)) count=1k failed" + rm -f $temp $file + true +} + +test_155_big_load() { + local temp=$TMP/$tfile + local file=$DIR/$tfile + + free_min_max + local cache_size=$(do_facet ost$((MAXI+1)) \ + "awk '/cache/ {sum+=\\\$4} END {print sum}' /proc/cpuinfo") + local large_file_size=$((cache_size * 2)) + + echo "OSS cache size: $cache_size KB" + echo "Large file size: $large_file_size KB" + + [ $MAXV -le $large_file_size ] && \ + skip_env "max available OST size needs > $large_file_size KB" && \ + return 0 + + $SETSTRIPE $file -c 1 -i $MAXI || error "$SETSTRIPE $file failed" + + dd if=/dev/urandom of=$temp bs=$large_file_size count=1k || \ + error "dd of=$temp bs=$large_file_size count=1k failed" cp $temp $file ls -lh $temp $file cancel_lru_locks osc cmp $temp $file || error "$temp $file differ" - rm -f $temp + rm -f $temp $file true } test_155a() { set_cache read on set_cache writethrough on - test_155_load + test_155_small_load } -run_test 155a "Verification of correctness: read cache:on write_cache:on" +run_test 155a "Verify small file correctness: read cache:on write_cache:on" test_155b() { set_cache read on set_cache writethrough off - test_155_load + test_155_small_load } -run_test 155b "Verification of correctness: read cache:on write_cache:off" +run_test 155b "Verify small file correctness: read cache:on write_cache:off" test_155c() { set_cache read off set_cache writethrough on - test_155_load + test_155_small_load } -run_test 155c "Verification of correctness: read cache:off write_cache:on" +run_test 155c "Verify small file correctness: read cache:off write_cache:on" test_155d() { set_cache read off set_cache writethrough off - test_155_load + test_155_small_load +} +run_test 155d "Verify small file correctness: read cache:off write_cache:off" + +test_155e() { + set_cache read on + set_cache writethrough on + test_155_big_load +} +run_test 155e "Verify big file correctness: read cache:on write_cache:on" + +test_155f() { + set_cache read on + set_cache writethrough off + test_155_big_load } -run_test 155d "Verification of correctness: read cache:off write_cache:off " +run_test 155f "Verify big file correctness: read cache:on write_cache:off" + +test_155g() { + set_cache read off + set_cache writethrough on + test_155_big_load +} +run_test 155g "Verify big file correctness: read cache:off write_cache:on" + +test_155h() { + set_cache read off + set_cache writethrough off + test_155_big_load +} +run_test 155h "Verify big file correctness: read cache:off write_cache:off" test_156() { local CPAGES=3 @@ -7216,7 +7346,9 @@ test_170() { local expected_good=$((good_line1 + good_line2*2)) rm -f $TMP/${tfile}* - if [ $bad_line -ne $bad_line_new ]; then + # LU-231, short malformed line may not be counted into bad lines + if [ $bad_line -ne $bad_line_new ] && + [ $bad_line -ne $((bad_line_new - 1)) ]; then error "expected $bad_line bad lines, but got $bad_line_new" return 1 fi @@ -7233,9 +7365,12 @@ test_171() { # bug20592 #define OBD_FAIL_PTLRPC_DUMP_LOG 0x50e $LCTL set_param fail_loc=0x50e $LCTL set_param fail_val=3000 - multiop_bg_pause $DIR/$tfile Os || true + multiop_bg_pause $DIR/$tfile O_s || true + local MULTIPID=$! + kill -USR1 $MULTIPID # cause log dump sleep 3 + wait $MULTIPID if dmesg | grep "recursive fault"; then error "caught a recursive fault" fi @@ -7250,6 +7385,9 @@ setup_obdecho_osc () { local ost_nid=$1 local obdfilter_name=$2 echo "Creating new osc for $obdfilter_name on $ost_nid" + # make sure we can find loopback nid + $LCTL add_uuid $ost_nid $ost_nid >/dev/null 2>&1 + [ $rc -eq 0 ] && { $LCTL attach osc ${obdfilter_name}_osc \ ${obdfilter_name}_osc_UUID || rc=2; } [ $rc -eq 0 ] && { $LCTL --device ${obdfilter_name}_osc setup \ @@ -7292,15 +7430,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 @@ -7323,6 +7461,25 @@ test_180b() { } run_test 180b "test obdecho directly on obdfilter" +test_181() { # bug 22177 + mkdir -p $DIR/$tdir || error "creating dir $DIR/$tdir" + # create enough files to index the directory + createmany -o $DIR/$tdir/foobar 4000 + # print attributes for debug purpose + lsattr -d . + # open dir + multiop_bg_pause $DIR/$tdir D_Sc || return 1 + MULTIPID=$! + # remove the files & current working dir + unlinkmany $DIR/$tdir/foobar 4000 + rmdir $DIR/$tdir + kill -USR1 $MULTIPID + wait $MULTIPID + stat $DIR/$tdir && error "open-unlinked dir was not removed!" + return 0 +} +run_test 181 "Test open-unlinked dir ========================" + # OST pools tests POOL=${POOL:-cea1} TGT_COUNT=$OSTCOUNT @@ -7488,8 +7645,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 @@ -7753,12 +7910,9 @@ test_900() { } run_test 900 "umount should not race with any mgc requeue thread" -log "cleanup: ======================================================" +complete $(basename $0) $SECONDS check_and_cleanup_lustre if [ "$I_MOUNTED" != "yes" ]; then lctl set_param debug="$OLDDEBUG" 2> /dev/null || true fi - -echo '=========================== finished ===============================' -[ -f "$SANITYLOG" ] && cat $SANITYLOG && grep -q FAIL $SANITYLOG && exit 1 || true -echo "$0: completed" +exit_status