X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fsanity.sh;h=2282370ec999972b35629844918e860a83cf565a;hb=57841b254cd4f80c0c1a85f6c3116e48b13e9db0;hp=d7e5f3f09d494e0896ab064dce9cdac4e8bb569b;hpb=fd3dcf04aa169560986a15880d0ced9b07adaad4;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index d7e5f3f..2282370 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1119,6 +1119,11 @@ test_24z() { mrename $remote_src $remote_tgt && error "rename remote dirs should not work!" + # If target dir does not exists, it should succeed + rm -rf $remote_tgt + mrename $remote_src $remote_tgt || + error "rename remote dirs(tgt dir does not exists) failed!" + rm -rf $DIR/$tdir || error "Can not delete directories" } run_test 24z "rename one remote dir to another remote dir should fail" @@ -1494,22 +1499,24 @@ test_27t() { # bug 10864 run_test 27t "check that utils parse path correctly" test_27u() { # bug 4900 - [ "$OSTCOUNT" -lt "2" ] && skip_env "too few OSTs" && return - remote_mds_nodsh && skip "remote MDS with nodsh" && return + [ "$OSTCOUNT" -lt "2" ] && skip_env "too few OSTs" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + local index + local list=$(comma_list $(mdts_nodes)) #define OBD_FAIL_MDS_OSC_PRECREATE 0x139 - do_facet $SINGLEMDS lctl set_param fail_loc=0x139 - test_mkdir -p $DIR/$tdir + do_nodes $list $LCTL set_param fail_loc=0x139 + test_mkdir -p $DIR/$tdir rm -rf $DIR/$tdir/* - createmany -o $DIR/$tdir/t- 1000 - do_facet $SINGLEMDS lctl set_param fail_loc=0 + createmany -o $DIR/$tdir/t- 1000 + do_nodes $list $LCTL set_param fail_loc=0 - TLOG=$DIR/$tfile.getstripe - $GETSTRIPE $DIR/$tdir > $TLOG - OBJS=`awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj;}' $TLOG` - unlinkmany $DIR/$tdir/t- 1000 - [ $OBJS -gt 0 ] && \ - error "$OBJS objects created on OST-0. See $TLOG" || pass + TLOG=$DIR/$tfile.getstripe + $GETSTRIPE $DIR/$tdir > $TLOG + OBJS=`awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj;}' $TLOG` + unlinkmany $DIR/$tdir/t- 1000 + [ $OBJS -gt 0 ] && \ + error "$OBJS objects created on OST-0. See $TLOG" || pass } run_test 27u "skip object creation on OSC w/o objects ==========" @@ -3771,7 +3778,8 @@ test_53() { ostnum=$(index_from_ostuuid ${ostname}_UUID) node=$(facet_active_host ost$((ostnum+1))) param="obdfilter.$ostname.last_id" - ost_last=$(do_node $node lctl get_param -n $param | head -n 1) + ost_last=$(do_node $node lctl get_param -n $param | head -n 1 | + awk -F':' '{print $2}') echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" if [ $ost_last != $mds_last ]; then error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" @@ -4294,11 +4302,13 @@ test_56u() { # LU-611 [ $NUMS -eq $EXPECTED ] || error "\"$CMD\" wrong: found $NUMS, expected $EXPECTED" - EXPECTED=$(((NUMDIRS + 1) * NUMFILES + ONESTRIPE)) - CMD="$LFIND -stripe-index 0,1 -type f $TDIR" - NUMS=$($CMD | wc -l) - [ $NUMS -eq $EXPECTED ] || - error "\"$CMD\" wrong: found $NUMS, expected $EXPECTED" + if [ $OSTCOUNT -gt 1 ]; then + EXPECTED=$(((NUMDIRS + 1) * NUMFILES + ONESTRIPE)) + CMD="$LFIND -stripe-index 0,1 -type f $TDIR" + NUMS=$($CMD | wc -l) + [ $NUMS -eq $EXPECTED ] || + error "\"$CMD\" wrong: found $NUMS, expected $EXPECTED" + fi } run_test 56u "check lfs find -stripe-index works" @@ -6201,7 +6211,7 @@ test_102k() { local default_size=`$GETSTRIPE -S $test_kdir` local default_count=`$GETSTRIPE -c $test_kdir` local default_offset=`$GETSTRIPE -i $test_kdir` - $SETSTRIPE -S 65536 -i 1 -c $OSTCOUNT $test_kdir || + $SETSTRIPE -S 65536 -i 0 -c $OSTCOUNT $test_kdir || error 'dir setstripe failed' setfattr -n trusted.lov $test_kdir local stripe_size=`$GETSTRIPE -S $test_kdir` @@ -8281,20 +8291,20 @@ get_rename_size() { test_133d() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - remote_ost_nodsh && skip "remote OST with nodsh" && return - remote_mds_nodsh && skip "remote MDS with nodsh" && return - do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats || - { skip "MDS doesn't support rename stats"; return; } + remote_ost_nodsh && skip "remote OST with nodsh" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + do_facet $SINGLEMDS $LCTL list_param mdt.*.rename_stats || + { skip "MDS doesn't support rename stats"; return; } - local testdir1=$DIR/${tdir}/stats_testdir1 - local testdir2=$DIR/${tdir}/stats_testdir2 + local testdir1=$DIR/${tdir}/stats_testdir1 + local testdir2=$DIR/${tdir}/stats_testdir2 - do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear + do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear - test_mkdir -p ${testdir1} || error "mkdir failed" - test_mkdir -p ${testdir2} || error "mkdir failed" + mkdir -p ${testdir1} || error "mkdir failed" + mkdir -p ${testdir2} || error "mkdir failed" - createmany -o $testdir1/test 512 || error "createmany failed" + createmany -o $testdir1/test 512 || error "createmany failed" # check samedir rename size mv ${testdir1}/test0 ${testdir1}/test_0 @@ -8313,18 +8323,18 @@ test_133d() { echo "source rename dir size: ${testdir1_size}" echo "target rename dir size: ${testdir2_size}" - local cmd="do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats" - eval $cmd || error "$cmd failed" - local samedir=$($cmd | grep 'same_dir') - local same_sample=$(get_rename_size $testdir1_size) - [ -z "$samedir" ] && error "samedir_rename_size count error" - [ "$same_sample" -eq 1 ] || error "samedir_rename_size error $same_sample" - echo "Check same dir rename stats success" + local cmd="do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats" + eval $cmd || error "$cmd failed" + local samedir=$($cmd | grep 'same_dir') + local same_sample=$(get_rename_size $testdir1_size) + [ -z "$samedir" ] && error "samedir_rename_size count error" + [ "$same_sample" -eq 1 ] || error "samedir_rename_size error $same_sample" + echo "Check same dir rename stats success" - do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear + do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear - # check crossdir rename size - mv ${testdir1}/test_0 ${testdir2}/test_0 + # check crossdir rename size + mv ${testdir1}/test_0 ${testdir2}/test_0 testdir1_size=$(ls -l $DIR/${tdir} | awk '/stats_testdir1/ {print $5}') @@ -8340,15 +8350,15 @@ test_133d() { echo "source rename dir size: ${testdir1_size}" echo "target rename dir size: ${testdir2_size}" - eval $cmd || error "$cmd failed" - local crossdir=$($cmd | grep 'crossdir') - local src_sample=$(get_rename_size $testdir1_size crossdir_src) - local tgt_sample=$(get_rename_size $testdir2_size crossdir_tgt) - [ -z "$crossdir" ] && error "crossdir_rename_size count error" - [ "$src_sample" -eq 1 ] || error "crossdir_rename_size error $src_sample" - [ "$tgt_sample" -eq 1 ] || error "crossdir_rename_size error $tgt_sample" - echo "Check cross dir rename stats success" - rm -rf $DIR/${tdir} + eval $cmd || error "$cmd failed" + local crossdir=$($cmd | grep 'crossdir') + local src_sample=$(get_rename_size $testdir1_size crossdir_src) + local tgt_sample=$(get_rename_size $testdir2_size crossdir_tgt) + [ -z "$crossdir" ] && error "crossdir_rename_size count error" + [ "$src_sample" -eq 1 ] || error "crossdir_rename_size error $src_sample" + [ "$tgt_sample" -eq 1 ] || error "crossdir_rename_size error $tgt_sample" + echo "Check cross dir rename stats success" + rm -rf $DIR/${tdir} } run_test 133d "Verifying rename_stats ========================================" @@ -8678,16 +8688,13 @@ dot_lustre_fid_permission_check() { error "touch $MOUNT/.lustre/fid/$tfile should fail." echo "setxattr to $MOUNT/.lustre/fid" - setfattr -n trusted.name1 -v value1 $MOUNT/.lustre/fid && - error "setxattr should fail." + setfattr -n trusted.name1 -v value1 $MOUNT/.lustre/fid echo "listxattr for $MOUNT/.lustre/fid" - getfattr -d -m "^trusted" $MOUNT/.lustre/fid && - error "listxattr should fail." + getfattr -d -m "^trusted" $MOUNT/.lustre/fid echo "delxattr from $MOUNT/.lustre/fid" - setfattr -x trusted.name1 $MOUNT/.lustre/fid && - error "delxattr should fail." + setfattr -x trusted.name1 $MOUNT/.lustre/fid echo "touch invalid fid: $MOUNT/.lustre/fid/[0x200000400:0x2:0x3]" touch $MOUNT/.lustre/fid/[0x200000400:0x2:0x3] && @@ -8706,6 +8713,21 @@ dot_lustre_fid_permission_check() { mrename $MOUNT/.lustre $MOUNT/.lustre/fid/$fid/.lustre && error "rename .lustre to itself should fail." + local old_obf_mode=$(stat --format="%a" $DIR/.lustre/fid) + local new_obf_mode=777 + + echo "change mode of $DIR/.lustre/fid to $new_obf_mode" + chmod $new_obf_mode $DIR/.lustre/fid || + error "chmod $new_obf_mode $DIR/.lustre/fid failed" + + local obf_mode=$(stat --format=%a $DIR/.lustre/fid) + [ $obf_mode -eq $new_obf_mode ] || + error "stat $DIR/.lustre/fid returned wrong mode $obf_mode" + + echo "restore mode of $DIR/.lustre/fid to $old_obf_mode" + chmod $old_obf_mode $DIR/.lustre/fid || + error "chmod $old_obf_mode $DIR/.lustre/fid failed" + $OPENFILE -f O_LOV_DELAY_CREATE:O_CREAT $test_dir/$tfile-2 fid=$($LFS path2fid $test_dir/$tfile-2) echo "cp /etc/passwd $MOUNT/.lustre/fid/$fid" @@ -8737,7 +8759,6 @@ test_154a() { error "dot lustre permission check $fid failed" rm -rf $MOUNT/.lustre && error ".lustre is not allowed to be unlinked" - chmod 777 $MOUNT/.lustre && error ".lustre is not allowed to be chmod" touch $MOUNT/.lustre/file && error "creation is not allowed under .lustre" @@ -10655,9 +10676,13 @@ run_test 224b "Don't panic on bulk IO failure" MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)} test_225a () { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - if [ -z ${MDSSURVEY} ]; then - skip_env "mds-survey not found" && return - fi + if [ -z ${MDSSURVEY} ]; then + skip_env "mds-survey not found" && return + fi + + [ $MDSCOUNT -ge 2 ] && + skip "skipping now for more than one MDT" && return + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] || { skip "Need MDS version at least 2.2.51"; return; } @@ -10680,16 +10705,19 @@ run_test 225a "Metadata survey sanity with zero-stripe" test_225b () { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - if [ -z ${MDSSURVEY} ]; then - skip_env "mds-survey not found" && return - fi - [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] || - { skip "Need MDS version at least 2.2.51"; return; } - if [ $($LCTL dl | grep -c osc) -eq 0 ]; then - skip_env "Need to mount OST to test" && return - fi + if [ -z ${MDSSURVEY} ]; then + skip_env "mds-survey not found" && return + fi + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ] || + { skip "Need MDS version at least 2.2.51"; return; } + + if [ $($LCTL dl | grep -c osc) -eq 0 ]; then + skip_env "Need to mount OST to test" && return + fi + [ $MDSCOUNT -ge 2 ] && + skip "skipping now for more than one MDT" && return local mds=$(facet_host $SINGLEMDS) local target=$(do_nodes $mds 'lctl dl' | \ awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}")