[ "$SLOW" = "no" ] && EXCEPT_SLOW="$EXCEPT_SLOW 51b"
fi
-# Get the SLES version so we can make decisions on if a test should be run
+# Get the SLES distro version
#
# Returns a version string that should only be used in comparing
# strings returned by version_code()
-
sles_version_code()
{
local version=$(grep VERSION_ID /etc/os-release | cut -d'"' -f2)
version_code $sles_version
}
+# Check if we are running on Ubuntu or SLES so we can make decisions on
+# what tests to run
if [ -r /etc/SuSE-release ]; then
sles_version=$(sles_version_code)
[ $sles_version -lt $(version_code 11.4.0) ] &&
[ $sles_version -lt $(version_code 12.0.0) ] &&
# bug number for skipped test: LU-3703
ALWAYS_EXCEPT="$ALWAYS_EXCEPT 234"
+elif [ -r /etc/os-release ]; then
+ if grep -qi ubuntu /etc/os-release; then
+ ubuntu_version=$(version_code $(sed -n -e 's/"//g' \
+ -e 's/^VERSION=//p' \
+ /etc/os-release |
+ awk '{ print $1 }'))
+
+ if [[ $ubuntu_version -gt $(version_code 16.0.0) ]]; then
+ # bug number for skipped test:
+ # LU-10334 LU-10335 LU-10335 LU-10335
+ ALWAYS_EXCEPT+=" 103a 130a 130b 130c"
+ # LU-10335 LU-10335 LU-10365 LU-10366
+ ALWAYS_EXCEPT+=" 130d 130e 400a 410"
+ fi
+ fi
fi
FAIL_ON_ERROR=false
df $MOUNT > /dev/null 2>&1
[ $rc -eq 0 ] ||
error "e2fsck detected error for short/long symlink: rc=$rc"
+ rm -f $wdir/*
}
run_test 17m "run e2fsck against MDT which contains short/long symlink"
run_test 27E "check that default extended attribute size properly increases"
test_27F() { # LU-5346/LU-7975
+ [[ $OSTCOUNT -lt 2 ]] && skip "needs >= 2 OSTs" && return
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.51) ]] &&
skip "Need MDS version at least 2.8.51" && return
local ostidx=1
local obduuid=$(ostuuid_from_index $ostidx)
local found=$($LFS getstripe -r --obd $obduuid $dir |
- egrep -c "obdidx|l_ost_idx")
+ grep 'lmm_stripe_offset:' | grep -c " $ostidx\$")
+
+ filenum=$($LFS getstripe -ir $dir | grep -c "^$ostidx\$")
+ [[ $($LFS getstripe -id $dir) -ne $ostidx ]] ||
+ ((filenum--))
+ [[ $($LFS getstripe -id $dir/dir) -ne $ostidx ]] ||
+ ((filenum--))
- filenum=$($LFS getstripe -ir $dir | grep "^$ostidx\$" | wc -l)
[[ $found -eq $filenum ]] ||
error "$LFS getstripe --obd: found $found expect $filenum"
[[ $($LFS getstripe -r -v --obd $obduuid $dir |
run_test 56b "check $LFS getdirstripe"
test_56c() {
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
+
local ost_idx=0
local ost_name=$(ostname_from_index $ost_idx)
local old_status=$(ost_dev_status $ost_idx)
$LFS setdirstripe -c$MDSCOUNT $dir/striped_dir
createmany -o $dir/striped_dir/${tfile}- 1024
- local dirs=$(lfs find --size +8k $dir/)
+ local dirs=$($LFS find --size +8k $dir/)
[ -n "$dirs" ] || error "lfs find --size wrong under striped dir"
}
run_test 56aa "lfs find --size under striped dir"
+test_56ab() { # LU-10705
+ test_mkdir $DIR/$tdir
+ dd if=/dev/zero of=$DIR/$tdir/$tfile.1 bs=8k count=1 seek=2k
+ dd if=/dev/zero of=$DIR/$tdir/$tfile.2 bs=4k count=1 seek=4k
+ dd if=/dev/zero of=$DIR/$tdir/$tfile.3 bs=1M count=2 seek=16
+ # Flush writes to ensure valid blocks. Need to be more thorough for
+ # ZFS, since blocks are not allocated/returned to client immediately.
+ sync_all_data
+ wait_zfs_commit ost1 2
+ cancel_lru_locks osc
+ ls -ls $DIR/$tdir
+
+ local files=$($LFS find --size +16M $DIR/$tdir | wc -l)
+
+ [[ $files == 3 ]] || error ">16M size files $files isn't 3 as expected"
+
+ files=$($LFS find --blocks +1M $DIR/$tdir | wc -l)
+ [[ $files == 1 ]] || error ">1M blocks files $files isn't 1 as expected"
+
+ rm -f $DIR/$tdir/$tfile.[123]
+}
+run_test 56ab "lfs find --blocks"
+
test_56ba() {
# Create composite files with one component
local dir=$DIR/$tdir
run_test 60a "llog_test run from kernel module and test llog_reader"
test_60aa() {
+ remote_mgs_nodsh && skip "remote MGS with nodsh" && return
+
# test old logid format
if [ $(lustre_version_code mgs) -le $(version_code 3.1.53) ]; then
do_facet mgs $LCTL dl | grep MGS
skip "OST < 2.10.55 doesn't limit grants enough" && return 0
local tgt=$($LCTL dl | grep "0000-osc-[^mM]" | awk '{print $4}')
+ local file=$DIR/$tfile
[[ $($LCTL get_param osc.${tgt}.import |
grep "connect_flags:.*grant_param") ]] || \
$LCTL set_param debug="$OLDDEBUG" 2> /dev/null || true
local max_cur_granted=$(($(want_grant $tgt) + $(grant_chunk $tgt)))
+ stack_trap "rm -f $file" EXIT
- $SETSTRIPE $DIR/$tfile -i 0 -c 1
- dd if=/dev/zero of=$DIR/$tfile bs=1M count=1000 &
+ $SETSTRIPE $file -i 0 -c 1
+ dd if=/dev/zero of=$file bs=1M count=1000 &
ddpid=$!
while true
}
test_77c() {
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
+
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
$GSS && skip "could not run with gss" && return
[ ! -f $F77_TMP ] && setup_f77
- $SETSTRIPE -c 1 -i 0 $DIR/$tfile
+ local file=$DIR/$tfile
+ stack_trap "rm -f $file" EXIT
+
+ $SETSTRIPE -c 1 -i 0 $file
#define OBD_FAIL_OST_CHECKSUM_RECEIVE 0x21a
do_facet ost1 lctl set_param fail_loc=0x8000021a
set_checksums 1
- dd if=$F77_TMP of=$DIR/$tfile bs=1M count=$F77SZ ||
+ dd if=$F77_TMP of=$file bs=1M count=$F77SZ ||
error "write error: rc=$?"
do_facet ost1 lctl set_param fail_loc=0
set_checksums 0
#define OBD_FAIL_OST_CHECKSUM_SEND 0x21b
do_facet ost1 lctl set_param fail_loc=0x8000021b
set_checksums 1
- cmp $F77_TMP $DIR/$tfile || error "file compare failed"
+ cmp $F77_TMP $file || error "file compare failed"
do_facet ost1 lctl set_param fail_loc=0
set_checksums 0
}
test_83() {
local sfile="/boot/System.map-$(uname -r)"
+ [ ! -f $sfile ] && skip "No $sfile found" && return
# define OBD_FAIL_LLITE_PTASK_IO_FAIL 0x140d
$LCTL set_param fail_loc=0x140d
cp $sfile $DIR/$tfile || error "write failed"
test_101g_brw_size_test() {
local mb=$1
local pages=$((mb * 1048576 / $(page_size)))
+ local file=$DIR/$tfile
$LCTL set_param osc.*.max_pages_per_rpc=${mb}M ||
{ error "unable to set max_pages_per_rpc=${mb}M"; return 1; }
return 2
done
+ stack_trap "rm -f $file" EXIT
$LCTL set_param -n osc.*.rpc_stats=0
# 10 RPCs should be enough for the test
local count=10
- dd if=/dev/zero of=$DIR/$tfile bs=${mb}M count=$count ||
+ dd if=/dev/zero of=$file bs=${mb}M count=$count ||
{ error "dd write ${mb} MB blocks failed"; return 3; }
cancel_lru_locks osc
- dd of=/dev/null if=$DIR/$tfile bs=${mb}M count=$count ||
+ dd of=/dev/null if=$file bs=${mb}M count=$count ||
{ error "dd write ${mb} MB blocks failed"; return 4; }
# calculate number of full-sized read and write RPCs
}
test_101g() {
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
+
local rpcs
local osts=$(get_facets OST)
local list=$(comma_list $(osts_nodes))
fi
done
}
-run_test 103a "acl test ========================================="
+run_test 103a "acl test"
+
+test_103b() {
+ local U
+
+ for U in {0..511}; do
+ {
+ local O=$(printf "%04o" $U)
+
+ umask $(printf "%04o" $((511 ^ $O)))
+ $LFS setstripe -c 1 $DIR/$tfile.s$O
+ local S=$(printf "%04o" 0$(stat -c%a $DIR/$tfile.s$O))
+
+ (( $S == ($O & 0666) )) ||
+ error "lfs setstripe $DIR/$tfile.s$O '$S' != '$O'"
+
+ $LFS setstripe -E16M -c 1 -E1G -S4M $DIR/$tfile.p$O
+ S=$(printf "%04o" 0$(stat -c%a $DIR/$tfile.p$O))
+ (( $S == ($O & 0666) )) ||
+ error "lfs setstripe -E $DIR/$tfile.p$O '$S' != '$O'"
+
+ $LFS setstripe -N2 -c 1 $DIR/$tfile.m$O
+ S=$(printf "%04o" 0$(stat -c%a $DIR/$tfile.m$O))
+ (( $S == ($O & 0666) )) ||
+ error "lfs setstripe -N2 $DIR/$tfile.m$O '$S' != '$O'"
+ rm -f $DIR/$tfile.[smp]$0
+ } &
+ done
+ wait
+}
+run_test 103b "umask lfs setstripe"
test_103c() {
mkdir -p $DIR/$tdir
}
get_rename_size() {
- local size=$1
- local context=${2:-.}
- local sample=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats |
+ local size=$1
+ local context=${2:-.}
+ local sample=$(do_facet $SINGLEMDS $LCTL \
+ get_param mdt.$FSNAME-MDT0000.rename_stats |
grep -A1 $context |
awk '/ '${size}'/ {print $4}' | sed -e "s/,//g")
- echo $sample
+ echo $sample
}
test_133d() {
local testdir1=$DIR/${tdir}/stats_testdir1
local testdir2=$DIR/${tdir}/stats_testdir2
+ mkdir -p $DIR/${tdir}
do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
- mkdir -p ${testdir1} || error "mkdir failed"
- mkdir -p ${testdir2} || error "mkdir failed"
+ lfs mkdir -i 0 -c 1 ${testdir1} || error "mkdir failed"
+ lfs mkdir -i 0 -c 1 ${testdir2} || error "mkdir failed"
createmany -o $testdir1/test 512 || error "createmany failed"
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"
+ local cmd="do_facet $SINGLEMDS $LCTL "
+ cmd+="get_param mdt.$FSNAME-MDT0000.rename_stats"
+
eval $cmd || error "$cmd failed"
local samedir=$($cmd | grep 'same_dir')
local same_sample=$(get_rename_size $testdir1_size)
run_test 160e "changelog negative testing (should return errors)"
test_160f() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
+ { skip "Need MDS version at least 2.10.56"; return 0; }
+
local mdts=$(comma_list $(mdts_nodes))
# Create a user
run_test 160f "changelog garbage collect (timestamped users)"
test_160g() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
+ { skip "Need MDS version at least 2.10.56"; return 0; }
+
local mdts=$(comma_list $(mdts_nodes))
#define OBD_FAIL_TIME_IN_CHLOG_USER 0x1314
run_test 161c "check CL_RENME[UNLINK] changelog record flags"
test_161d() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
local pid
local fid
JOBENV=FAKE_JOBID
fi
fi
+LUSTRE_JOBID_SIZE=31 # plus NUL terminator
verify_jobstats() {
local cmd=($1)
[ "$JOBENV" = "FAKE_JOBID" ] &&
FAKE_JOBID=id.$testnum.$(basename ${cmd[0]}).$RANDOM
- JOBVAL=${!JOBENV}
+ JOBVAL=${!JOBENV:0:$LUSTRE_JOBID_SIZE}
[ "$JOBENV" = "nodelocal" ] && {
- FAKE_JOBID=id.$testnum.$(basename ${cmd[0]}).$RANDOM
+ FAKE_JOBID=id.$testnum.%e.$RANDOM
$LCTL set_param jobid_name=$FAKE_JOBID
- JOBVAL=$FAKE_JOBID
+ JOBVAL=${FAKE_JOBID/\%e/$(basename ${cmd[0]})}
}
log "Test: ${cmd[*]}"
- log "Using JobID environment variable $JOBENV=$JOBVAL"
+ log "Using JobID environment $($LCTL get_param -n jobid_var)=$JOBVAL"
if [ $JOBENV = "FAKE_JOBID" ]; then
FAKE_JOBID=$JOBVAL ${cmd[*]}
# all files are created on OST0000
for facet in $facets; do
local stats="*.$(convert_facet2label $facet).job_stats"
+
+ # strip out libtool wrappers for in-tree executables
if [ $(do_facet $facet lctl get_param $stats |
- grep -c $JOBVAL) -ne 1 ]; then
+ sed -e 's/\.lt-/./' | grep -c $JOBVAL) -ne 1 ]; then
do_facet $facet lctl get_param $stats
error "No jobstats for $JOBVAL found on $facet::$stats"
fi
[[ $JOBID_VAR = disable ]] && skip "jobstats is disabled" && return
local old_jobenv=$($LCTL get_param -n jobid_var)
- if [ $old_jobenv != $JOBENV ]; then
- jobstats_set $JOBENV
- stack_trap "do_facet mgs \
- $LCTL conf_param $FSNAME.sys.jobid_var=$old_jobenv" EXIT
- fi
+ [ $old_jobenv != $JOBENV ] && jobstats_set $JOBENV
+ stack_trap "do_facet mgs \
+ $LCTL conf_param $FSNAME.sys.jobid_var=$old_jobenv" EXIT
changelog_register
[ $jobids -eq 0 ] ||
error "Unexpected jobids when jobid_var=$JOBENV"
fi
+
+ lctl set_param jobid_var=USER jobid_name="S.%j.%e.%u.%h.E"
+ JOBENV="JOBCOMPLEX"
+ JOBCOMPLEX="S.$USER.touch.$(id -u).$(hostname).E"
+
+ verify_jobstats "touch $DIR/$tfile" $SINGLEMDS
}
run_test 205 "Verify job stats"
run_test 232a "failed lock should not block umount"
test_232b() {
+ [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.58) ] ||
+ { skip "Need MDS version at least 2.10.58"; return; }
mkdir -p $DIR/$tdir
$LFS setstripe -c1 -i0 $DIR/$tdir/$tfile
dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=1
#LU-4825
test_311() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.54) ] &&
skip "lustre < 2.8.54 does not contain LU-4825 fix" && return
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
run_test 313 "io should fail after last_rcvd update fail"
test_314() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+
$SETSTRIPE -c 2 -i 0 $DIR/$tfile || error "setstripe failed"
do_facet ost1 "$LCTL set_param fail_loc=0x720"
rm -f $DIR/$tfile
}
run_test 804 "verify agent entry for remote entry"
+cleanup_805() {
+ do_facet $SINGLEMDS zfs set quota=$old $fsset
+ unlinkmany $DIR/$tdir/f- 1000000
+ trap 0
+}
+
+test_805() {
+ local zfs_version=$(do_node $SINGLEMDS cat /sys/module/zfs/version)
+ [ "$(facet_fstype mds1)" != "zfs" ] &&
+ skip "ZFS specific test" && return
+ [ $(version_code $zfs_version) -lt $(version_code 0.7.2) ] &&
+ skip "netfree not implemented before 0.7" && return
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.57) ]] ||
+ { skip "Need MDS version at least 2.10.57" && return 0; }
+
+ local fsset
+ local freekb
+ local usedkb
+ local old
+ local quota
+ local pref="osd-zfs.lustre-MDT0000."
+
+ # limit available space on MDS dataset to meet nospace issue
+ # quickly. then ZFS 0.7.2 can use reserved space if asked
+ # properly (using netfree flag in osd_declare_destroy()
+ fsset=$(do_facet $SINGLEMDS lctl get_param -n $pref.mntdev)
+ old=$(do_facet $SINGLEMDS zfs get -H quota $fsset | \
+ gawk '{print $3}')
+ freekb=$(do_facet $SINGLEMDS lctl get_param -n $pref.kbytesfree)
+ usedkb=$(do_facet $SINGLEMDS lctl get_param -n $pref.kbytestotal)
+ let "usedkb=usedkb-freekb"
+ let "freekb=freekb/2"
+ if let "freekb > 5000"; then
+ let "freekb=5000"
+ fi
+ do_facet $SINGLEMDS zfs set quota=$(((usedkb+freekb)*1024)) $fsset
+ trap cleanup_805 EXIT
+ mkdir $DIR/$tdir
+ $LFS setstripe -E 1M -L mdt $DIR/$tdir || error "DoM not working"
+ createmany -m $DIR/$tdir/f- 1000000 && error "ENOSPC wasn't met"
+ rm -rf $DIR/$tdir || error "not able to remove"
+ do_facet $SINGLEMDS zfs set quota=$old $fsset
+ trap 0
+}
+run_test 805 "ZFS can remove from full fs"
+
#
# tests that do cleanup/setup should be run at the end
#