X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fsanity.sh;h=306157fd2d45b7ec67a46eaa5241ac98c27bb49b;hb=ca843b37b63752e350505c7ca076d5014a7da25b;hp=f046122f6d42d244d98eefe0c244f9334449e257;hpb=6c74e4d72fe4f37a1487de24214a3ca75e57080c;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f046122..306157f 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -788,7 +788,7 @@ run_test 24c "rename directory to non-existent target" test_24d() { test_mkdir $DIR/$tdir test_mkdir $DIR/$tdir/d$testnum.1 - test_mkdir $DIR/$tdir/d$ttestnum.2 + test_mkdir $DIR/$tdir/d$testnum.2 mrename $DIR/$tdir/d$testnum.1 $DIR/$tdir/d$testnum.2 $CHECKSTAT -a $DIR/$tdir/d$testnum.1 || error "d$testnum.1 exists" $CHECKSTAT -t dir $DIR/$tdir/d$testnum.2 || error "d$testnum.2 not dir" @@ -990,7 +990,7 @@ max_pages_per_rpc() { test_24v() { local NRFILES=100000 - local FREE_INODES=$(lfs_df -i | grep "summary" | awk '{print $4}') + local FREE_INODES=$(mdt_free_inodes 0) [ $FREE_INODES -lt $NRFILES ] && \ skip "not enough free inodes $FREE_INODES required $NRFILES" && return @@ -998,6 +998,9 @@ test_24v() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return trap simple_cleanup_common EXIT + # Performance issue on ZFS see LU-4072 (c.f. LU-2887) + [ $(facet_fstype $SINGLEMDS) = "zfs" ] && NRFILES=10000 + mkdir -p $DIR/$tdir createmany -m $DIR/$tdir/$tfile $NRFILES @@ -1050,6 +1053,9 @@ test_24x() { mkdir -p $remote_dir/tgt_dir touch $remote_dir/tgt_file + mrename $remote_dir $DIR/ && + error "rename dir cross MDT works!" + mrename $DIR/$tdir/src_dir $remote_dir/tgt_dir && error "rename dir cross MDT works!" @@ -1120,6 +1126,7 @@ run_test 24z "rename one remote dir to another remote dir should fail" test_24A() { # LU-3182 local NFILES=5000 + rm -rf $DIR/$tdir mkdir -p $DIR/$tdir createmany -m $DIR/$tdir/$tfile $NFILES local t=`ls $DIR/$tdir | wc -l` @@ -1277,10 +1284,10 @@ test_27k() { # bug 2844 [ ! -d $DIR/d27 ] && test_mkdir -p $DIR d27 $SETSTRIPE -S 67108864 $FILE || error "setstripe failed" BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'` - [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE" + [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "1:$BLKSIZE > $LL_MAX_BLKSIZE" dd if=/dev/zero of=$FILE bs=4k count=1 BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'` - [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE" + [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "2:$BLKSIZE > $LL_MAX_BLKSIZE" } run_test 27k "limit i_blksize for broken user apps =============" @@ -1355,9 +1362,9 @@ exhaust_precreations() { # on the mdt's osc local mdtosc_proc1=$(get_mdtosc_proc_path mds${MDSIDX} $OST) local last_id=$(do_facet mds${MDSIDX} lctl get_param -n \ - osc.$mdtosc_proc1.prealloc_last_id) + osc.$mdtosc_proc1.prealloc_last_id) local next_id=$(do_facet mds${MDSIDX} lctl get_param -n \ - osc.$mdtosc_proc1.prealloc_next_id) + osc.$mdtosc_proc1.prealloc_next_id) local mdtosc_proc2=$(get_mdtosc_proc_path mds${MDSIDX}) do_facet mds${MDSIDX} lctl get_param osc.$mdtosc_proc2.prealloc* @@ -1711,26 +1718,7 @@ check_seq_oid() local dev=$(ostdevname $ost) local oid_hex - if [ $(facet_fstype ost$ost) != ldiskfs ]; then - echo "Currently only works with ldiskfs-based OSTs" - continue - fi - - log "want: stripe:$stripe_nr ost:$obdidx oid:$oid/$hex seq:$seq" - - #don't unmount/remount the OSTs if we don't need to do that - # LU-2577 changes filter_fid to be smaller, so debugfs needs - # update too, until that use mount/ll_decode_filter_fid/mount - local dir=$(facet_mntpt ost$ost) - local opts=${OST_MOUNT_OPTS} - - if ! do_facet ost$ost test -b ${dev}; then - opts=$(csa_add "$opts" -o loop) - fi - - stop ost$ost - do_facet ost$ost mount -t $(facet_fstype ost$ost) $opts $dev $dir || - { error "mounting $dev as $FSTYPE failed"; return 3; } + log "want: stripe:$stripe_nr ost:$obdidx oid:$oid/$hex seq:$seq" seq=$(echo $seq | sed -e "s/^0x//g") if [ $seq == 0 ]; then @@ -1738,25 +1726,48 @@ check_seq_oid() else oid_hex=$(echo $hex | sed -e "s/^0x//g") fi - local obj_file=$(do_facet ost$ost find $dir/O/$seq -name $oid_hex) - local ff=$(do_facet ost$ost $LL_DECODE_FILTER_FID $obj_file) - do_facet ost$ost umount -d $dir - start ost$ost $dev $OST_MOUNT_OPTS + local obj_file="O/$seq/d$((oid %32))/$oid_hex" - # re-enable when debugfs will understand new filter_fid - #local ff=$(do_facet ost$ost "$DEBUGFS -c -R 'stat $obj_file' \ - # $dev 2>/dev/null" | grep "parent=") + local ff + # + # Don't unmount/remount the OSTs if we don't need to do that. + # LU-2577 changes filter_fid to be smaller, so debugfs needs + # update too, until that use mount/ll_decode_filter_fid/mount. + # Re-enable when debugfs will understand new filter_fid. + # + if false && [ $(facet_fstype ost$ost) == ldiskfs ]; then + ff=$(do_facet ost$ost "$DEBUGFS -c -R 'stat $obj_file' \ + $dev 2>/dev/null" | grep "parent=") + else + stop ost$ost + mount_fstype ost$ost + ff=$(do_facet ost$ost $LL_DECODE_FILTER_FID \ + $(facet_mntpt ost$ost)/$obj_file) + unmount_fstype ost$ost + start ost$ost $dev $OST_MOUNT_OPTS + fi - [ -z "$ff" ] && error "$obj_file: no filter_fid info" + [ -z "$ff" ] && error "$obj_file: no filter_fid info" - echo "$ff" | sed -e 's#.*objid=#got: objid=#' + echo "$ff" | sed -e 's#.*objid=#got: objid=#' - # /mnt/O/0/d23/23: objid=23 seq=0 parent=[0x200000400:0x1e:0x1] - # fid: objid=23 seq=0 parent=[0x200000400:0x1e:0x0] stripe=1 - local ff_parent=$(echo $ff|sed -e 's/.*parent=.//') - local ff_pseq=$(echo $ff_parent | cut -d: -f1) - local ff_poid=$(echo $ff_parent | cut -d: -f2) - local ff_pstripe=$(echo $ff_parent | sed -e 's/.*stripe=//') + # /mnt/O/0/d23/23: objid=23 seq=0 parent=[0x200000400:0x1e:0x1] + # fid: objid=23 seq=0 parent=[0x200000400:0x1e:0x0] stripe=1 + local ff_parent=$(echo $ff|sed -e 's/.*parent=.//') + local ff_pseq=$(echo $ff_parent | cut -d: -f1) + local ff_poid=$(echo $ff_parent | cut -d: -f2) + local ff_pstripe + if echo $ff_parent | grep -q 'stripe='; then + ff_pstripe=$(echo $ff_parent | sed -e 's/.*stripe=//') + else + # + # $LL_DECODE_FILTER_FID does not print "stripe="; look + # into f_ver in this case. See the comment on + # ff_parent. + # + ff_pstripe=$(echo $ff_parent | cut -d: -f3 | + sed -e 's/\]//') + fi # compare lmm_seq and filter_fid->ff_parent.f_seq [ $ff_pseq = $lmm_seq ] || @@ -1764,7 +1775,7 @@ check_seq_oid() # compare lmm_object_id and filter_fid->ff_parent.f_oid [ $ff_poid = $lmm_oid ] || error "FF parent OID $ff_poid != $lmm_oid" - [ $ff_pstripe = $stripe_nr ] || + (($ff_pstripe == $stripe_nr)) || error "FF stripe $ff_pstripe != $stripe_nr" stripe_nr=$((stripe_nr + 1)) @@ -1802,13 +1813,13 @@ test_27A() { # b=19102 local restore_count=$($GETSTRIPE -c $MOUNT) local restore_offset=$($GETSTRIPE -i $MOUNT) $SETSTRIPE -c 0 -i -1 -S 0 $MOUNT + wait_update $HOSTNAME "$GETSTRIPE -c $MOUNT | sed 's/ *//g'" "1" 20 || + error "stripe count $($GETSTRIPE -c $MOUNT) != 1" local default_size=$($GETSTRIPE -S $MOUNT) - local default_count=$($GETSTRIPE -c $MOUNT) local default_offset=$($GETSTRIPE -i $MOUNT) local dsize=$((1024 * 1024)) [ $default_size -eq $dsize ] || error "stripe size $default_size != $dsize" - [ $default_count -eq 1 ] || error "stripe count $default_count != 1" [ $default_offset -eq -1 ] ||error "stripe offset $default_offset != -1" $SETSTRIPE -c $restore_count -i $restore_offset -S $restore_size $MOUNT } @@ -2113,14 +2124,17 @@ test_31n() { touch $DIR/$tfile || error "cannot create '$DIR/$tfile'" nlink=$(stat --format=%h $DIR/$tfile) [ ${nlink:--1} -eq 1 ] || error "nlink is $nlink, expected 1" - exec 173<$DIR/$tfile - trap "exec 173<&-" EXIT - nlink=$(stat --dereference --format=%h /proc/self/fd/173) + local fd=$(free_fd) + local cmd="exec $fd<$DIR/$tfile" + eval $cmd + cmd="exec $fd<&-" + trap "eval $cmd" EXIT + nlink=$(stat --dereference --format=%h /proc/self/fd/$fd) [ ${nlink:--1} -eq 1 ] || error "nlink is $nlink, expected 1" rm $DIR/$tfile || error "cannot remove '$DIR/$tfile'" - nlink=$(stat --dereference --format=%h /proc/self/fd/173) + nlink=$(stat --dereference --format=%h /proc/self/fd/$fd) [ ${nlink:--1} -eq 0 ] || error "nlink is $nlink, expected 0" - exec 173<&- + eval $cmd } run_test 31n "check link count of unlinked file" @@ -2149,7 +2163,7 @@ run_test 31o "duplicate hard links with same filename" cleanup_test32_mount() { trap 0 - $UMOUNT $DIR/$tdir/ext2-mountpoint + $UMOUNT -d $DIR/$tdir/ext2-mountpoint } test_32a() { @@ -2357,7 +2371,7 @@ run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/$tfile" cleanup_testdir_mount() { trap 0 - $UMOUNT $DIR/$tdir + $UMOUNT -d $DIR/$tdir } test_32q() { @@ -3124,6 +3138,50 @@ test_39n() { # LU-3832 } run_test 39n "check that O_NOATIME is honored" +test_39o() { + TESTDIR=$DIR/$tdir/$tfile + [ -e $TESTDIR ] && rm -rf $TESTDIR + test_mkdir -p $TESTDIR + cd $TESTDIR + links1=2 + ls + mkdir a b + ls + links2=$(stat -c %h .) + [ $(($links1 + 2)) != $links2 ] && + error "wrong links count $(($links1 + 2)) != $links2" + rmdir b + links3=$(stat -c %h .) + [ $(($links1 + 1)) != $links3 ] && + error "wrong links count $links1 != $links3" + return 0 +} +run_test 39o "directory cached attributes updated after create ========" + +test_39p() { + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + local MDTIDX=1 + TESTDIR=$DIR/$tdir/$tfile + [ -e $TESTDIR ] && rm -rf $TESTDIR + mkdir -p $TESTDIR + cd $TESTDIR + links1=2 + ls + $LFS mkdir -i $MDTIDX $TESTDIR/remote_dir1 + $LFS mkdir -i $MDTIDX $TESTDIR/remote_dir2 + ls + links2=$(stat -c %h .) + [ $(($links1 + 2)) != $links2 ] && + error "wrong links count $(($links1 + 2)) != $links2" + rmdir remote_dir2 + links3=$(stat -c %h .) + [ $(($links1 + 1)) != $links3 ] && + error "wrong links count $links1 != $links3" + return 0 +} +run_test 39p "remote directory cached attributes updated after create ========" + + test_40() { dd if=/dev/zero of=$DIR/$tfile bs=4096 count=1 $RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/$tfile && @@ -3929,7 +3987,7 @@ test_54c() { dd if=/dev/zero of=$tdir/tmp bs=`page_size` count=30 || error "dd write" df $tdir dd if=$tdir/tmp of=/dev/zero bs=`page_size` count=30 || error "dd read" - $UMOUNT $tdir + $UMOUNT -d $tdir losetup -d $loopdev rm $loopdev } @@ -4545,6 +4603,9 @@ test_56x() { run_test 56x "lfs migration support" test_56y() { + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.53) ] && + skip "No HSM support on MDS of $(get_lustre_version)," \ + "need 2.4.53 at least" && return local res="" local dir0=$DIR/$tdir/$testnum @@ -4642,7 +4703,7 @@ test_57b() { 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 [ "$MDCFREE2" -lt "$((MDCFREE - 16))" ]; then if [ "$MDSFREE" != "$MDSFREE2" ]; then error "MDC before $MDCFREE != after $MDCFREE2" else @@ -5751,6 +5812,7 @@ cleanup_101a() { test_101a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + [ $MDSCOUNT -ge 2 ] && skip "skip now for >= 2 MDTs" && return #LU-4322 local s local discard local nreads=10000 @@ -5865,40 +5927,31 @@ test_101c() { local STRIPE_SIZE=1048576 local FILE_LENGTH=$((STRIPE_SIZE*100)) local nreads=10000 - local osc - - setup_test101bc + local osc_rpc_stats - cancel_lru_locks osc - $LCTL set_param osc.*.rpc_stats 0 - $READS -f $DIR/$tfile -s$FILE_LENGTH -b65536 -n$nreads -t 180 - for osc in $($LCTL get_param -N osc.*); do - if [ "$osc" == "osc.num_refs" ]; then - continue - fi - - local lines=$($LCTL get_param -n ${osc}.rpc_stats | wc | awk '{print $1}') - if [ $lines -le 20 ]; then - continue - fi + setup_test101bc - local rpc4k=$($LCTL get_param -n ${osc}.rpc_stats | - awk '$1 == "1:" { print $2; exit; }') - local rpc8k=$($LCTL get_param -n ${osc}.rpc_stats | - awk '$1 == "2:" { print $2; exit; }') - local rpc16k=$($LCTL get_param -n ${osc}.rpc_stats | - awk '$1 == "4:" { print $2; exit; }') - local rpc32k=$($LCTL get_param -n ${osc}.rpc_stats | - awk '$1 == "8:" { print $2; exit; }') - - [ $rpc4k != 0 ] && error "Small 4k read IO ${rpc4k}!" - [ $rpc8k != 0 ] && error "Small 8k read IO ${rpc8k}!" - [ $rpc16k != 0 ] && error "Small 16k read IO ${rpc16k}!" - [ $rpc32k != 0 ] && error "Small 32k read IO ${rpc32k}!" - echo "${osc} rpc check passed!" - done - cleanup_test101bc - true + cancel_lru_locks osc + $LCTL set_param osc.*.rpc_stats 0 + $READS -f $DIR/$tfile -s$FILE_LENGTH -b65536 -n$nreads -t 180 + for osc_rpc_stats in $($LCTL get_param -N osc.*.rpc_stats); do + local stats=$($LCTL get_param -n $osc_rpc_stats) + local lines=$(echo "$stats" | awk 'END {print NR;}') + local size + + if [ $lines -le 20 ]; then + continue + fi + for size in 1 2 4 8; do + local rpc=$(echo "$stats" | + awk '($1 == "'$size':") {print $2; exit; }') + [ $rpc != 0 ] && + error "Small $((size*4))k read IO $rpc !" + done + echo "$osc_rpc_stats check passed!" + done + cleanup_test101bc + true } run_test 101c "check stripe_size aligned read-ahead =================" @@ -6347,10 +6400,87 @@ test_102l() { return 0; } -run_test 102l "listxattr filter test ==================================" +run_test 102l "listxattr size test ==================================" + +test_102m() { # LU-3403 llite: error of listxattr when buffer is small + local path=$DIR/$tfile + touch $path + + listxattr_size_check $path || error "listattr_size_check $path failed" +} +run_test 102m "Ensure listxattr fails on small bufffer ========" cleanup_test102 +getxattr() { # getxattr path name + # Return the base64 encoding of the value of xattr name on path. + local path=$1 + local name=$2 + + # # getfattr --absolute-names --encoding=base64 --name=trusted.lov $path + # file: $path + # trusted.lov=0s0AvRCwEAAAAGAAAAAAAAAAAEAAACAAAAAAAQAAEAA...AAAAAAAAA= + # + # We print just 0s0AvRCwEAAAAGAAAAAAAAAAAEAAACAAAAAAAQAAEAA...AAAAAAAAA= + + getfattr --absolute-names --encoding=base64 --name=$name $path | + awk -F= -v name=$name '$1 == name { + print substr($0, index($0, "=") + 1); + }' +} + +test_102n() { # LU-4101 mdt: protect internal xattrs + local file0=$DIR/$tfile.0 + local file1=$DIR/$tfile.1 + local xattr0=$TMP/$tfile.0 + local xattr1=$TMP/$tfile.1 + local name + local value + + if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.50) ] + then + skip "MDT < 2.5.50 allows setxattr on internal trusted xattrs" + return + fi + + rm -rf $file0 $file1 $xattr0 $xattr1 + touch $file0 $file1 + + # Get 'before' xattrs of $file1. + getfattr --absolute-names --dump --match=- $file1 > $xattr0 + + for name in lov lma lmv link fid version som hsm lfsck_namespace; do + # Try to copy xattr from $file0 to $file1. + value=$(getxattr $file0 trusted.$name 2> /dev/null) + + setfattr --name=trusted.$name --value="$value" $file1 || + error "setxattr 'trusted.$name' failed" + + # Try to set a garbage xattr. + value=0sVGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIGl0c2VsZi4= + + setfattr --name=trusted.$name --value="$value" $file1 || + error "setxattr 'trusted.$name' failed" + + # Try to remove the xattr from $file1. We don't care if this + # appears to succeed or fail, we just don't want there to be + # any changes or crashes. + setfattr --remove=$trusted.$name $file1 2> /dev/null + done + + # Get 'after' xattrs of file1. + getfattr --absolute-names --dump --match=- $file1 > $xattr1 + + if ! diff $xattr0 $xattr1; then + error "before and after xattrs of '$file1' differ" + fi + + rm -rf $file0 $file1 $xattr0 $xattr1 + + return 0 +} +run_test 102n "silently ignore setxattr on internal trusted xattrs" + run_acl_subtest() { $LUSTRE/tests/acl/run $LUSTRE/tests/acl/$1.test @@ -6612,53 +6742,79 @@ test_116a() { # was previously test_116() [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2 OSTs" && return echo -n "Free space priority " - lctl get_param -n lov.*-clilov-*.qos_prio_free + do_facet $SINGLEMDS lctl get_param -n lo*.*-mdtlov.qos_prio_free | + head -1 declare -a AVAIL free_min_max - [ $MINV -gt 960000 ] && skip "too much free space in OST$MINI, skip" &&\ - return - # generate uneven OSTs + [ $MINV -eq 0 ] && skip "no free space in OST$MINI, skip" && return + trap simple_cleanup_common EXIT + + # Check if we need to generate uneven OSTs test_mkdir -p $DIR/$tdir/OST${MINI} - declare -i FILL - FILL=$(($MINV / 4)) - echo "Filling 25% remaining space in OST${MINI} with ${FILL}Kb" - $SETSTRIPE -i $MINI -c 1 $DIR/$tdir/OST${MINI}||error "setstripe failed" - i=0 - while [ $FILL -gt 0 ]; do - i=$(($i + 1)) - dd if=/dev/zero of=$DIR/$tdir/OST${MINI}/$tfile-$i bs=2M count=1 2>/dev/null - FILL=$(($FILL - 2048)) - echo -n . - done - FILL=$(($MINV / 4)) - sync - sleep_maxage + local FILL=$(($MINV / 4)) + local DIFF=$(($MAXV - $MINV)) + local DIFF2=$(($DIFF * 100 / $MINV)) + + local threshold=$(do_facet $SINGLEMDS \ + lctl get_param -n *.*MDT0000-mdtlov.qos_threshold_rr | head -1) + threshold=${threshold%%%} + echo -n "Check for uneven OSTs: " + echo -n "diff=${DIFF}KB (${DIFF2}%) must be > ${threshold}% ..." + + if [ $DIFF2 -gt $threshold ]; then + echo "ok" + echo "Don't need to fill OST$MINI" + else + # generate uneven OSTs. Write 2% over the QOS threshold value + echo "no" + DIFF=$(($threshold - $DIFF2 + 2)) + DIFF2=$(( ($MINV * $DIFF)/100 )) + echo "Fill ${DIFF}% remaining space in OST${MINI} with ${DIFF2}KB" + $SETSTRIPE -i $MINI -c 1 $DIR/$tdir/OST${MINI} || + error "setstripe failed" + DIFF=$(($DIFF2 / 2048)) + i=0 + while [ $i -lt $DIFF ]; do + i=$(($i + 1)) + dd if=/dev/zero of=$DIR/$tdir/OST${MINI}/$tfile-$i \ + bs=2M count=1 2>/dev/null + echo -n . + done + echo . + sync + sleep_maxage + free_min_max + fi - free_min_max DIFF=$(($MAXV - $MINV)) DIFF2=$(($DIFF * 100 / $MINV)) - echo -n "diff=${DIFF}=${DIFF2}% must be > 20% for QOS mode..." - if [ $DIFF2 -gt 20 ]; then - echo "ok" + echo -n "diff=${DIFF}=${DIFF2}% must be > ${threshold}% for QOS mode..." + if [ $DIFF2 -gt $threshold ]; then + echo "ok" else - echo "failed - QOS mode won't be used" - error_ignore "QOS imbalance criteria not met" - return + echo "failed - QOS mode won't be used" + skip "QOS imbalance criteria not met" + simple_cleanup_common + return fi MINI1=$MINI; MINV1=$MINV MAXI1=$MAXI; MAXV1=$MAXV # now fill using QOS - echo writing a bunch of files to QOS-assigned OSTs $SETSTRIPE -c 1 $DIR/$tdir + FILL=$(($FILL / 200)) + if [ $FILL -gt 600 ]; then + FILL=600 + fi + echo "writing $FILL files to QOS-assigned OSTs" i=0 - while [ $FILL -gt 0 ]; do - i=$(($i + 1)) - dd if=/dev/zero of=$DIR/$tdir/$tfile-$i bs=1024 count=200 2>/dev/null - FILL=$(($FILL - 200)) - echo -n . + while [ $i -lt $FILL ]; do + i=$(($i + 1)) + dd if=/dev/zero of=$DIR/$tdir/$tfile-$i bs=200k \ + count=1 2>/dev/null + echo -n . done echo "wrote $i 200k files" sync @@ -6670,26 +6826,30 @@ test_116a() { # was previously test_116() echo "free space delta: orig $DIFF final $DIFF2" [ $DIFF2 -gt $DIFF ] && echo "delta got worse!" DIFF=$(($MINV1 - ${AVAIL[$MINI1]})) - echo "Wrote $DIFF to smaller OST $MINI1" + echo "Wrote ${DIFF}KB to smaller OST $MINI1" DIFF2=$(($MAXV1 - ${AVAIL[$MAXI1]})) - echo "Wrote $DIFF2 to larger OST $MAXI1" - [ $DIFF -gt 0 ] && echo "Wrote $(($DIFF2 * 100 / $DIFF - 100))% more data to larger OST $MAXI1" + echo "Wrote ${DIFF2}KB to larger OST $MAXI1" + FILL=$(($DIFF2 * 100 / $DIFF - 100)) + [ $DIFF -gt 0 ] && + echo "Wrote ${FILL}% more data to larger OST $MAXI1" # Figure out which files were written where UUID=$(lctl get_param -n lov.${FSNAME}-clilov-*.target_obd | - awk '/'$MINI1': / {print $2; exit}') + awk '/'$MINI1': / {print $2; exit}') echo $UUID - MINC=$($GETSTRIPE --obd $UUID $DIR/$tdir | wc -l) + MINC=$($GETSTRIPE --ost $UUID $DIR/$tdir | grep $DIR | wc -l) echo "$MINC files created on smaller OST $MINI1" UUID=$(lctl get_param -n lov.${FSNAME}-clilov-*.target_obd | - awk '/'$MAXI1': / {print $2; exit}') + awk '/'$MAXI1': / {print $2; exit}') echo $UUID - MAXC=$($GETSTRIPE --obd $UUID $DIR/$tdir | wc -l) + MAXC=$($GETSTRIPE --ost $UUID $DIR/$tdir | grep $DIR | wc -l) echo "$MAXC files created on larger OST $MAXI1" - [ $MINC -gt 0 ] && echo "Wrote $(($MAXC * 100 / $MINC - 100))% more files to larger OST $MAXI1" - [ $MAXC -gt $MINC ] || error_ignore "stripe QOS didn't balance free space" - - rm -rf $DIR/$tdir + FILL=$(($MAXC * 100 / $MINC - 100)) + [ $MINC -gt 0 ] && + echo "Wrote ${FILL}% more files to larger OST $MAXI1" + [ $MAXC -gt $MINC ] || + error_ignore LU-9 "stripe QOS didn't balance free space" + simple_cleanup_common } run_test 116a "stripe QOS: free space balance ===================" @@ -6719,7 +6879,7 @@ test_117() # bug 10891 echo "Truncate succeeded." rm -f $DIR/$tfile } -run_test 117 "verify fsfilt_extend ==========" +run_test 117 "verify osd extend ==========" NO_SLOW_RESENDCOUNT=4 export OLD_RESENDCOUNT="" @@ -8035,10 +8195,14 @@ test_130d() { $SETSTRIPE -S 65536 -c $OSTCOUNT $fm_file||error "setstripe on $fm_file" [ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] && skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return - dd if=/dev/zero of=$fm_file bs=1M count=$OSTCOUNT || error "dd failed on $fm_file" + + local actual_stripecnt=$($GETSTRIPE -c $fm_file) + dd if=/dev/zero of=$fm_file bs=1M count=$actual_stripecnt || + error "dd failed on $fm_file" filefrag -ves $fm_file || error "filefrag $fm_file failed" - filefrag_op=`filefrag -ve $fm_file | grep -A 100 "ext:" | grep -v "ext:" | grep -v "found"` + filefrag_op=`filefrag -ve $fm_file | grep -A 100 "ext:" | + grep -v "ext:" | grep -v "found"` last_lun=`echo $filefrag_op | cut -d: -f5` @@ -8062,7 +8226,7 @@ test_130d() { (( tot_len += ext_len )) last_lun=$frag_lun done - if (( num_luns != OSTCOUNT || tot_len != 1024 )); then + if (( num_luns != actual_stripecnt || tot_len != 1024 )); then cleanup_130 error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun" return @@ -9243,12 +9407,11 @@ test_156() { BEFORE=`roc_hit` cat $file >/dev/null AFTER=`roc_hit` - if ! let "AFTER - BEFORE == 0"; then - error_ignore 20762 "IN CACHE: before: $BEFORE, after: $AFTER" - else - log "cache hits:: before: $BEFORE, after: $AFTER" - fi - + if ! let "AFTER - BEFORE == 0"; then + error_ignore bz20762 "IN CACHE: before: $BEFORE, after: $AFTER" + else + log "cache hits:: before: $BEFORE, after: $AFTER" + fi log "Turn on the read cache and turn off the write cache" set_cache read on @@ -9262,11 +9425,11 @@ test_156() { cancel_lru_locks osc cat $file >/dev/null AFTER=`roc_hit` - if ! let "AFTER - BEFORE == 0"; then - error_ignore 20762 "IN CACHE: before: $BEFORE, after: $AFTER" - else - log "cache hits:: before: $BEFORE, after: $AFTER" - fi + if ! let "AFTER - BEFORE == 0"; then + error_ignore bz20762 "IN CACHE: before: $BEFORE, after: $AFTER" + else + log "cache hits:: before: $BEFORE, after: $AFTER" + fi log "Read again; it should be satisfied from the cache." BEFORE=`roc_hit` @@ -9286,7 +9449,7 @@ run_test 156 "Verification of tunables ============================" #Changelogs err17935 () { if [ $MDSCOUNT -gt 1 ]; then - error_ignore 17935 $* + error_ignore bz17935 $* else error $* fi @@ -9316,7 +9479,7 @@ changelog_extract_field() { tail -1 } -test_160() { +test_160a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return remote_mds_nodsh && skip "remote MDS with nodsh" && return [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.0) ] || @@ -9412,7 +9575,38 @@ test_160() { echo "$USERS other changelog users; can't verify off" fi } -run_test 160 "changelog sanity" +run_test 160a "changelog sanity" + +test_160b() { # LU-3587 + [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.0) ] || + { skip "Need MDS version at least 2.2.0"; return; } + + local CL_USERS="mdd.$MDT0.changelog_users" + local GET_CL_USERS="do_facet $SINGLEMDS $LCTL get_param -n $CL_USERS" + USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_register -n) + echo "Registered as changelog user $USER" + $GET_CL_USERS | grep -q $USER || + error "User $USER not found in changelog_users" + + local LONGNAME1=$(str_repeat a 255) + local LONGNAME2=$(str_repeat b 255) + + cd $DIR + echo "creating very long named file" + touch $LONGNAME1 || error "create of $LONGNAME1 failed" + echo "moving very long named file" + mv $LONGNAME1 $LONGNAME2 + + $LFS changelog $MDT0 | grep RENME + + echo "deregistering $USER" + do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $USER + + rm -f $LONGNAME2 +} +run_test 160b "Verify that very long rename doesn't crash in changelog" test_161a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return @@ -10751,6 +10945,31 @@ test_208() { } run_test 208 "Exclusive open" +test_209() { + [ -z "$(lctl get_param -n mdc.*.connect_flags | grep disp_stripe)" ] && + skip_env "must have disp_stripe" && return + + touch $DIR/$tfile + sync; sleep 5; sync; + + echo 3 > /proc/sys/vm/drop_caches + req_before=$(awk '/ptlrpc_cache / { print $2 }' /proc/slabinfo) + + # open/close 500 times + for i in $(seq 500); do + cat $DIR/$tfile + done + + echo 3 > /proc/sys/vm/drop_caches + req_after=$(awk '/ptlrpc_cache / { print $2 }' /proc/slabinfo) + + echo "before: $req_before, after: $req_after" + [ $((req_after - req_before)) -ge 300 ] && + error "open/close requests are not freed" + return 0 +} +run_test 209 "read-only open/close requests should be freed promptly" + test_212() { size=`date +%s` size=$((size % 8192 + 1)) @@ -10772,14 +10991,15 @@ test_213() { run_test 213 "OSC lock completion and cancel race don't crash - bug 18829" test_214() { # for bug 20133 - test_mkdir -p $DIR/d214p/d214c + mkdir -p $DIR/$tdir/d214c || error "mkdir $DIR/$tdir/d214c failed" for (( i=0; i < 340; i++ )) ; do - touch $DIR/d214p/d214c/a$i + touch $DIR/$tdir/d214c/a$i done - ls -l $DIR/d214p || error "ls -l $DIR/d214p failed" - mv $DIR/d214p/d214c $DIR/ || error "mv $DIR/d214p/d214c $DIR/ failed" + ls -l $DIR/$tdir || error "ls -l $DIR/d214p failed" + mv $DIR/$tdir/d214c $DIR/ || error "mv $DIR/d214p/d214c $DIR/ failed" ls $DIR/d214c || error "ls $DIR/d214c failed" + rm -rf $DIR/$tdir || error "rm -rf $DIR/d214* failed" rm -rf $DIR/d214* || error "rm -rf $DIR/d214* failed" } run_test 214 "hash-indexed directory test - bug 20133" @@ -11421,6 +11641,9 @@ test_228c() { run_test 228c "NOT shrink the last entry in OI index node to recycle idle leaf" test_229() { # LU-2482, LU-3448 + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.53) ] && + skip "No HSM support on MDS of $(get_lustre_version)," \ + "need 2.4.53 at least" && return [ $PARALLEL == "yes" ] && skip "skip parallel run" && return [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return @@ -11439,26 +11662,13 @@ test_229() { # LU-2482, LU-3448 [ $stripe_count -eq 2 ] || error "stripe count not 2 ($stripe_count)" stat $DIR/$tfile || error "failed to stat released file" - $TRUNCATE $DIR/$tfile 200000 && - error "truncate of released file should fail" - - # Ensure that nothing happened anyway. - $CHECKSTAT -s 0 $DIR/$tfile || - error "released file size should not change" - - # Stripe count should be no change after truncate - stripe_count=$($GETSTRIPE -c $DIR/$tfile) || error "getstripe failed" - [ $stripe_count -eq 2 ] || error "after trunc: ($stripe_count)" - chown $RUNAS_ID $DIR/$tfile || error "chown $RUNAS_ID $DIR/$tfile failed" chgrp $RUNAS_ID $DIR/$tfile || error "chgrp $RUNAS_ID $DIR/$tfile failed" - touch $DIR/$tfile || - error "touch $DIR/$tfile failed" - + touch $DIR/$tfile || error "touch $DIR/$tfile failed" rm $DIR/$tfile || error "failed to remove released file" } run_test 229 "getstripe/stat/rm/attr changes work on released files" @@ -11609,11 +11819,12 @@ test_234() { touch $DIR/$tdir/$tfile || error "touch failed" # OBD_FAIL_LLITE_XATTR_ENOMEM $LCTL set_param fail_loc=0x1405 - setfattr -n user.attr -v value $DIR/$tdir/$tfile && - error "setfattr should have failed with ENOMEM" - # attr pre-2.4.44-7 had a bug with rc - getfattr -n user.attr $DIR/$tdir/$tfile && - error "getfattr should have failed with ENOMEM" + if [ ! -f /etc/SuSE-release ]; then + # attr pre-2.4.44-7 had a bug with rc + # LU-3703 - SLES clients have older attr + getfattr -n user.attr $DIR/$tdir/$tfile && + error "getfattr should have failed with ENOMEM" + fi $LCTL set_param fail_loc=0x0 rm -rf $DIR/$tdir @@ -11638,6 +11849,35 @@ test_235() { } run_test 235 "LU-1715: flock deadlock detection does not work properly" +#LU-2935 +test_236() { + check_swap_layouts_support && return 0 + test_mkdir -p $DIR/$tdir || error "mkdir $tdir failed" + + local ref1=/etc/passwd + local ref2=/etc/group + local file1=$DIR/$tdir/f1 + local file2=$DIR/$tdir/f2 + + $SETSTRIPE -c 1 $file1 || error "cannot setstripe on '$file1': rc = $?" + cp $ref1 $file1 || error "cp $ref1 $file1 failed: rc = $?" + $SETSTRIPE -c 2 $file2 || error "cannot setstripe on '$file2': rc = $?" + cp $ref2 $file2 || error "cp $ref2 $file2 failed: rc = $?" + local fd=$(free_fd) + local cmd="exec $fd<>$file2" + eval $cmd + rm $file2 + $LFS swap_layouts $file1 /proc/self/fd/${fd} || + error "cannot swap layouts of '$file1' and /proc/self/fd/${fd}" + cmd="exec $fd>&-" + eval $cmd + cmp $ref2 $file1 || error "content compare failed ($ref2 != $file1)" + + #cleanup + rm -rf $DIR/$tdir +} +run_test 236 "Layout swap on open unlinked file" + # # tests that do cleanup/setup should be run at the end #