X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fsanity.sh;h=deec912f7cc88060abe0bff5c6716187d721154d;hp=6b308d09e5e7adb92f0285d748edd1347bc43ad6;hb=c7e86172425f203ce122ff18bc6434f843374b4b;hpb=785e7dc56613e79bdfd89fab762eeb82deb7564c diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 6b308d0..deec912 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -2561,9 +2561,9 @@ test_33b() { rm -fr $DIR/d33 test_mkdir -p $DIR/d33 chown $RUNAS_ID $DIR/d33 - $RUNAS $OPENFILE -f 1286739555 $DIR/d33/f33 && error "create" || true + $RUNAS $OPENFILE -f 1286739555 $DIR/d33/f33 } -run_test 33b "test open file with malformed flags (No panic and return error)" +run_test 33b "test open file with malformed flags (No panic)" test_33c() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return @@ -6840,7 +6840,7 @@ run_acl_subtest() return $? } -test_103 () { +test_103a() { [ "$UID" != 0 ] && skip_env "must run as root" && return [ -z "$(lctl get_param -n mdc.*-mdc-*.connect_flags | grep acl)" ] && skip "must have acl enabled" && return @@ -6901,7 +6901,55 @@ test_103 () { fi done } -run_test 103 "acl test =========================================" +run_test 103a "acl test =========================================" + +test_103b() { + local noacl=false + local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/}) + local mountopts=$MDS_MOUNT_OPTS + + if [[ "$MDS_MOUNT_OPTS" =~ "noacl" ]]; then + noacl=true + else + # stop the MDT + stop $SINGLEMDS || error "failed to stop MDT." + # remount the MDT + if [ -z "$MDS_MOUNT_OPTS" ]; then + MDS_MOUNT_OPTS="-o noacl" + else + MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl" + fi + start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || + error "failed to start MDT." + MDS_MOUNT_OPTS=$mountopts + fi + + touch $DIR/$tfile + setfacl -m u:bin:rw $DIR/$tfile && error "setfacl should fail" + + if ! $noacl; then + # stop the MDT + stop $SINGLEMDS || error "failed to stop MDT." + # remount the MDT + start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || + error "failed to start MDT." + fi + + true +} +run_test 103b "MDS mount option 'noacl'" + +test_103c() { + mkdir -p $DIR/$tdir + cp -rp $DIR/$tdir $DIR/$tdir.bak + + [ -n "$(getfattr -d -m. $DIR/$tdir | grep posix_acl_default)" ] && + error "$DIR/$tdir shouldn't contain default ACL" + [ -n "$(getfattr -d -m. $DIR/$tdir.bak | grep posix_acl_default)" ] && + error "$DIR/$tdir.bak shouldn't contain default ACL" + true +} +run_test 103c "'cp -rp' won't set empty acl" test_104a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return @@ -9281,14 +9329,14 @@ function roc_hit_init() { dd if=/dev/urandom of=$file bs=4k count=4 2>&1 > /dev/null idx=$(printf %04x $i) BEFORE=$(get_osd_param $list *OST*$idx stats | - awk '$1 == "cache_access" {sum += $2} + awk '$1 == "cache_access" {sum += $7} END { printf("%0.0f", sum) }') cancel_lru_locks osc cat $file >/dev/null AFTER=$(get_osd_param $list *OST*$idx stats | - awk '$1 == "cache_access" {sum += $2} + awk '$1 == "cache_access" {sum += $7} END { printf("%0.0f", sum) }') echo BEFORE:$BEFORE AFTER:$AFTER @@ -9305,7 +9353,7 @@ function roc_hit_init() { function roc_hit() { local list=$(comma_list $(osts_nodes)) echo $(get_osd_param $list '' stats | - awk '$1 == "cache_hit" {sum += $2} + awk '$1 == "cache_hit" {sum += $7} END { printf("%0.0f", sum) }') } @@ -9670,6 +9718,17 @@ test_154d() { } run_test 154d "Verify open file fid" +test_154e() +{ + [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.50) ]] && + skip "Need MDS version at least 2.6.50" && return + + if ls -a $MOUNT | grep -q '^\.lustre$'; then + error ".lustre returned by readdir" + fi +} +run_test 154e ".lustre is not returned by readdir" + test_155_small_load() { local temp=$TMP/$tfile local file=$DIR/$tfile @@ -10340,25 +10399,30 @@ test_162() { test_mkdir -p -c1 $DIR/$tdir/d2/p/q/r # regular file FID=$($LFS path2fid $DIR/$tdir/d2/$tfile | tr -d '[]') - check_path "$tdir/d2/$tfile" $FSNAME $FID --link 0 + check_path "$tdir/d2/$tfile" $FSNAME $FID --link 0 || + error "check path $tdir/d2/$tfile failed" # softlink ln -s $DIR/$tdir/d2/$tfile $DIR/$tdir/d2/p/q/r/slink FID=$($LFS path2fid $DIR/$tdir/d2/p/q/r/slink | tr -d '[]') - check_path "$tdir/d2/p/q/r/slink" $FSNAME $FID --link 0 + check_path "$tdir/d2/p/q/r/slink" $FSNAME $FID --link 0 || + error "check path $tdir/d2/p/q/r/slink failed" # softlink to wrong file ln -s /this/is/garbage $DIR/$tdir/d2/p/q/r/slink.wrong FID=$($LFS path2fid $DIR/$tdir/d2/p/q/r/slink.wrong | tr -d '[]') - check_path "$tdir/d2/p/q/r/slink.wrong" $FSNAME $FID --link 0 + check_path "$tdir/d2/p/q/r/slink.wrong" $FSNAME $FID --link 0 || + error "check path $tdir/d2/p/q/r/slink.wrong failed" # hardlink ln $DIR/$tdir/d2/$tfile $DIR/$tdir/d2/p/q/r/hlink mv $DIR/$tdir/d2/$tfile $DIR/$tdir/d2/a/b/c/new_file FID=$($LFS path2fid $DIR/$tdir/d2/a/b/c/new_file | tr -d '[]') # fid2path dir/fsname should both work - check_path "$tdir/d2/a/b/c/new_file" $FSNAME $FID --link 1 - check_path "$DIR/$tdir/d2/p/q/r/hlink" $DIR $FID --link 0 + check_path "$tdir/d2/a/b/c/new_file" $FSNAME $FID --link 1 || + error "check path $tdir/d2/a/b/c/new_file failed" + check_path "$DIR/$tdir/d2/p/q/r/hlink" $DIR $FID --link 0 || + error "check path $DIR/$tdir/d2/p/q/r/hlink failed" # hardlink count: check that there are 2 links # Doesnt work with CMD yet: 17935 @@ -10367,7 +10431,8 @@ test_162() { # hardlink indexing: remove the first link rm $DIR/$tdir/d2/p/q/r/hlink - check_path "$tdir/d2/a/b/c/new_file" $FSNAME $FID --link 0 + check_path "$tdir/d2/a/b/c/new_file" $FSNAME $FID --link 0 || + error "check path $DIR/$tdir/d2/a/b/c/new_file failed" return 0 } @@ -10392,11 +10457,13 @@ test_162b() { for ((i=0;i<5;i++)); do FID=$($LFS path2fid $DIR/$tdir/striped_dir/f$i | tr -d '[]') || error "get fid for f$i failed" - check_path "$tdir/striped_dir/f$i" $FSNAME $FID --link 0 + check_path "$tdir/striped_dir/f$i" $FSNAME $FID --link 0 || + error "check path $tdir/striped_dir/f$i failed" FID=$($LFS path2fid $DIR/$tdir/striped_dir/d$i | tr -d '[]') || error "get fid for d$i failed" - check_path "$tdir/striped_dir/d$i" $FSNAME $FID --link 0 + check_path "$tdir/striped_dir/d$i" $FSNAME $FID --link 0 || + error "check path $tdir/striped_dir/d$i failed" done return 0 @@ -10493,7 +10560,7 @@ test_171() { # bug20592 } run_test 171 "test libcfs_debug_dumplog_thread stuck in do_exit() ======" -# it would be good to share it with obdfilter-survey/libecho code +# it would be good to share it with obdfilter-survey/iokit-libecho code setup_obdecho_osc () { local rc=0 local ost_nid=$1 @@ -12665,7 +12732,8 @@ run_test 236 "Layout swap on open unlinked file" # The new system calls are supported in glibc >= 2.14. test_237() { - echo "Test file_handle syscalls" > $DIR/$tfile + echo "Test file_handle syscalls" > $DIR/$tfile || + error "write failed" check_fhandle_syscalls $DIR/$tfile || error "check_fhandle_syscalls failed" } @@ -12708,6 +12776,26 @@ test_239() { } run_test 239 "osp_sync test" +test_240() { + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + + mkdir -p $DIR/$tdir + + $LFS mkdir -i 0 $DIR/$tdir/d0 || + error "failed to mkdir $DIR/$tdir/d0 on MDT0" + $LFS mkdir -i 1 $DIR/$tdir/d0/d1 || + error "failed to mkdir $DIR/$tdir/d0/d1 on MDT1" + + umount_client $MOUNT || error "umount failed" + #define OBD_FAIL_TGT_DELAY_CONDITIONAL 0x713 + do_facet mds2 lctl set_param fail_loc=0x713 fail_val=1 + mount_client $MOUNT || error "failed to mount client" + + echo "stat $DIR/$tdir/d0/d1, should not fail/ASSERT" + stat $DIR/$tdir/d0/d1 || error "fail to stat $DIR/$tdir/d0/d1" +} +run_test 240 "race between ldlm enqueue and the connection RPC (no ASSERT)" + cleanup_test_300() { trap 0 umask $SAVE_UMASK @@ -13001,6 +13089,46 @@ test_300g() { } run_test 300g "check default striped directory for striped directory" +test_300h() { + [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + local stripe_count + local file + + mkdir $DIR/$tdir + + $LFS setdirstripe -i 0 -c$MDSCOUNT -t all_char $DIR/$tdir/striped_dir || + error "set striped dir error" + + createmany -o $DIR/$tdir/striped_dir/f- 10 || + error "create files under striped dir failed" + + # unfortunately, we need to umount to clear dir layout cache for now + # once we fully implement dir layout, we can drop this + umount_client $MOUNT || error "umount failed" + mount_client $MOUNT || error "mount failed" + + #set the stripe to be unknown hash type + #define OBD_FAIL_UNKNOWN_LMV_STRIPE 0x1901 + $LCTL set_param fail_loc=0x1901 + for ((i = 0; i < 10; i++)); do + $CHECKSTAT -t file $DIR/$tdir/striped_dir/f-$i || + error "stat f-$i failed" + rm $DIR/$tdir/striped_dir/f-$i || error "unlink f-$i failed" + done + + touch $DIR/$tdir/striped_dir/f0 && + error "create under striped dir with unknown hash should fail" + + $LCTL set_param fail_loc=0 + + umount_client $MOUNT || error "umount failed" + mount_client $MOUNT || error "mount failed" + + return 0 +} +run_test 300h "client handle unknown hash type striped directory" + test_400a() { # LU-1606, was conf-sanity test_74 local extra_flags='' local out=$TMP/$tfile