ALWAYS_EXCEPT=" 27u 42a 42b 42c 42d 45 51d 68b $SANITY_EXCEPT"
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+# with LOD/OSP landing
+# bug number for skipped tests: LU2036
+ALWAYS_EXCEPT=" 76 $ALWAYS_EXCEPT"
+
+
# Tests that fail on uml
CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
# buffer i/o errs sock spc runas
local i
local rc=0
+ [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.0) ] &&
+ [ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.2.93) ] &&
+ skip "MDS 2.2.0-2.2.93 do not NUL-terminate symlinks" && return
+
+ [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
+ skip "only for ldiskfs MDT" && return 0
+
mkdir -p $WDIR
long_sym=$short_sym
# create a long symlink file
[ "$OSTIDX" ] && list=$(facet_host ost$((OSTIDX + 1)))
do_nodes $list lctl set_param fail_loc=0
+ sync # initiate all OST_DESTROYs from MDS to OST
sleep_maxage
}
# this should be set to future
TEST_39_ATIME=`date -d "1 year" +%s`
+is_sles11() # LU-1783
+{
+ if [ -r /etc/SuSE-release ]
+ then
+ local vers=`grep VERSION /etc/SuSE-release | awk '{print $3}'`
+ local patchlev=`grep PATCHLEVEL /etc/SuSE-release \
+ | awk '{print $3}'`
+ if [ $vers -eq 11 ] && [ $patchlev -eq 1 ]
+ then
+ return 0
+ fi
+ fi
+ return 1
+}
+
test_39l() {
+ is_sles11 && skip "SLES 11 SP1" && return # LU-1783
remote_mds_nodsh && skip "remote MDS with nodsh" && return
local atime_diff=$(do_facet $SINGLEMDS lctl get_param -n mdd.*.atime_diff)
echo read-ahead disabled time read $time_ra_OFF
echo read-ahead enabled time read $time_ra_ON
- set_read_ahead $old_READAHEAD
- rm -f $file
+ set_read_ahead $old_READAHEAD
+ rm -f $file
+ wait_delete_completed
[ $time_ra_ON -lt $time_ra_OFF ] ||
error "read-ahead enabled time read (${time_ra_ON}s) is more than
cut -c11-20)
# don't return an error
- [ $OSTIO_post -eq $OSTIO_pre ] && echo \
- "WARNING: No new ll_ost_io threads were created ($OSTIO_pre)" &&\
- echo "This may be fine, depending on what ran before this test" &&\
+ [ $OSTIO_post == $OSTIO_pre ] && echo \
+ "WARNING: No new ll_ost_io threads were created ($OSTIO_pre)" &&
+ echo "This may be fine, depending on what ran before this test" &&
echo "and how fast this system is." && return
echo "Started with $OSTIO_pre threads, ended with $OSTIO_post"
}
run_test 118h "Verify timeout in handling recoverables errors =========="
+[ "$SLOW" = "no" ] && [ -n "$OLD_RESENDCOUNT" ] && set_resend_count $OLD_RESENDCOUNT
+
test_118i() {
remote_ost_nodsh && skip "remote OST with nodsh" && return
}
run_test 118i "Fix error before timeout in recoverable error =========="
+[ "$SLOW" = "no" ] && set_resend_count 4
+
test_118j() {
remote_ost_nodsh && skip "remote OST with nodsh" && return
}
test_130a() {
- filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
- [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return
+ local filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
+ [ -n "$filefrag_op" ] && skip_env "filefrag does not support FIEMAP" &&
+ return
trap cleanup_130 EXIT RETURN
local fm_file=$DIR/$tfile
$SETSTRIPE -S 65536 -c 1 $fm_file || error "setstripe on $fm_file"
- dd if=/dev/zero of=$fm_file bs=65536 count=1 || error "dd failed for $fm_file"
+ dd if=/dev/zero of=$fm_file bs=65536 count=1 ||
+ error "dd failed for $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"`
+ # LU-1795: test filefrag/FIEMAP once, even if unsupported
+ filefrag -ves $fm_file
+ RC=$?
+ [ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] &&
+ skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return
+ [ $RC != 0 ] && error "filefrag $fm_file failed"
+ filefrag_op=$(filefrag -ve $fm_file | grep -A 100 "ext:" |
+ grep -v "ext:" | grep -v "found")
lun=$($GETSTRIPE -i $fm_file)
start_blk=`echo $filefrag_op | cut -d: -f2 | cut -d. -f1`
run_test 130a "FIEMAP (1-stripe file)"
test_130b() {
- [ "$OSTCOUNT" -lt "2" ] && skip_env "skipping FIEMAP on 2-stripe file test" && return
+ [ "$OSTCOUNT" -lt "2" ] &&
+ skip_env "skipping FIEMAP on 2-stripe file test" && return
- filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
- [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return
+ local filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
+ [ -n "$filefrag_op" ] && skip_env "filefrag does not support FIEMAP" &&
+ return
trap cleanup_130 EXIT RETURN
local fm_file=$DIR/$tfile
$SETSTRIPE -S 65536 -c 2 $fm_file || error "setstripe on $fm_file"
- dd if=/dev/zero of=$fm_file bs=1M count=2 || error "dd failed 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=2 ||
+ 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`
+ last_lun=$(echo $filefrag_op | cut -d: -f5)
IFS=$'\n'
tot_len=0
run_test 130b "FIEMAP (2-stripe file)"
test_130c() {
- [ "$OSTCOUNT" -lt "2" ] && skip_env "skipping FIEMAP on 2-stripe file with hole test" && return
+ [ "$OSTCOUNT" -lt "2" ] &&
+ skip_env "skipping FIEMAP on 2-stripe file" && return
filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
- [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return
+ [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" &&
+ return
trap cleanup_130 EXIT RETURN
local fm_file=$DIR/$tfile
$SETSTRIPE -S 65536 -c 2 $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 seek=1 bs=1M count=1 || error "dd failed on $fm_file"
filefrag -ves $fm_file || error "filefrag $fm_file failed"
local fm_file=$DIR/$tfile
$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"
filefrag -ves $fm_file || error "filefrag $fm_file failed"
local fm_file=$DIR/$tfile
$SETSTRIPE -S 131072 -c 2 $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
+
NUM_BLKS=512
EXPECTED_LEN=$(( (NUM_BLKS / 2) * 64 ))
for ((i = 0; i < $NUM_BLKS; i++))
chmod 444 ${testdir}/${tfile} || error "chmod failed"
check_stats $SINGLEMDS "setattr" 1
do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
- ls -l ${testdir}/${tfile} > /dev/null|| error "ls failed"
- check_stats $SINGLEMDS "getattr" 1
+ if [ $(lustre_version_code $SINGLEMDS) -ne $(version_code 2.2.0) ]
+ then # LU-1740
+ ls -l ${testdir}/${tfile} > /dev/null|| error "ls failed"
+ check_stats $SINGLEMDS "getattr" 1
+ fi
$LFS df || error "lfs failed"
check_stats $SINGLEMDS "statfs" 1
$SETSTRIPE -c 1 -i 0 ${testdir}/${tfile}
sync
cancel_lru_locks osc
+ wait_delete_completed
# clear stats.
do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
check_stats ost "punch" 1
rm -f ${testdir}/${tfile} || error "file remove failed"
+ wait_delete_completed
check_stats ost "destroy" 1
rm -rf $DIR/${tdir}
run_test 153 "test if fdatasync does not crash ======================="
test_154() {
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
+ { skip "Need MDS version at least 2.2.51"; return 0; }
+
cp /etc/hosts $DIR/$tfile
fid=$($LFS path2fid $DIR/$tfile)
mrename $DIR/.lustre $DIR/.lustre/fid/$fid/.lustre &&
error "rename .lustre to itself should fail."
+ $OPENFILE -f O_LOV_DELAY_CREATE:O_CREAT $DIR/$tfile-2
+ fid=$($LFS path2fid $DIR/$tfile-2)
+ echo "cp /etc/passwd $DIR/.lustre/fid/$fid"
+ cp /etc/passwd $DIR/.lustre/fid/$fid &&
+ error "create lov data thru .lustre should fail."
+ echo "cp /etc/passwd $DIR/$tfile-2"
+ cp /etc/passwd $DIR/$tfile-2 || error "copy to $DIR/$tfile-2 failed."
+ echo "diff /etc/passwd $DIR/.lustre/fid/$fid"
+ diff /etc/passwd $DIR/.lustre/fid/$fid ||
+ error "diff /etc/passwd $DIR/.lustre/fid/$fid failed."
+
echo "Open-by-FID succeeded"
}
run_test 154 "Open-by-FID"
}
test_205() { # Job stats
+ [ -z "$(lctl get_param -n mdc.*.connect_flags | grep jobstats)" ] &&
+ skip "Server doesn't support jobstats" && return 0
+
local cmd
OLD_JOBENV=`$LCTL get_param -n jobid_var`
if [ $OLD_JOBENV != $JOBENV ]; then
run_test 227 "running truncated executable does not cause OOM"
# LU-1512 try to reuse idle OI blocks
-test_228() {
+test_228a() {
[ "$FSTYPE" != "ldiskfs" ] && skip "non-ldiskfs backend" && return
local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
[ $blk1 == $blk2 ] || error "old blk1=$blk1, new blk2=$blk2, unmatched!"
}
-run_test 228 "try to reuse idle OI blocks"
+run_test 228a "try to reuse idle OI blocks"
+
+test_228b() {
+ [ "$FSTYPE" != "ldiskfs" ] && skip "non-ldiskfs backend" && return
+
+ local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
+ local myDIR=$DIR/$tdir
+
+ mkdir -p $myDIR
+ #define OBD_FAIL_SEQ_EXHAUST 0x1002
+ $LCTL set_param fail_loc=0x80001002
+ createmany -o $myDIR/t- 10000
+ $LCTL set_param fail_loc=0
+ # The guard is current the largest FID holder
+ touch $myDIR/guard
+ local SEQ=$($LFS path2fid $myDIR/guard | awk -F ':' '{print $1}' |
+ tr -d '[')
+ local IDX=$(($SEQ % 64))
+
+ do_facet $SINGLEMDS sync
+ # Make sure journal flushed.
+ sleep 6
+ local blk1=$(do_facet $SINGLEMDS \
+ "$DEBUGFS -c -R \\\"stat oi.16.${IDX}\\\" $MDT_DEV" |
+ grep Blockcount | awk '{print $4}')
+
+ # Remove old files, some OI blocks will become idle.
+ unlinkmany $myDIR/t- 10000
+
+ # stop the MDT
+ stop $SINGLEMDS || error "Fail to stop MDT."
+ # remount the MDT
+ start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "Fail to start MDT."
+
+ df $MOUNT || error "Fail to df."
+ # Create new files, idle OI blocks should be reused.
+ createmany -o $myDIR/t- 2000
+ do_facet $SINGLEMDS sync
+ # Make sure journal flushed.
+ sleep 6
+ local blk2=$(do_facet $SINGLEMDS \
+ "$DEBUGFS -c -R \\\"stat oi.16.${IDX}\\\" $MDT_DEV" |
+ grep Blockcount | awk '{print $4}')
+
+ [ $blk1 == $blk2 ] || error "old blk1=$blk1, new blk2=$blk2, unmatched!"
+}
+run_test 228b "idle OI blocks can be reused after MDT restart"
+
+#LU-1881
+test_228c() {
+ [ "$FSTYPE" != "ldiskfs" ] && skip "non-ldiskfs backend" && return
+
+ local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
+ local myDIR=$DIR/$tdir
+
+ mkdir -p $myDIR
+ #define OBD_FAIL_SEQ_EXHAUST 0x1002
+ $LCTL set_param fail_loc=0x80001002
+ # 20000 files can guarantee there are index nodes in the OI file
+ createmany -o $myDIR/t- 20000
+ $LCTL set_param fail_loc=0
+ # The guard is current the largest FID holder
+ touch $myDIR/guard
+ local SEQ=$($LFS path2fid $myDIR/guard | awk -F ':' '{print $1}' |
+ tr -d '[')
+ local IDX=$(($SEQ % 64))
+
+ do_facet $SINGLEMDS sync
+ # Make sure journal flushed.
+ sleep 6
+ local blk1=$(do_facet $SINGLEMDS \
+ "$DEBUGFS -c -R \\\"stat oi.16.${IDX}\\\" $MDT_DEV" |
+ grep Blockcount | awk '{print $4}')
+
+ # Remove old files, some OI blocks will become idle.
+ unlinkmany $myDIR/t- 20000
+ rm -f $myDIR/guard
+ # The OI file should become empty now
+
+ # Create new files, idle OI blocks should be reused.
+ createmany -o $myDIR/t- 2000
+ do_facet $SINGLEMDS sync
+ # Make sure journal flushed.
+ sleep 6
+ local blk2=$(do_facet $SINGLEMDS \
+ "$DEBUGFS -c -R \\\"stat oi.16.${IDX}\\\" $MDT_DEV" |
+ grep Blockcount | awk '{print $4}')
+
+ [ $blk1 == $blk2 ] || error "old blk1=$blk1, new blk2=$blk2, unmatched!"
+}
+run_test 228c "NOT shrink the last entry in OI index node to recycle idle leaf"
#
# tests that do cleanup/setup should be run at the end