X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fconf-sanity.sh;h=2a0dc2dfe642bbd04c1ab2a72e74507ba8ff272a;hb=04794b33653fedca282d6f8dfd9c1c9e833ead06;hp=3fe0aa3b1bc0711c878576e02f6abcb568a21a44;hpb=74d95a078c6725884f67a2737ea5b7e55fab1087;p=fs%2Flustre-release.git diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh old mode 100644 new mode 100755 index 3fe0aa3..2a0dc2d --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -4,8 +4,8 @@ set -e ONLY=${ONLY:-"$*"} -# bug number for skipped test: LU-7428 -ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 84" +# bug number for skipped test: LU-8972 +ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT" # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! is_sles11() # LU-2181 @@ -52,7 +52,7 @@ init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} # use small MDS + OST size to speed formatting time -# do not use too small MDSSIZE/OSTSIZE, which affect the default jouranl size +# do not use too small MDSSIZE/OSTSIZE, which affect the default journal size # STORED_MDSSIZE is used in test_18 STORED_MDSSIZE=$MDSSIZE STORED_OSTSIZE=$OSTSIZE @@ -78,16 +78,17 @@ if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then fi [ $(facet_fstype $SINGLEMDS) = "zfs" ] && -# bug number for skipped test: LU-4444 - ALWAYS_EXCEPT="$ALWAYS_EXCEPT 69" +# bug number for skipped test: + ALWAYS_EXCEPT="$ALWAYS_EXCEPT" init_logging # require_dsh_mds || exit 0 require_dsh_ost || exit 0 -# -[ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45 69" + +# 8 22 (min)" +[ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69" assert_DIR @@ -454,17 +455,16 @@ run_test 5c "cleanup after failed mount (bug 2712) (should return errs)" test_5d() { grep " $MOUNT " /etc/mtab && - error false "unexpected entry in mtab before mount" && return 10 + error "unexpected entry in mtab before mount" start_ost || error "OST start failed" start_mds || error "MDS start failed" - stop_ost || error "Unable to stop OST1" + stop_ost -f || error "Unable to stop OST1" mount_client $MOUNT || error "mount_client $MOUNT failed" umount_client $MOUNT -f || error "umount_client $MOUNT failed" cleanup_nocli || error "cleanup_nocli failed with $?" - grep " $MOUNT " /etc/mtab && + ! grep " $MOUNT " /etc/mtab || error "$MOUNT entry in mtab after unmount" - pass } run_test 5d "mount with ost down" @@ -701,7 +701,7 @@ run_test 19a "start/stop MDS without OSTs" test_19b() { start_ost || error "Unable to start OST1" - stop_ost || error "Unable to stop OST1" + stop_ost -f || error "Unable to stop OST1" } run_test 19b "start/stop OSTs without MDS" @@ -1332,8 +1332,8 @@ run_test 31 "Connect to non-existent node (shouldn't crash)" T32_QID=60000 -T32_BLIMIT=20480 # Kbytes -T32_ILIMIT=2 +T32_BLIMIT=40960 # Kbytes +T32_ILIMIT=4 # # This is not really a test but a tool to create new disk @@ -1349,6 +1349,10 @@ test_32newtarball() { local dst=. local src=/etc/rc.d local tmp=$TMP/t32_image_create + local server_version=$(lustre_version_code $SINGLEMDS) + local remote_dir + local striped_dir + local pushd_dir if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \ $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then @@ -1367,7 +1371,7 @@ test_32newtarball() { mkdir $tmp/src || return 1 tar cf - -C $src . | tar xf - -C $tmp/src dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \ - count=$(($T32_BLIMIT / 1024 / 2)) + count=$(($T32_BLIMIT / 1024 / 4)) chown $T32_QID.$T32_QID $tmp/src/t32_qf_old # format ost with comma-separated NIDs to verify LU-4460 @@ -1376,18 +1380,42 @@ test_32newtarball() { setupall - [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ] && + [[ $server_version -ge $(version_code 2.3.50) ]] || $LFS quotacheck -ug /mnt/$FSNAME $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \ /mnt/$FSNAME tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME + + if [[ $MDSCOUNT -ge 2 ]]; then + remote_dir=/mnt/$FSNAME/remote_dir + $LFS mkdir -i 1 $remote_dir + tar cf - -C $tmp/src . | tar xf - -C $remote_dir + + if [[ $server_version -ge $(version_code 2.7.0) ]]; then + striped_dir=/mnt/$FSNAME/striped_dir_old + $LFS mkdir -i 1 -c 2 $striped_dir + tar cf - -C $tmp/src . | tar xf - -C $striped_dir + fi + fi + stopall mkdir $tmp/img || return 1 setupall - pushd /mnt/$FSNAME + + pushd_dir=/mnt/$FSNAME + if [[ $MDSCOUNT -ge 2 ]]; then + pushd_dir=$remote_dir + if [[ $server_version -ge $(version_code 2.7.0) ]]; then + pushd $striped_dir + ls -Rni --time-style=+%s >$tmp/img/list2 + popd + fi + fi + + pushd $pushd_dir ls -Rni --time-style=+%s >$tmp/img/list find ! -name .lustre -type f -exec sha1sum {} \; | sort -k 2 >$tmp/img/sha1sums @@ -1395,7 +1423,7 @@ test_32newtarball() { $LCTL get_param -n version | head -n 1 | sed -e 's/^lustre: *//' >$tmp/img/commit - [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ] && + [[ $server_version -ge $(version_code 2.3.50) ]] || $LFS quotaon -ug /mnt/$FSNAME $LFS quota -u $T32_QID -v /mnt/$FSNAME $LFS quota -v -u $T32_QID /mnt/$FSNAME | @@ -1406,11 +1434,8 @@ test_32newtarball() { awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \ { if (NF == 1) { getline } else { num++ } ; print $num;} }' \ | tr -d "*" > $tmp/img/ispace - - if [ $MDSCOUNT -ge 2 ]; then - $LFS mkdir -i 1 /mnt/$FSNAME/remote_dir - tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME/remote_dir - fi + echo $T32_BLIMIT > $tmp/img/blimit + echo $T32_ILIMIT > $tmp/img/ilimit stopall @@ -1428,6 +1453,9 @@ test_32newtarball() { mv ${MDSDEV1:-$MDSDEV} $tmp/img for num in $(seq 2 $MDSCOUNT); do local devname=$(mdsdevname $num) + local facet=mds$num + [[ $(facet_fstype $facet) != zfs ]] || + devname=$(mdsvdevname $num) mv $devname $tmp/img done mv $OSTDEV1 $tmp/img @@ -1473,7 +1501,8 @@ t32_check() { t32_test_cleanup() { local tmp=$TMP/t32 - local fstype=$(facet_fstype $SINGLEMDS) + local facet=$SINGLEMDS + local fstype=$(facet_fstype $facet) local rc=$? if $shall_cleanup_lustre; then @@ -1491,9 +1520,15 @@ t32_test_cleanup() { $r rm -rf $tmp rm -rf $tmp - if [ $fstype == "zfs" ]; then - $r $ZPOOL destroy t32fs-mdt1 || rc=$? - $r $ZPOOL destroy t32fs-ost1 || rc=$? + if [[ $fstype == zfs ]]; then + local poolname + local poolname_list="t32fs-mdt1 t32fs-ost1" + + ! $mdt2_is_available || poolname_list+=" t32fs-mdt2" + + for poolname in $poolname_list; do + destroy_zpool $facet $poolname + done fi return $rc } @@ -1583,8 +1618,8 @@ t32_verify_quota() { awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \ { if (NF == 1) { getline } else { num++ } ; print $num;} }' \ | tr -d "*") - [ $qval -eq $T32_BLIMIT ] || { - echo "blimit, act:$qval, exp:$T32_BLIMIT" + [ $qval -eq $img_blimit ] || { + echo "blimit, act:$qval, exp:$img_blimit" return 1 } @@ -1592,8 +1627,8 @@ t32_verify_quota() { awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \ { if (NF == 1) { getline } else { num++ } ; print $num;} }' \ | tr -d "*") - [ $qval -eq $T32_ILIMIT ] || { - echo "ilimit, act:$qval, exp:$T32_ILIMIT" + [ $qval -eq $img_ilimit ] || { + echo "ilimit, act:$qval, exp:$img_ilimit" return 1 } @@ -1615,18 +1650,18 @@ t32_verify_quota() { chmod 0777 $mnt runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \ - bs=1M count=$(($T32_BLIMIT / 1024)) oflag=sync && { + bs=1M count=$((img_blimit / 1024)) oflag=sync && { echo "Write succeed, but expect -EDQUOT" return 1 } rm -f $mnt/t32_qf_new runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \ - $T32_ILIMIT && { + $img_ilimit && { echo "Create succeed, but expect -EDQUOT" return 1 } - unlinkmany $mnt/t32_qf_ $T32_ILIMIT + unlinkmany $mnt/t32_qf_ $img_ilimit return 0 } @@ -1640,6 +1675,7 @@ t32_test() { local shall_cleanup_mdt1=false local shall_cleanup_ost=false local shall_cleanup_lustre=false + local mdt2_is_available=false local node=$(facet_active_host $SINGLEMDS) local r="do_node $node" local node2=$(facet_active_host mds2) @@ -1649,6 +1685,8 @@ t32_test() { local img_arch local img_bspace local img_ispace + local img_blimit + local img_ilimit local fsname=t32fs local nid=$($r $LCTL list_nids | head -1) local mopts @@ -1661,6 +1699,7 @@ t32_test() { local mdt2_dev=$tmp/mdt2 local ost_dev=$tmp/ost local stripe_index + local stripe_count local dir trap 'trap - RETURN; t32_test_cleanup' RETURN @@ -1677,6 +1716,14 @@ t32_test() { img_arch=$($r cat $tmp/arch) img_bspace=$($r cat $tmp/bspace) img_ispace=$($r cat $tmp/ispace) + + # older images did not have "blimit" and "ilimit" files + # use old values for T32_BLIMIT and T32_ILIMIT + $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) || + img_blimit=20480 + $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) || + img_ilimit=2 + echo "Upgrading from $(basename $tarball), created with:" echo " Commit: $img_commit" echo " Kernel: $img_kernel" @@ -1691,12 +1738,24 @@ t32_test() { $(lustre_version_code ost1) -lt $(version_code 2.5.0) ] && ff_convert="no" - if [ $fstype == "zfs" ]; then + ! $r test -f $mdt2_dev || mdt2_is_available=true + + if [[ $fstype == zfs ]]; then # import pool first - $r $ZPOOL import -f -d $tmp t32fs-mdt1 - $r $ZPOOL import -f -d $tmp t32fs-ost1 + local poolname + local poolname_list="t32fs-mdt1 t32fs-ost1" + + ! $mdt2_is_available || poolname_list+=" t32fs-mdt2" + + for poolname in $poolname_list; do + $r "modprobe zfs; + $ZPOOL list -H $poolname >/dev/null 2>&1 || + $ZPOOL import -f -d $tmp $poolname" + done + mdt_dev=t32fs-mdt1/mdt1 ost_dev=t32fs-ost1/ost1 + ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2 wait_update_facet $SINGLEMDS "$ZPOOL list | awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || { error_noexit "import zfs pool failed" @@ -1712,7 +1771,7 @@ t32_test() { return 1 } - if $r test -f $mdt2_dev; then + if $mdt2_is_available; then $r $TUNEFS --dryrun $mdt2_dev || { $r losetup -a error_noexit "tunefs.lustre before mounting the MDT" @@ -1729,7 +1788,7 @@ t32_test() { error_noexit "Enable mdt quota feature" return 1 } - if $r test -f $mdt2_dev; then + if $mdt2_is_available; then $r $TUNEFS --quota $mdt2_dev || { $r losetup -a error_noexit "Enable mdt quota feature" @@ -1771,7 +1830,7 @@ t32_test() { } shall_cleanup_mdt=true - if $r test -f $mdt2_dev; then + if $mdt2_is_available; then mopts=mgsnode=$nid,$mopts $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || { $r losetup -a @@ -1799,6 +1858,8 @@ t32_test() { return 1 } + [[ $(facet_fstype mds1) != zfs ]] || import_zpool fs2mds + $r $TUNEFS --dryrun $fs2mdsdev || { error_noexit "tunefs.lustre before mounting the MDT" return 1 @@ -1943,9 +2004,60 @@ t32_test() { return 1 } + if $r test -f $tmp/list; then + # + # There is not a Test Framework API to copy files to or + # from a remote node. + # + # LU-2393 - do both sorts on same node to ensure locale + # is identical + local list_file=$tmp/list + + if $mdt2_is_available; then + if [[ -d $tmp/mnt/lustre/striped_dir_old ]] && + $r test -f $tmp/list2; then + list_file=$tmp/list2 + pushd $tmp/mnt/lustre/striped_dir_old + else + pushd $tmp/mnt/lustre/remote_dir + fi + else + pushd $tmp/mnt/lustre + fi + $r cat $list_file | sort -k 6 >$tmp/list.orig + ls -Rni --time-style=+%s | sort -k 6 | + sed 's/\. / /' >$tmp/list || { + error_noexit "ls" + return 1 + } + popd + # + # 32-bit and 64-bit clients use different algorithms to + # convert FIDs into inode numbers. Hence, remove the + # inode numbers from the lists, if the original list was + # created on an architecture with different number of + # bits per "long". + # + if [ $(t32_bits_per_long $(uname -m)) != \ + $(t32_bits_per_long $img_arch) ]; then + echo "Different number of bits per \"long\"" \ + "from the disk image" + for list in list.orig list; do + sed -i -e 's/^[0-9]\+[ \t]\+//' \ + $tmp/$list + done + fi + if ! diff -ub $tmp/list.orig $tmp/list; then + error_noexit "list verification failed" + return 1 + fi + else + echo "list verification skipped" + fi + if [ "$dne_upgrade" != "no" ]; then $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || { - error_noexit "set remote dir failed" + error_noexit "set striped dir failed" return 1 } @@ -1953,9 +2065,10 @@ t32_test() { pushd $tmp/mnt/lustre tar -cf - . --exclude=./striped_dir \ + --exclude=./striped_dir_old \ --exclude=./remote_dir | tar -xvf - -C striped_dir 1>/dev/null || { - error_noexit "cp to remote dir failed" + error_noexit "cp to striped dir failed" return 1 } popd @@ -1963,20 +2076,42 @@ t32_test() { # If it is upgrade from DNE (2.5), then rename the remote dir, # which is created in 2.5 to striped dir. - if $r test -f $mdt2_dev; then - stripe_index=$(LFS getdirstripe -i \ + if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then + stripe_index=$($LFS getdirstripe -i \ $tmp/mnt/lustre/remote_dir) - [ $stripe_index -eq 1 ] || { - error_noexit "get index $striped_index failed" + + [[ $stripe_index -eq 1 ]] || { + error_noexit "get index \"$stripe_index\"" \ + "from remote dir failed" return 1 } mv $tmp/mnt/lustre/remote_dir \ $tmp/mnt/lustre/striped_dir/ || { - error_noexit "mv failed" + error_noexit "mv remote dir failed" return 1 } fi + # If it is upgraded from DNE (2.7), then move the striped dir + # which was created in 2.7 to the new striped dir. + if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] && + [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then + stripe_count=$($LFS getdirstripe -c \ + $tmp/mnt/lustre/striped_dir_old) + [[ $stripe_count -eq 2 ]] || { + error_noexit "get count $stripe_count" \ + "from striped dir failed" + return 1 + } + mv $tmp/mnt/lustre/striped_dir_old \ + $tmp/mnt/lustre/striped_dir/ || { + error_noexit "mv striped dir failed" + return 1 + } + fi + + sync; sleep 5; sync + $r $LCTL set_param -n osd*.*.force_sync=1 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || { error_noexit "dd failed" return 1 @@ -1996,8 +2131,8 @@ t32_test() { pushd $tmp/mnt/lustre fi - find ! -path "*remote_dir*" ! -name .lustre -type f \ - -exec sha1sum {} \; | + find ! -path "*remote_dir*" ! -path "*striped_dir*" \ + ! -name .lustre -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums || { popd error_noexit "sha1sum" @@ -2009,22 +2144,34 @@ t32_test() { return 1 fi - # if upgrade from DNE (2.5), then check remote directory - if $r test -f $mdt2_dev; then - pushd $tmp/mnt/lustre/striped_dir/remote_dir - find ! -name .lustre -type f \ - -exec sha1sum {} \; | - sort -k 2 >$tmp/sha1sums || { + # if upgrade from DNE(2.5), then check remote directory + # if upgrade from DNE(2.7), then check striped directory + if $mdt2_is_available && + [[ "$dne_upgrade" != "no" ]]; then + local new_dir="$tmp/mnt/lustre/striped_dir" + local striped_dir_old="$new_dir/striped_dir_old" + + local dir_list="$new_dir/remote_dir" + [[ ! -d $triped_dir_old ]] || + dir_list+=" $striped_dir_old" + + for dir in $dir_list; do + pushd $dir + find ! -name .lustre -type f \ + -exec sha1sum {} \; | + sort -k 2 >$tmp/sha1sums || { + popd + error_noexit "sha1sum" + return 1 + } popd - error_noexit "sha1sum" - return 1 - } - popd - if ! diff -ub $tmp/sha1sums.orig \ - $tmp/sha1sums; then - error_noexit "sha1sum dne failed" - return 1 - fi + if ! diff -ub $tmp/sha1sums.orig \ + $tmp/sha1sums; then + error_noexit "sha1sum $dir" \ + "failed" + return 1 + fi + done fi else echo "sha1sum verification skipped" @@ -2037,42 +2184,6 @@ t32_test() { } fi - if $r test -f $tmp/list; then - # - # There is not a Test Framework API to copy files to or - # from a remote node. - # - # LU-2393 - do both sorts on same node to ensure locale - # is identical - $r cat $tmp/list | sort -k 6 >$tmp/list.orig - pushd $tmp/mnt/lustre - ls -Rni --time-style=+%s | sort -k 6 >$tmp/list || { - error_noexit "ls" - return 1 - } - popd - # - # 32-bit and 64-bit clients use different algorithms to - # convert FIDs into inode numbers. Hence, remove the inode - # numbers from the lists, if the original list was created - # on an architecture with different number of bits per - # "long". - # - if [ $(t32_bits_per_long $(uname -m)) != \ - $(t32_bits_per_long $img_arch) ]; then - echo "Different number of bits per \"long\" from the disk image" - for list in list.orig list; do - sed -i -e 's/^[0-9]\+[ \t]\+//' $tmp/$list - done - fi - if ! diff -ub $tmp/list.orig $tmp/list; then - error_noexit "list verification failed" - return 1 - fi - else - echo "list verification skipped" - fi - # migrate files/dirs to remote MDT, then move them back if [ $(lustre_version_code mds1) -ge $(version_code 2.7.50) -a \ $dne_upgrade != "no" ]; then @@ -2136,7 +2247,7 @@ t32_test() { } shall_cleanup_lustre=false else - if [ "$dne_upgrade" != "no" ]; then + if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then $r $UMOUNT $tmp/mnt/mdt1 || { error_noexit "Unmounting the MDT2" return 1 @@ -2161,6 +2272,13 @@ t32_test() { return 1 } + if [[ $fstype == zfs ]]; then + local poolname=t32fs-mdt1 + $r "modprobe zfs; + $ZPOOL list -H $poolname >/dev/null 2>&1 || + $ZPOOL import -f -d $tmp $poolname" + fi + # mount a second time to make sure we didnt leave upgrade flag on $r $TUNEFS --dryrun $mdt_dev || { $r losetup -a @@ -2693,7 +2811,8 @@ test_41a() { #bug 14134 return fi - local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/}) + combined_mgs_mds || + { skip "needs combined MGT and MDT device" && return 0; } start_mdt 1 -o nosvc -n if [ $MDSCOUNT -ge 2 ]; then @@ -2713,7 +2832,6 @@ test_41a() { #bug 14134 stop ost1 -f || error "unable to stop OST1" stop_mds || error "Unable to stop MDS" stop_mds || error "Unable to stop MDS on second try" - unload_modules_conf || error "unload_modules_conf failed" } run_test 41a "mount mds with --nosvc and --nomgs" @@ -2753,6 +2871,7 @@ run_test 41b "mount mds with --nosvc and --nomgs on first mount" test_41c() { local server_version=$(lustre_version_code $SINGLEMDS) + local oss_list=$(comma_list $(osts_nodes)) [[ $server_version -ge $(version_code 2.6.52) ]] || [[ $server_version -ge $(version_code 2.5.26) && @@ -2761,25 +2880,50 @@ test_41c() { $server_version -lt $(version_code 2.5.11) ]] || { skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"; return; } + # ensure mds1 ost1 have been created even if running sub-test standalone cleanup + setup + cleanup || error "cleanup failed" + + # using directly mount command instead of start() function to avoid + # any side effect of // with others/externals tools/features + # ("zpool import", ...) + # MDT concurrent start - #define OBD_FAIL_TGT_DELAY_CONNECT 0x703 - do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x703" - start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS & + + LOAD_MODULES_REMOTE=true load_modules + do_facet $SINGLEMDS "lsmod | grep -q libcfs" || + error "MDT concurrent start: libcfs module not loaded" + + local mds1dev=$(mdsdevname 1) + local mds1mnt=$(facet_mntpt mds1) + local mds1fstype=$(facet_fstype mds1) + local mds1opts=$MDS_MOUNT_OPTS + + if [ $mds1fstype == ldiskfs ] && + ! do_facet mds1 test -b $mds1dev; then + mds1opts=$(csa_add "$mds1opts" -o loop) + fi + if [[ $mds1fstype == zfs ]]; then + import_zpool mds1 || return ${PIPESTATUS[0]} + fi + + #define OBD_FAIL_TGT_MOUNT_RACE 0x716 + do_facet mds1 "$LCTL set_param fail_loc=0x80000716" + + do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts & local pid=$! - sleep 2 - do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x0" - start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS & - local pid2=$! - wait $pid2 + + do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts local rc2=$? wait $pid local rc=$? - if [ $rc == 0 ] && [ $rc2 == 114 ]; then + do_facet mds1 "$LCTL set_param fail_loc=0x0" + if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then echo "1st MDT start succeed" - echo "2nd MDT start failed with EALREADY" - elif [ $rc2 == 0 ] && [ $rc == 114 ]; then - echo "1st MDT start failed with EALREADY" + echo "2nd MDT start failed with $rc2" + elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then + echo "1st MDT start failed with $rc" echo "2nd MDT start succeed" else stop mds1 -f @@ -2794,23 +2938,38 @@ test_41c() { # OST concurrent start - #define OBD_FAIL_TGT_DELAY_CONNECT 0x703 - do_facet ost1 "$LCTL set_param fail_loc=0x703" - start ost1 $(ostdevname 1) $OST_MOUNT_OPTS & + do_rpc_nodes $oss_list "lsmod | grep -q libcfs" || + error "OST concurrent start: libcfs module not loaded" + + local ost1dev=$(ostdevname 1) + local ost1mnt=$(facet_mntpt ost1) + local ost1fstype=$(facet_fstype ost1) + local ost1opts=$OST_MOUNT_OPTS + + if [ $ost1fstype == ldiskfs ] && + ! do_facet ost1 test -b $ost1dev; then + ost1opts=$(csa_add "$ost1opts" -o loop) + fi + if [[ $ost1fstype == zfs ]]; then + import_zpool ost1 || return ${PIPESTATUS[0]} + fi + + #define OBD_FAIL_TGT_MOUNT_RACE 0x716 + do_facet ost1 "$LCTL set_param fail_loc=0x80000716" + + do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts & pid=$! - sleep 2 - do_facet ost1 "$LCTL set_param fail_loc=0x0" - start ost1 $(ostdevname 1) $OST_MOUNT_OPTS & - pid2=$! - wait $pid2 + + do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts rc2=$? wait $pid rc=$? - if [ $rc == 0 ] && [ $rc2 == 114 ]; then + do_facet ost1 "$LCTL set_param fail_loc=0x0" + if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then echo "1st OST start succeed" - echo "2nd OST start failed with EALREADY" - elif [ $rc2 == 0 ] && [ $rc == 114 ]; then - echo "1st OST start failed with EALREADY" + echo "2nd OST start failed with $rc2" + elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then + echo "1st OST start failed with $rc" echo "2nd OST start succeed" else stop_mds -f @@ -2867,26 +3026,25 @@ test_42() { #bug 14693 do_facet mgs $LCTL conf_param $FSNAME.sys.some_wrong_param=20 cleanup || error "stopping $FSNAME failed with invalid sys param" - load_modules setup check_mount || error "client was not mounted with invalid sys param" cleanup || error "stopping $FSNAME failed with invalid sys param" } run_test 42 "allow client/server mount/unmount with invalid config param" -test_43() { +test_43a() { [[ $(lustre_version_code mgs) -ge $(version_code 2.5.58) ]] || { skip "Need MDS version at least 2.5.58" && return 0; } [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root" ID1=${ID1:-501} - USER1=$(cat /etc/passwd | grep :$ID1:$ID1: | cut -d: -f1) + USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1) [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" && return setup chmod ugo+x $DIR || error "chmod 0 failed" - set_conf_param_and_check mds \ + set_conf_param_and_check mds1 \ "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \ "$FSNAME.mdt.root_squash" \ "0:0" @@ -2894,7 +3052,7 @@ test_43() { "$LCTL get_param -n llite.${FSNAME}*.root_squash" \ "0:0" || error "check llite root_squash failed!" - set_conf_param_and_check mds \ + set_conf_param_and_check mds1 \ "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \ "$FSNAME.mdt.nosquash_nids" \ "NONE" @@ -2926,7 +3084,7 @@ test_43() { # set root squash UID:GID to RUNAS_ID # root should be able to access only files owned by RUNAS_ID # - set_conf_param_and_check mds \ + set_conf_param_and_check mds1 \ "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \ "$FSNAME.mdt.root_squash" \ "$RUNAS_ID:$RUNAS_ID" @@ -2996,7 +3154,7 @@ test_43() { local NIDLIST=$($LCTL list_nids all | tr '\n' ' ') NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp" NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ') - set_conf_param_and_check mds \ + set_conf_param_and_check mds1 \ "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \ "$FSNAME-MDTall.mdt.nosquash_nids" \ "$NIDLIST" @@ -3022,8 +3180,43 @@ test_43() { touch $DIR/$tdir-rootdir/tfile-2 || error "$ST: root create permission is denied" echo "$ST: root create permission is granted - ok" + cleanup || error "cleanup failed with $?" +} +run_test 43a "check root_squash and nosquash_nids" + +test_43b() { # LU-5690 + [[ $(lustre_version_code mgs) -ge $(version_code 2.7.62) ]] || + { skip "Need MGS version 2.7.62+"; return; } + + if [[ -z "$fs2mds_DEV" ]]; then + is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) && + skip_env "mixed loopback and real device not working" && return + fi + + local fs2mdsdev=$(mdsdevname 1_2) + local fs2mdsvdev=$(mdsvdevname 1_2) + + # temporarily use fs2mds as fs2mgs + local fs2mgs=fs2mds + local fs2mgsdev=$fs2mdsdev + local fs2mgsvdev=$fs2mdsvdev + + local fsname=test1234 + + load_module llite/lustre + local client_ip=$(host_nids_address $HOSTNAME $NETTYPE) + local host=${client_ip//*./} + local net=${client_ip/%$host/} + local nosquash_nids=$(h2$NETTYPE $net[$host,$host,$host]) + + add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \ + --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \ + --param mdt.nosquash_nids=$nosquash_nids \ + --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed" + start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed" + stop $fs2mgs -f || error "stop fs2mgs failed" } -run_test 43 "check root_squash and nosquash_nids" +run_test 43b "parse nosquash_nids with commas in expr_list" umount_client $MOUNT cleanup_nocli @@ -3051,8 +3244,8 @@ test_45() { #17310 df -h $MOUNT & log "sleep 60 sec" sleep 60 - #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f - do_facet client "$LCTL set_param fail_loc=0x50f" + #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f + do_facet client "$LCTL set_param fail_loc=0x8000050f" log "sleep 10 sec" sleep 10 manual_umount_client --force || error "manual_umount_client failed" @@ -3511,8 +3704,7 @@ test_50i() { # prepare MDT/OST, make OSC inactive for OST1 [ "$MDSCOUNT" -lt "2" ] && skip_env "$MDSCOUNT < 2, skipping" && return - [ $(facet_fstype ost1) == zfs ] && import_zpool ost1 - load_modules + [ $(facet_fstype mds2) == zfs ] && import_zpool mds2 do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" || error "tunefs MDT2 failed" start_mds || error "Unable to start MDT" @@ -3665,9 +3857,9 @@ test_52() { echo # backup files - echo backup files to $TMP/files + echo backup files to $TMP/$tdir local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first) - copy_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files || + copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files || error "Unable to copy files" umount_client $MOUNT || error "Unable to umount client" @@ -3694,34 +3886,23 @@ test_52() { do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found' [ $? -eq 0 ] || { error "Unable to move objects"; return 14; } - # recover objects dry-run - if [ $(lustre_version_code ost1) -ge $(version_code 2.5.56) ]; then - echo "ll_recover_lost_found_objs dry_run" - do_node $ost1node \ - "ll_recover_lost_found_objs -n -d $ost1mnt/O" || - error "ll_recover_lost_found_objs failed" - fi - - # recover objects - echo "ll_recover_lost_found_objs fix run" - do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found" || - error "ll_recover_lost_found_objs failed" - - # compare restored objects against saved ones - diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects - [ $? -eq 0 ] || error "Unable to diff objects" - do_node $ost1node "umount $ost1mnt" || error "Unable to umount ost1 as ldiskfs" start_ost || error "Unable to start OST1" mount_client $MOUNT || error "Unable to mount client" + local REPAIRED=$(do_node $ost1node "$LCTL get_param \ + -n osd-ldiskfs.$FSNAME-OST0000.oi_scrub" | + awk '/^lf_repa[ri]*ed/ { print $2 }') + [ $REPAIRED -gt 0 ] || + error "Some entry under /lost+found should be repaired" + # compare files - diff_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files || + diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files || error "Unable to diff files" - rm -rf $TMP/files $TMP/file_xattrs || + rm -rf $TMP/$tdir $TMP/file_xattrs || error "Unable to delete temporary files" do_node $ost1node "rm -rf $ost1tmp" || error "Unable to delete temporary files" @@ -3822,7 +4003,6 @@ thread_sanity() { local newvalue="${opts}=$(expr $basethr \* $ncpts)" setmodopts -a $modname "$newvalue" oldvalue - load_modules setup check_mount || return 41 @@ -3838,7 +4018,6 @@ thread_sanity() { return $? cleanup - load_modules setup } @@ -3904,6 +4083,10 @@ test_55() { for i in 1023 2048 do + if ! combined_mgs_mds; then + stop_mgs || error "stopping MGS service failed" + format_mgs || error "formatting MGT failed" + fi add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \ $mdsvdev || exit 10 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \ @@ -3927,7 +4110,7 @@ test_55() { } run_test 55 "check lov_objid size" -test_56() { +test_56a() { local server_version=$(lustre_version_code $SINGLEMDS) local mds_journal_size_orig=$MDSJOURNALSIZE local n @@ -3935,7 +4118,7 @@ test_56() { MDSJOURNALSIZE=16 for num in $(seq 1 $MDSCOUNT); do - reformat_mdt $num + format_mdt $num done add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \ $(ostdevname 1) $(ostvdevname 1) @@ -3965,7 +4148,104 @@ test_56() { MDSJOURNALSIZE=$mds_journal_size_orig reformat } -run_test 56 "check big OST indexes and out-of-index-order start" +run_test 56a "check big OST indexes and out-of-index-order start" + +cleanup_56b() { + trap 0 + + umount_client $MOUNT -f || error "unmount client failed" + stop mds1 + stop mds2 + stop mds3 + stopall + reformat +} + +test_56b() { + [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return + + trap cleanup_56b EXIT RETURN ERR + stopall + + if ! combined_mgs_mds ; then + format_mgs + start_mgs + fi + + add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) --index=0 --reformat \ + $(mdsdevname 1) $(mdsvdevname 1) + add mds2 $(mkfs_opts mds2 $(mdsdevname 2)) --index=1 --reformat \ + $(mdsdevname 2) $(mdsvdevname 2) + add mds3 $(mkfs_opts mds3 $(mdsdevname 3)) --index=1000 --reformat \ + $(mdsdevname 3) $(mdsvdevname 3) + format_ost 1 + format_ost 2 + + start_mdt 1 || error "MDT 1 (idx 0) start failed" + start_mdt 2 || error "MDT 2 (idx 1) start failed" + start_mdt 3 || error "MDT 3 (idx 1000) start failed" + start_ost || error "Unable to start first ost" + start_ost2 || error "Unable to start second ost" + + do_nodes $(comma_list $(mdts_nodes)) \ + "$LCTL set_param mdt.*.enable_remote_dir=1 \ + mdt.*.enable_remote_dir_gid=-1" + + mount_client $MOUNT || error "Unable to mount client" + + $LFS mkdir -c3 $MOUNT/$tdir || error "failed to make testdir" + + echo "This is test file 1!" > $MOUNT/$tdir/$tfile.1 || + error "failed to make test file 1" + echo "This is test file 2!" > $MOUNT/$tdir/$tfile.2 || + error "failed to make test file 2" + echo "This is test file 1000!" > $MOUNT/$tdir/$tfile.1000 || + error "failed to make test file 1000" + + rm -rf $MOUNT/$tdir || error "failed to remove testdir" + + $LFS mkdir -i1000 $MOUNT/$tdir.1000 || + error "create remote dir at idx 1000 failed" + + output=$($LFS df) + echo "=== START lfs df OUTPUT ===" + echo -e "$output" + echo "==== END lfs df OUTPUT ====" + + mdtcnt=$(echo -e "$output" | grep $FSNAME-MDT | wc -l) + ostcnt=$(echo -e "$output" | grep $FSNAME-OST | wc -l) + + echo "lfs df returned mdt count $mdtcnt and ost count $ostcnt" + [ $mdtcnt -eq 3 ] || error "lfs df returned wrong mdt count" + [ $ostcnt -eq 2 ] || error "lfs df returned wrong ost count" + + echo "This is test file 1!" > $MOUNT/$tdir.1000/$tfile.1 || + error "failed to make test file 1" + echo "This is test file 2!" > $MOUNT/$tdir.1000/$tfile.2 || + error "failed to make test file 2" + echo "This is test file 1000!" > $MOUNT/$tdir.1000/$tfile.1000 || + error "failed to make test file 1000" + rm -rf $MOUNT/$tdir.1000 || error "failed to remove remote_dir" + + output=$($LFS mdts) + echo "=== START lfs mdts OUTPUT ===" + echo -e "$output" + echo "==== END lfs mdts OUTPUT ====" + + echo -e "$output" | grep -v "MDTS:" | awk '{print $1}' | + sed 's/://g' > $TMP/mdts-actual.txt + sort $TMP/mdts-actual.txt -o $TMP/mdts-actual.txt + + echo -e "0\n1\n1000" > $TMP/mdts-expected.txt + + diff $TMP/mdts-expected.txt $TMP/mdts-actual.txt + result=$? + + rm $TMP/mdts-expected.txt $TMP/mdts-actual.txt + + [ $result -eq 0 ] || error "target_obd proc file is incorrect!" +} +run_test 56b "test target_obd correctness with nonconsecutive MDTs" test_57a() { # bug 22656 do_rpc_nodes $(facet_active_host ost1) load_modules_local @@ -4000,6 +4280,7 @@ count_osts() { } test_58() { # bug 22658 + combined_mgs_mds || stop_mgs || error "stopping MGS service failed" setup_noconfig mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed" createmany -o $DIR/$tdir/$tfile-%d 100 @@ -4020,7 +4301,7 @@ test_58() { # bug 22658 unmount_fstype $SINGLEMDS # restart MDS with missing llog files start_mds || error "unable to start MDS" - do_facet mds "$LCTL set_param fail_loc=0" + do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" reformat } run_test 58 "missing llog files must not prevent MDT from mounting" @@ -4103,6 +4384,7 @@ test_61() { # LU-80 done fi + combined_mgs_mds || stop_mgs || error "stopping MGS service failed" setup_noconfig || error "setting up the filesystem failed" client_up || error "starting client failed" @@ -4183,7 +4465,7 @@ test_62() { { skip "Need MDS version at least 2.2.51"; return 0; } echo "disable journal for mds" - do_facet mds $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed" + do_facet mds1 $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed" start_mds && error "MDT start should fail" echo "disable journal for ost" do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed" @@ -4207,8 +4489,16 @@ test_63() { fi echo "$inode_slab ldisk inodes per page" - [ "$inode_slab" -ge "3" ] || - error "ldisk inode size is too big, $inode_slab objs per page" + if [ "$inode_slab" -ge "3" ] ; then + # If kmalloc-128 is also 1 per page - this is a debug kernel + # and so this is not an error. + local kmalloc128=$(do_facet $SINGLEMDS \ + "awk '/^(kmalloc|size)-128 / { print \\\$5 }' /proc/slabinfo") + # 32 128-byte chunks in 4k + [ "$kmalloc128" -eq "32" ] || + error "ldisk inode size is too big, $inode_slab objs per page" + fi + return } run_test 63 "Verify each page can at least hold 3 ldisk inodes" @@ -4220,7 +4510,7 @@ test_64() { mount_client $MOUNT || error "Unable to mount client" stop_ost2 || error "Unable to stop second ost" echo "$LFS df" - $LFS df --lazy || error "lfs df failed" + $LFS df --lazy umount_client $MOUNT -f || error “unmount $MOUNT failed” cleanup_nocli || error "cleanup_nocli failed with $?" #writeconf to remove all ost2 traces for subsequent tests @@ -4620,6 +4910,59 @@ test_70d() { } run_test 70d "stop MDT1, mkdir succeed, create remote dir fail" +test_70e() { + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.62) ] || + { skip "Need MDS version at least 2.7.62"; return 0; } + + cleanup || error "cleanup failed with $?" + + local mdsdev=$(mdsdevname 1) + local ostdev=$(ostdevname 1) + local mdsvdev=$(mdsvdevname 1) + local ostvdev=$(ostvdevname 1) + local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev" + local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev" + + add mds1 $opts_mds || error "add mds1 failed" + start_mdt 1 || error "start mdt1 failed" + add ost1 $opts_ost || error "add ost1 failed" + start_ost || error "start ost failed" + mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed" + + local soc=$(do_facet mds1 "$LCTL get_param -n \ + mdt.*MDT0000.sync_lock_cancel") + [ $soc == "never" ] || error "SoC enabled on single MDS" + + for i in $(seq 2 $MDSCOUNT); do + mdsdev=$(mdsdevname $i) + mdsvdev=$(mdsvdevname $i) + opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \ + $mdsvdev" + add mds$i $opts_mds || error "add mds$i failed" + start_mdt $i || error "start mdt$i fail" + done + + wait_dne_interconnect + + for i in $(seq $MDSCOUNT); do + soc=$(do_facet mds$i "$LCTL get_param -n \ + mdt.*MDT000$((i - 1)).sync_lock_cancel") + [ $soc == "blocking" ] || error "SoC not enabled on DNE" + done + + for i in $(seq 2 $MDSCOUNT); do + stop_mdt $i || error "stop mdt$i fail" + done + soc=$(do_facet mds1 "$LCTL get_param -n \ + mdt.*MDT0000.sync_lock_cancel") + [ $soc == "never" ] || error "SoC enabled on single MDS" + + cleanup || error "cleanup failed with $?" +} +run_test 70e "Sync-on-Cancel will be enabled by default on DNE" + test_71a() { [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return if combined_mgs_mds; then @@ -4787,8 +5130,8 @@ test_72() { #LU-2634 for num in $(seq $MDSCOUNT); do add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \ - --reformat $(mdsdevname $num) $(mdsvdevname $num) || - error "add mds $num failed" + --reformat $(mdsdevname $num) $(mdsvdevname $num) || + error "add mds $num failed" do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" || error "$TUNE2FS failed on mds${num}" done @@ -4819,7 +5162,6 @@ test_72() { #LU-2634 run_test 72 "test fast symlink with extents flag enabled" test_73() { #LU-3006 - load_modules [ $(facet_fstype ost1) == zfs ] && import_zpool ost1 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" || error "1st tunefs failed" @@ -4931,12 +5273,32 @@ test_76b() { # LU-4783 } run_test 76b "verify params log setup correctly" +test_76c() { + [[ $(lustre_version_code mgs) -ge $(version_code 2.8.54) ]] || + { skip "Need MDS version at least 2.4.52" && return 0; } + setupall + local MASK_PARAM="mdd.*.changelog_mask" + echo "Change changelog_mask" + do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE || + error "Can't change changlog_mask" + wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM | + grep 'CLOSE'" "" + + echo "Check the value is stored after mds remount" + stop_mds || error "Failed to stop MDS" + start_mds || error "Failed to start MDS" + local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM) + echo $CHANGELOG_MASK | grep CLOSE > /dev/null && + error "changelog_mask is not changed" + + stopall +} +run_test 76c "verify changelog_mask is applied with set_param -P" + test_77() { # LU-3445 local server_version=$(lustre_version_code $SINGLEMDS) - - [[ $server_version -ge $(version_code 2.2.60) ]] && - [[ $server_version -le $(version_code 2.4.0) ]] && - skip "Need MDS version < 2.2.60 or > 2.4.0" && return + [[ $server_version -ge $(version_code 2.8.55) ]] || + { skip "Need MDS version 2.8.55+ "; return; } if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) && @@ -4957,7 +5319,7 @@ test_77() { # LU-3445 error "start fs2mds failed" mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,) - [[ $mgsnid = *,* ]] || mgsnid+=",$mgsnid" + mgsnid="$mgsnid,$mgsnid:$mgsnid" add fs2ost $(mkfs_opts ost1 $fs2ostdev) --mgsnode=$mgsnid \ --failnode=$failnid --fsname=$fsname \ @@ -4978,8 +5340,12 @@ test_78() { skip "only applicable to ldiskfs-based MDTs and OSTs" && return # reformat the Lustre filesystem with a smaller size + local saved_MDSCOUNT=$MDSCOUNT local saved_MDSSIZE=$MDSSIZE + local saved_OSTCOUNT=$OSTCOUNT local saved_OSTSIZE=$OSTSIZE + MDSCOUNT=1 + OSTCOUNT=1 MDSSIZE=$((MDSSIZE - 20000)) OSTSIZE=$((OSTSIZE - 20000)) reformat || error "(1) reformat Lustre filesystem failed" @@ -4994,11 +5360,26 @@ test_78() { local i local file local num_files=100 + mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed" + $LFS df; $LFS df -i for i in $(seq $num_files); do file=$MOUNT/$tdir/$tfile-$i - dd if=/dev/urandom of=$file count=1 bs=1M || + dd if=/dev/urandom of=$file count=1 bs=1M || { + $LCTL get_param osc.*.cur*grant* + $LFS df; $LFS df -i; + # stop creating files if there is no more space + if [ ! -e $file ]; then + num_files=$((i - 1)) + break + fi + + $LFS getstripe -v $file + local ost_idx=$(LFS getstripe -i $file) + do_facet ost$((ost_idx + 1)) \ + $LCTL get_param obdfilter.*.*grant* error "(4) create $file failed" + } done # unmount the Lustre filesystem @@ -5110,6 +5491,9 @@ test_78() { # unmount and reformat the Lustre filesystem cleanup || error "(12) cleanup Lustre filesystem failed" combined_mgs_mds || stop_mgs || error "(13) stop mgs failed" + + MDSCOUNT=$saved_MDSCOUNT + OSTCOUNT=$saved_OSTCOUNT reformat || error "(14) reformat Lustre filesystem failed" } run_test 78 "run resize2fs on MDT and OST filesystems" @@ -5257,19 +5641,6 @@ test_81() { # LU-4665 } run_test 81 "sparse OST indexing" -# Wait OSTs to be active on both client and MDT side. -wait_osts_up() { - local cmd="$LCTL get_param -n lov.$FSNAME-clilov-*.target_obd | - awk 'BEGIN {c = 0} /ACTIVE/{c += 1} END {printf \\\"%d\\\", c}'" - wait_update $HOSTNAME "eval $cmd" $OSTCOUNT || - error "wait_update OSTs up on client failed" - - cmd="$LCTL get_param -n lod.$FSNAME-MDT*-*.target_obd | sort -u | - awk 'BEGIN {c = 0} /ACTIVE/{c += 1} END {printf \\\"%d\\\", c}'" - wait_update_facet $SINGLEMDS "eval $cmd" $OSTCOUNT || - error "wait_update OSTs up on MDT failed" -} - # Here we exercise the stripe placement functionality on a file system that # has formatted the OST with a random index. With the file system the following # functionality is tested: @@ -5297,8 +5668,9 @@ test_82a() { # LU-4665 local i local index local ost_indices + local LOV_V1_INSANE_STRIPE_COUNT=65532 for i in $(seq $OSTCOUNT); do - index=$((RANDOM * 2)) + index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT)) ost_indices+=" $index" done ost_indices=$(comma_list $ost_indices) @@ -5404,8 +5776,9 @@ test_82b() { # LU-4665 local i local index local ost_indices + local LOV_V1_INSANE_STRIPE_COUNT=65532 for i in $(seq $OSTCOUNT); do - index=$((RANDOM * 2)) + index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT)) ost_indices+=" $index" done ost_indices=$(comma_list $ost_indices) @@ -5452,7 +5825,8 @@ test_82b() { # LU-4665 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME| sort -u | tr '\n' ' ' " "$ost_targets_uuid" || error "wait_update $ost_pool failed" - pool_list $ost_pool || error "list OST pool $ost_pool failed" + [[ -z $(list_pool $ost_pool) ]] && + error "list OST pool $ost_pool failed" # If [--pool|-p ] is set with [--ost-list|-o ], # then the OSTs must be the members of the pool. @@ -5533,32 +5907,6 @@ test_83() { run_test 83 "ENOSPACE on OST doesn't cause message VFS: \ Busy inodes after unmount ..." -recovery_time_min() { - local CONNECTION_SWITCH_MIN=5 - local CONNECTION_SWITCH_INC=5 - local CONNECTION_SWITCH_MAX - local RECONNECT_DELAY_MAX - local INITIAL_CONNECT_TIMEOUT - local max - local TO_20 - - #CONNECTION_SWITCH_MAX=min(50, max($CONNECTION_SWITCH_MIN,$TIMEOUT) - (($CONNECTION_SWITCH_MIN>$TIMEOUT)) && \ - max=$CONNECTION_SWITCH_MIN || max=$TIMEOUT - (($max<50)) && CONNECTION_SWITCH_MAX=$max || CONNECTION_SWITCH_MAX=50 - - #INITIAL_CONNECT_TIMEOUT = max(CONNECTION_SWITCH_MIN, \ - #obd_timeout/20) - TO_20=$(($TIMEOUT/20)) - (($CONNECTION_SWITCH_MIN>$TO_20)) && \ - INITIAL_CONNECT_TIMEOUT=$CONNECTION_SWITCH_MIN || \ - INITIAL_CONNECT_TIMEOUT=$TO_20 - - RECONNECT_DELAY_MAX=$(($CONNECTION_SWITCH_MAX+$CONNECTION_SWITCH_INC+ \ - $INITIAL_CONNECT_TIMEOUT)) - echo $((2*$RECONNECT_DELAY_MAX)) -} - test_84() { local facet=$SINGLEMDS local num=$(echo $facet | tr -d "mds") @@ -5569,7 +5917,6 @@ test_84() { local correct_clients local wrap_up=5 - load_modules echo "start mds service on $(facet_active_host $facet)" start_mds \ "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ || @@ -5634,9 +5981,21 @@ test_85() { } run_test 85 "osd_ost init: fail ea_fid_set" +cleanup_86() { + trap 0 + + # ost1 has already registered to the MGS before the reformat. + # So after reformatting it with option "-G", it could not be + # mounted to the MGS. Cleanup the system for subsequent tests. + reformat_and_config +} + test_86() { + local server_version=$(lustre_version_code $SINGLEMDS) [ "$(facet_fstype ost1)" = "zfs" ] && skip "LU-6442: no such mkfs params for ZFS OSTs" && return + [[ $server_version -ge $(version_code 2.7.56) ]] || + { skip "Need server version newer than 2.7.55"; return 0; } local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \ --reformat $(ostdevname 1) $(ostvdevname 1)" @@ -5657,6 +6016,9 @@ test_86() { echo "params: $opts" + trap cleanup_86 EXIT ERR + + stopall add ost1 $opts || error "add ost1 failed with new params" local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" | @@ -5664,7 +6026,8 @@ test_86() { [[ $FOUNDSIZE == $NEWSIZE ]] || error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE" - return 0 + + cleanup_86 } run_test 86 "Replacing mkfs.lustre -G option" @@ -5753,6 +6116,29 @@ test_87() { #LU-6544 } run_test 87 "check if MDT inode can hold EAs with N stripes properly" +test_88() { + [ "$(facet_fstype mds1)" == "zfs" ] && + skip "LU-6662: no implementation for ZFS" && return + + load_modules + + add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \ + --reformat $(mdsdevname 1) || error "add mds1 failed" + + do_facet mds1 "$TUNEFS $(mdsdevname 1) | + grep -e \".*opts:.*errors=remount-ro.*\"" || + error "default mount options is missing" + + add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \ + --mountfsoptions="user_xattr,errors=panic" \ + --reformat $(mdsdevname 1) || error "add mds1 failed" + + do_facet mds1 "$TUNEFS $(mdsdevname 1) | + grep -e \".*opts:.*errors=panic.*\"" || + error "user can't override default mount options" +} +run_test 88 "check the default mount options can be overridden" + # $1 test directory # $2 (optional) value of max_mod_rpcs_in_flight to set check_max_mod_rpcs_in_flight() { @@ -6057,8 +6443,6 @@ test_91() { local nid local found - load_modules - [[ $(lustre_version_code ost1) -ge $(version_code 2.7.63) ]] || { skip "Need OST version at least 2.7.63" && return 0; } [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.63) ]] || @@ -6112,6 +6496,537 @@ test_91() { } run_test 91 "evict-by-nid support" +generate_ldev_conf() { + # generate an ldev.conf file + local ldevconfpath=$1 + local fstype= + local fsldevformat="" + touch $ldevconfpath + + fstype=$(facet_fstype mgs) + if [ "$fstype" == "zfs" ]; then + fsldevformat="$fstype:" + else + fsldevformat="" + fi + + printf "%s\t-\t%s-MGS0000\t%s%s\n" \ + $mgs_HOST \ + $FSNAME \ + $fsldevformat \ + $(mgsdevname) > $ldevconfpath + + local mdsfo_host=$mdsfailover_HOST; + if [ -z "$mdsfo_host" ]; then + mdsfo_host="-" + fi + + for num in $(seq $MDSCOUNT); do + fstype=$(facet_fstype mds$num) + if [ "$fstype" == "zfs" ]; then + fsldevformat="$fstype:" + else + fsldevformat="" + fi + + printf "%s\t%s\t%s-MDT%04d\t%s%s\n" \ + $mds_HOST \ + $mdsfo_host \ + $FSNAME \ + $num \ + $fsldevformat \ + $(mdsdevname $num) >> $ldevconfpath + done + + local ostfo_host=$ostfailover_HOST; + if [ -z "$ostfo_host" ]; then + ostfo_host="-" + fi + + for num in $(seq $OSTCOUNT); do + fstype=$(facet_fstype ost$num) + if [ "$fstype" == "zfs" ]; then + fsldevformat="$fstype:" + else + fsldevformat="" + fi + + printf "%s\t%s\t%s-OST%04d\t%s%s\n" \ + $ost_HOST \ + $ostfo_host \ + $FSNAME \ + $num \ + $fsldevformat \ + $(ostdevname $num) >> $ldevconfpath + done + + echo "----- $ldevconfpath -----" + cat $ldevconfpath + echo "--- END $ldevconfpath ---" + +} + +generate_nids() { + # generate a nids file (mapping between hostname to nid) + # looks like we only have the MGS nid available to us + # so just echo that to a file + local nidspath=$1 + echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath + + echo "----- $nidspath -----" + cat $nidspath + echo "--- END $nidspath ---" +} + +compare_ldev_output() { + ldev_output=$1 + expected_output=$2 + + sort $expected_output -o $expected_output + sort $ldev_output -o $ldev_output + + echo "-- START OF LDEV OUTPUT --" + cat $ldev_output + echo "--- END OF LDEV OUTPUT ---" + + echo "-- START OF EXPECTED OUTPUT --" + cat $expected_output + echo "--- END OF EXPECTED OUTPUT ---" + + diff $expected_output $ldev_output + return $? +} + +test_92() { + if [ -z "$LDEV" ]; then + error "ldev is missing!" + fi + + local LDEVCONFPATH=$TMP/ldev.conf + local NIDSPATH=$TMP/nids + + echo "Host is $(hostname)" + + generate_ldev_conf $LDEVCONFPATH + generate_nids $NIDSPATH + + # echo the mgs nid and compare it to environment variable MGSNID + # also, ldev.conf and nids is a server side thing, use the OSS + # hostname + local output + output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m) + + echo "-- START OF LDEV OUTPUT --" + echo -e "$output" + echo "--- END OF LDEV OUTPUT ---" + + # ldev failed, error + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev failed to execute!" + fi + + # need to process multiple lines because of combined MGS and MDS + echo -e $output | awk '{ print $2 }' | while read -r line ; do + if [ "$line" != "$MGSNID" ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev failed mgs nid '$line', expected '$MGSNID'" + fi + done + + rm $LDEVCONFPATH $NIDSPATH +} +run_test 92 "ldev returns MGS NID correctly in command substitution" + +test_93() { + [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return + + reformat + #start mgs or mgs/mdt0 + if ! combined_mgs_mds ; then + start_mgs + start_mdt 1 + else + start_mdt 1 + fi + + start_ost || error "OST0 start fail" + + #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e + do_facet mgs "$LCTL set_param fail_val = 10 fail_loc=0x8000090e" + for num in $(seq 2 $MDSCOUNT); do + start_mdt $num & + done + + mount_client $MOUNT || error "mount client fails" + wait_osc_import_state mds ost FULL + wait_osc_import_state client ost FULL + check_mount || error "check_mount failed" + + cleanup || error "cleanup failed with $?" +} +run_test 93 "register mulitple MDT at the same time" + +test_94() { + if [ -z "$LDEV" ]; then + error "ldev is missing!" + fi + + local LDEVCONFPATH=$TMP/ldev.conf + local NIDSPATH=$TMP/nids + + generate_ldev_conf $LDEVCONFPATH + generate_nids $NIDSPATH + + local LDEV_OUTPUT=$TMP/ldev-output.txt + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT + + # ldev failed, error + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT + error "ldev failed to execute!" + fi + + # expected output + local EXPECTED_OUTPUT=$TMP/ldev-expected.txt + + printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT + + for num in $(seq $MDSCOUNT); do + printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT + done + + for num in $(seq $OSTCOUNT); do + printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT + done + + compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT + error "ldev failed to produce the correct hostlist!" + fi + + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT +} +run_test 94 "ldev outputs correct labels for file system name query" + +test_95() { + if [ -z "$LDEV" ]; then + error "ldev is missing!" + fi + + local LDEVCONFPATH=$TMP/ldev.conf + local NIDSPATH=$TMP/nids + + generate_ldev_conf $LDEVCONFPATH + generate_nids $NIDSPATH + + # SUCCESS CASES + # file sys filter + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -F failed!" + fi + + # local filter + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -l failed!" + fi + + # foreign filter + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -f failed!" + fi + + # all filter + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -a failed!" + fi + + # FAILURE CASES + # all & file sys + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null + if [ $? -eq 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -a and -F incorrectly succeeded" + fi + + # all & foreign + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null + if [ $? -eq 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -a and -f incorrectly succeeded" + fi + + # all & local + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null + if [ $? -eq 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -a and -l incorrectly succeeded" + fi + + # foreign & local + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null + if [ $? -eq 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -f and -l incorrectly succeeded" + fi + + # file sys & local + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null + if [ $? -eq 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -F and -l incorrectly succeeded" + fi + + # file sys & foreign + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null + if [ $? -eq 0 ]; then + rm $LDEVCONFPATH $NIDSPATH + error "ldev label filtering w/ -F and -f incorrectly succeeded" + fi + + rm $LDEVCONFPATH $NIDSPATH +} +run_test 95 "ldev should only allow one label filter" + +test_96() { + if [ -z "$LDEV" ]; then + error "ldev is missing!" + fi + + local LDEVCONFPATH=$TMP/ldev.conf + local NIDSPATH=$TMP/nids + + generate_ldev_conf $LDEVCONFPATH + generate_nids $NIDSPATH + + local LDEV_OUTPUT=$TMP/ldev-output.txt + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \ + echo %H-%b | \ + awk '{print $2}' > $LDEV_OUTPUT + + # ldev failed, error + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT + error "ldev failed to execute!" + fi + + # expected output + local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt + + echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT + + if [ "$mgs_HOST" == "$mds_HOST" ]; then + for num in $(seq $MDSCOUNT); do + echo "$mds_HOST-$(facet_fstype mds$num)" \ + >> $EXPECTED_OUTPUT + done + fi + + if [ "$mgs_HOST" == "$ost_HOST" ]; then + for num in $(seq $OSTCOUNT); do + echo "$ost_HOST-$(facet_fstype ost$num)" \ + >> $EXPECTED_OUTPUT + done + fi + + compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT + error "ldev failed to produce the correct output!" + fi + + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT +} +run_test 96 "ldev returns hostname and backend fs correctly in command sub" + +test_97() { + if [ -z "$LDEV" ]; then + error "ldev is missing!" + fi + + local LDEVCONFPATH=$TMP/ldev.conf + local NIDSPATH=$TMP/nids + + generate_ldev_conf $LDEVCONFPATH + generate_nids $NIDSPATH + + local LDEV_OUTPUT=$TMP/ldev-output.txt + local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt + + echo -e "\nMDT role" + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT + error "ldev failed to execute for mdt role!" + fi + + for num in $(seq $MDSCOUNT); do + printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT + done + + compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT + error "ldev failed to produce the correct output for mdt role!" + fi + + echo -e "\nOST role" + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT + error "ldev failed to execute for ost role!" + fi + + rm $EXPECTED_OUTPUT + for num in $(seq $OSTCOUNT); do + printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT + done + + compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT + error "ldev failed to produce the correct output for ost role!" + fi + + echo -e "\nMGS role" + $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT + error "ldev failed to execute for mgs role!" + fi + + printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT + + compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT + + if [ $? -ne 0 ]; then + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT + error "ldev failed to produce the correct output for mgs role!" + fi + + rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT +} +run_test 97 "ldev returns correct ouput when querying based on role" + +test_98() +{ + local mountopt + local temp=$MDS_MOUNT_OPTS + + setup + check_mount || error "mount failed" + mountopt="user_xattr" + for ((x = 1; x <= 400; x++)); do + mountopt="$mountopt,user_xattr" + done + remount_client $mountopt $MOUNT 2>&1 | grep "too long" || + error "Buffer overflow check failed" + cleanup || error "cleanup failed" +} +run_test 98 "Buffer-overflow check while parsing mount_opts" + +test_99() +{ + [[ $(facet_fstype ost1) != ldiskfs ]] && + { skip "Only applicable to ldiskfs-based OSTs" && return; } + [[ $(lustre_version_code ost1) -ge $(version_code 2.8.57) ]] || + { skip "Need OST version at least 2.8.57" && return 0; } + + local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \ + --reformat $(ostdevname 1) $(ostvdevname 1)" + do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" && + skip "meta_bg already set" && return + + local opts=ost_opts + if [[ ${!opts} != *mkfsoptions* ]]; then + eval opts=\"${!opts} \ + --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\" + else + local val=${!opts//--mkfsoptions=\\\"/ \ + --mkfsoptions=\\\"-O ^resize_inode,meta_bg } + eval opts='${val}' + fi + + echo "params: $opts" + + add ost1 $opts || error "add ost1 failed with new params" + + do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" || + error "meta_bg is not set" + + return 0 +} +run_test 99 "Adding meta_bg option" + +test_100() { + reformat + start_mds || error "MDS start failed" + start_ost || error "unable to start OST" + mount_client $MOUNT || error "client start failed" + check_mount || error "check_mount failed" + + # Desired output + # MGS: + # 0@lo + # lustre-MDT0000: + # 0@lo + # lustre-OST0000: + # 0@lo + do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0} + END {exit rc}' || error "lshowmount have no output MGS" + + do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/ + {rc=0} END {exit rc}' || error "lshowmount have no output MDT0" + + do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/ + {rc=0} END {exit rc}' || error "lshowmount have no output OST0" + + cleanup || error "cleanup failed with $?" +} +run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo" + +test_101() { + local createmany_oid + local dev=$FSNAME-OST0000-osc-MDT0000 + setup + + createmany -o $DIR1/$tfile-%d 50000 & + createmany_oid=$! + # MDT->OST reconnection causes MDT<->OST last_id synchornisation + # via osp_precreate_cleanup_orphans. + for ((i = 0; i < 100; i++)); do + for ((k = 0; k < 10; k++)); do + do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \ + "$LCTL --device $dev activate" + done + + ls -asl $MOUNT | grep '???' && + (kill -9 $createmany_oid &>/dev/null; \ + error "File hasn't object on OST") + + kill -s 0 $createmany_oid || break + done + wait $createmany_oid + cleanup +} +run_test 101 "Race MDT->OST reconnection with create" + if ! combined_mgs_mds ; then stop mgs fi