ONLY=${ONLY:-"$*"}
# bug number for skipped test: 9977/LU-7105
-ALWAYS_EXCEPT=" 28 $SANITYN_EXCEPT"
+# LU-7105
+ALWAYS_EXCEPT=" 28 $SANITYN_EXCEPT"
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
SRCDIR=$(dirname $0)
}
run_test 16b "$FSXNUM iterations of dual-mount fsx at small size"
+test_16c() {
+ local file1=$DIR1/$tfile
+ local file2=$DIR2/$tfile
+ local stripe_size=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
+
+ [ $(facet_fstype ost1) != ldiskfs ] && skip "dio on ldiskfs only"
+
+ # to allocate grant because it may run out due to test_15.
+ $LFS setstripe -c -1 $file1
+ dd if=/dev/zero of=$file1 bs=$stripe_size count=$OSTCOUNT oflag=sync
+ dd if=/dev/zero of=$file2 bs=$stripe_size count=$OSTCOUNT oflag=sync
+ rm -f $file1
+ wait_delete_completed
+
+ local list=$(comma_list $(osts_nodes))
+ if ! get_osd_param $list '' read_cache_enable >/dev/null; then
+ skip "not cache-capable obdfilter"
+ fi
+
+ set_osd_param $list '' read_cache_enable 0
+ set_osd_param $list '' writethrough_cache_enable 0
+
+ $LFS setstripe -c -1 $file1 # b=10919
+ fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 $file1 $file2 \
+ || error "fsx failed"
+ rm -f $file1
+
+ set_osd_param $list '' read_cache_enable 1
+ set_osd_param $list '' writethrough_cache_enable 1
+
+ return 0
+}
+run_test 16c "verify data consistency on ldiskfs with cache disabled (b=17397)"
+
+
test_17() { # bug 3513, 3667
remote_ost_nodsh && skip "remote OST with nodsh" && return
[ "x$DOM" = "xyes" ] && node=$(facet_active_host $SINGLEMDS)
# check whether obdfilter is cache capable at all
- if ! get_osd_param $node '' read_cache_enable >/dev/null; then
- echo "not cache-capable obdfilter"
- return 0
- fi
+ get_osd_param $node '' read_cache_enable >/dev/null ||
+ skip "not cache-capable obdfilter"
- local MAX=$(get_osd_param $node '' readcache_max_filesize | \
- head -n 1)
+ local MAX=$(get_osd_param $node '' readcache_max_filesize | head -n 1)
set_osd_param $node '' readcache_max_filesize 4096
dd if=/dev/urandom of=$TMP/$tfile bs=512k count=32
local SUM=$(cksum $TMP/$tfile | cut -d" " -f 1,2)
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
skip "DNE CoS not supported" && return
- sync
+ local sync_count
mkdir $DIR/$tdir
- # remote mkdir is done on MDT2, which enqueued lock of $tdir on MDT1
- $LFS mkdir -i 1 $DIR/$tdir/d1
+ sync_all_data
do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
- mkdir $DIR/$tdir/d2
- local sync_count=$(do_facet mds1 \
- "lctl get_param -n mdt.*MDT0000.sync_count")
- [ $sync_count -eq 1 ] || error "Sync-Lock-Cancel not triggered"
+ # do twice in case transaction is committed before unlock, see LU-8200
+ for i in 1 2; do
+ # remote dir is created on MDT1, which enqueued lock of $tdir on
+ # MDT0
+ $LFS mkdir -i 1 $DIR/$tdir/remote.$i
+ mkdir $DIR/$tdir/local.$i
+ done
+ sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count")
+ echo "sync_count $sync_count"
+ [ $sync_count -eq 0 ] && error "Sync-Lock-Cancel not triggered"
- $LFS mkdir -i 1 $DIR/$tdir/d3
+ sync_all_data
do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
+ $LFS mkdir -i 1 $DIR/$tdir/remote.3
# during sleep remote mkdir should have been committed and canceled
# remote lock spontaneously, which shouldn't trigger sync
sleep 6
- mkdir $DIR/$tdir/d4
- local sync_count=$(do_facet mds1 \
- "lctl get_param -n mdt.*MDT0000.sync_count")
+ mkdir $DIR/$tdir/local.3
+ sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count")
+ echo "sync_count $sync_count"
[ $sync_count -eq 0 ] || error "Sync-Lock-Cancel triggered"
}
run_test 33c "Cancel cross-MDT lock should trigger Sync-Lock-Cancel"
-ops_do_cos() {
+# arg1 is operations done before CoS, arg2 is the operation that triggers CoS
+op_trigger_cos() {
+ local commit_nr
+ local total=0
local nodes=$(comma_list $(mdts_nodes))
- do_nodes $nodes "lctl set_param -n mdt.*.async_commit_count=0"
- sh -c "$@"
- local async_commit_count=$(do_nodes $nodes \
- "lctl get_param -n mdt.*.async_commit_count" | calc_sum)
- [ $async_commit_count -gt 0 ] || error "CoS not triggerred"
- rm -rf $DIR/$tdir
- sync
+ sync_all_data
+
+ # trigger CoS twice in case transaction commit before unlock
+ for i in 1 2; do
+ sh -c "$1"
+ do_nodes $nodes "lctl set_param -n mdt.*.async_commit_count=0"
+ sh -c "$2"
+ commit_nr=$(do_nodes $nodes \
+ "lctl get_param -n mdt.*.async_commit_count" | calc_sum)
+ total=$((total + commit_nr));
+ rm -rf $DIR/$tdir
+ sync_all_data
+ done
+
+ echo "CoS count $total"
+ [ $total -gt 0 ] || error "$2 didn't trigger CoS"
}
test_33d() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
skip "DNE CoS not supported" && return
- sync
# remote directory create
- mkdir $DIR/$tdir
- ops_do_cos "$LFS mkdir -i 1 $DIR/$tdir/subdir"
+ op_trigger_cos "mkdir $DIR/$tdir" "$LFS mkdir -i 1 $DIR/$tdir/subdir"
# remote directory unlink
- $LFS mkdir -i 1 $DIR/$tdir
- ops_do_cos "rmdir $DIR/$tdir"
+ op_trigger_cos "$LFS mkdir -i 1 $DIR/$tdir" "rmdir $DIR/$tdir"
# striped directory create
- mkdir $DIR/$tdir
- ops_do_cos "$LFS mkdir -c 2 $DIR/$tdir/subdir"
+ op_trigger_cos "mkdir $DIR/$tdir" "$LFS mkdir -c 2 $DIR/$tdir/subdir"
# striped directory setattr
- $LFS mkdir -c 2 $DIR/$tdir
- touch $DIR/$tdir
- ops_do_cos "chmod 713 $DIR/$tdir"
+ op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; touch $DIR/$tdir" \
+ "chmod 713 $DIR/$tdir"
# striped directory unlink
- $LFS mkdir -c 2 $DIR/$tdir
- touch $DIR/$tdir
- ops_do_cos "rmdir $DIR/$tdir"
+ op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; touch $DIR/$tdir" \
+ "rmdir $DIR/$tdir"
# cross-MDT link
- $LFS mkdir -c 2 $DIR/$tdir
- $LFS mkdir -i 0 $DIR/$tdir/d1
- $LFS mkdir -i 1 $DIR/$tdir/d2
- touch $DIR/$tdir/d1/tgt
- ops_do_cos "ln $DIR/$tdir/d1/tgt $DIR/$tdir/d2/src"
+ op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; \
+ $LFS mkdir -i 0 $DIR/$tdir/d1; \
+ $LFS mkdir -i 1 $DIR/$tdir/d2; \
+ touch $DIR/$tdir/d1/tgt" \
+ "ln $DIR/$tdir/d1/tgt $DIR/$tdir/d2/src"
# cross-MDT rename
- $LFS mkdir -c 2 $DIR/$tdir
- $LFS mkdir -i 0 $DIR/$tdir/d1
- $LFS mkdir -i 1 $DIR/$tdir/d2
- touch $DIR/$tdir/d1/src
- ops_do_cos "mv $DIR/$tdir/d1/src $DIR/$tdir/d2/tgt"
+ op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; \
+ $LFS mkdir -i 0 $DIR/$tdir/d1; \
+ $LFS mkdir -i 1 $DIR/$tdir/d2; \
+ touch $DIR/$tdir/d1/src" \
+ "mv $DIR/$tdir/d1/src $DIR/$tdir/d2/tgt"
# migrate
- $LFS mkdir -i 0 $DIR/$tdir
- ops_do_cos "$LFS migrate -m 1 $DIR/$tdir"
+ op_trigger_cos "$LFS mkdir -i 0 $DIR/$tdir" \
+ "$LFS migrate -m 1 $DIR/$tdir"
+
return 0
}
run_test 33d "DNE distributed operation should trigger COS"
do_nodes $(comma_list $(osts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
for i in $(seq $OSTCOUNT); do
- wait_osc_import_state client ost$i FULL
+ wait_osc_import_ready client ost$i
done
}
[[ $rc -eq 3 ]] && skip "jobid_var not found" && return
[[ $rc -ne 0 ]] && error "failed to get param jobid_var"
if [ $saved_jobid_var != procname_uid ]; then
- set_conf_param_and_check client \
- "$LCTL get_param -n jobid_var" \
- "$FSNAME.sys.jobid_var" procname_uid
+ set_persistent_param_and_check client \
+ "jobid_var" "$FSNAME.sys.jobid_var" procname_uid
fi
local idis
local current_jobid_var=$($LCTL get_param -n jobid_var)
[[ $? -ne 0 ]] && error "failed to get param jobid_var"
if [ $saved_jobid_var != $current_jobid_var ]; then
- set_conf_param_and_check client \
- "$LCTL get_param -n jobid_var" \
- "$FSNAME.sys.jobid_var" $saved_jobid_var
+ set_persistent_param_and_check client \
+ "jobid_var" "$FSNAME.sys.jobid_var" $saved_jobid_var
fi
return 0
}
}
test_77ja(){
- if [ $(lustre_version_code ost1) -lt $(version_code 2.10.58) ]; then
- skip "need ost version at least 2.10.58"
+ if [ $(lustre_version_code ost1) -lt $(version_code 2.11.50) ]; then
+ skip "Need OST version at least 2.11.50"
return 0
fi
test_id "u" "500" "5" "-u 500"
}
run_test 77m "check NRS Delay slows write RPC processing"
+test_77n() { #LU-10802
+ if [ $(lustre_version_code ost1) -lt $(version_code 2.10.58) ]; then
+ skip "Need OST version at least 2.10.58"
+ return 0
+ fi
+
+ # Configure jobid_var
+ local saved_jobid_var=$($LCTL get_param -n jobid_var)
+ if [ $saved_jobid_var != procname_uid ]; then
+ set_persistent_param_and_check client \
+ "jobid_var" "$FSNAME.sys.jobid_var" procname_uid
+ fi
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ jobid" \
+ ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={*.$RUNAS_ID}\ rate=20"
+
+ nrs_write_read
+ tbf_verify 20 20 "$RUNAS"
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
+ ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={dd.*}\ rate=20"
+
+ nrs_write_read
+ tbf_verify 20 20
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
+ ost.OSS.ost_io.nrs_policies="fifo"
+
+ sleep 3
+
+ local current_jobid_var=$($LCTL get_param -n jobid_var)
+ if [ $saved_jobid_var != $current_jobid_var ]; then
+ set_persistent_param_and_check client \
+ "jobid_var" "$FSNAME.sys.jobid_var" $saved_jobid_var
+ fi
+}
+run_test 77n "check wildcard support for TBF JobID NRS policy"
+
test_78() { #LU-6673
local rc
error "setfattr -n trusted.name1=value1 $DIR/$tdir failed"
#define OBD_FAIL_MDS_INTENT_DELAY 0x160
- local mdtidx=$($LFS getstripe -M $DIR/$tdir)
+ local mdtidx=$($LFS getstripe -m $DIR/$tdir)
local facet=mds$((mdtidx + 1))
stat $DIR/$tdir
set_nodes_failloc $(facet_active_host $facet) 0x80000160
echo "Finish migration, then checking.."
for file in $(find $DIR1/$tdir); do
- mdt_index=$($LFS getstripe -M $file)
+ mdt_index=$($LFS getstripe -m $file)
[ $mdt_index == $MDTIDX ] ||
error "$file is not on MDT${MDTIDX}"
done
}
run_test 80b "Accessing directory during migration"
-test_81() {
+test_81a() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
rm -rf $DIR1/$tdir
return 0
}
-run_test 81 "rename and stat under striped directory"
+run_test 81a "rename and stat under striped directory"
+
+test_81b() {
+ [ $MDSCOUNT -lt 2 ] &&
+ skip "We need at least 2 MDTs for this test"
+
+ local total
+ local setattr_pid
+
+ total=1000
+
+ $LFS mkdir -c $MDSCOUNT $DIR1/$tdir || error "$LFS mkdir"
+ createmany -o $DIR1/$tdir/$tfile. $total || error "createmany"
+
+ (
+ while true; do
+ touch $DIR1/$tdir
+ done
+ ) &
+ setattr_pid=$!
+
+ for i in $(seq $total); do
+ mrename $DIR2/$tdir/$tfile.$i $DIR2/$tdir/$tfile-new.$i \
+ > /dev/null
+ done
+
+ kill -9 $setattr_pid
+}
+run_test 81b "rename under striped directory doesn't deadlock"
test_82() {
[[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.6.91) ]] ||
# to get layout
$CHECKSTAT -t file $DIR1/$tfile
- OLD_VAL=$(cat /proc/sys/vm/dirty_writeback_centisecs)
- echo 0 > /proc/sys/vm/dirty_writeback_centisecs
- echo $OLD_VAL
+ local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
+ sysctl -wq vm.dirty_writeback_centisecs=0
+
+ trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
# open + IO lock
dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 ||
error_noexit "Write fails"
# must discard pages
lctl set_param -n mdc.*.stats=clear
- rm $DIR2/$tfile || error_noexit "Unlink fails"
- local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l)
- echo $OLD_VAL > /proc/sys/vm/dirty_writeback_centisecs
+ rm $DIR2/$tfile || error "Unlink fails"
+ local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l)
[ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
}
run_test 101a "Discard DoM data on unlink"
# to get layout
$CHECKSTAT -t file $DIR1/$tfile
- OLD_VAL=$(cat /proc/sys/vm/dirty_writeback_centisecs)
- echo 0 > /proc/sys/vm/dirty_writeback_centisecs
- echo $OLD_VAL
+ local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
+ sysctl -wq vm.dirty_writeback_centisecs=0
+
+ trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
# open + IO lock
- dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 ||
- error_noexit "Write fails"
+ dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails"
# must discard pages
lctl set_param -n mdc.*.stats=clear
- mv $DIR2/${tfile}_2 $DIR2/$tfile || error_noexit "Rename fails"
+ mv $DIR2/${tfile}_2 $DIR2/$tfile || error "Rename fails"
+
local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l)
- echo $OLD_VAL > /proc/sys/vm/dirty_writeback_centisecs
[ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
}
run_test 101b "Discard DoM data on rename"
# to get layout
$CHECKSTAT -t file $DIR1/$tfile
- OLD_VAL=$(cat /proc/sys/vm/dirty_writeback_centisecs)
- echo 0 > /proc/sys/vm/dirty_writeback_centisecs
- echo $OLD_VAL
+ local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
+ sysctl -wq vm.dirty_writeback_centisecs=0
+
+ trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
# open + IO lock
- dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 ||
- error_noexit "Write fails"
+ dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails"
$MULTIOP $DIR1/$tfile O_c &
MULTIOP_PID=$!
sleep 1
lctl set_param -n mdc.*.stats=clear
- rm $DIR2/$tfile > /dev/null || error_noexit "Unlink fails"
- kill -USR1 $MULTIOP_PID && wait $MULTIOP_PID ||
- error_noexit "multiop failure"
+ rm $DIR2/$tfile > /dev/null || error "Unlink fails for opened file"
+ kill -USR1 $MULTIOP_PID && wait $MULTIOP_PID || error "multiop failure"
+
local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l)
- echo $OLD_VAL > /proc/sys/vm/dirty_writeback_centisecs
[ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
}
run_test 101c "Discard DoM data on close-unlink"