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)
}
test_32a() { # bug 11270
- local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+ local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
local stripe_size=$(do_facet $SINGLEMDS \
"$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
- save_lustre_params client "$OSC.*.lockless_truncate" > $p
+ save_lustre_params client "$OSC.*.lockless_truncate" > $save
+ # restore lockless_truncate default values on exit
+ stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
cancel_lru_locks $OSC
enable_lockless_truncate 1
rm -f $DIR1/$tfile
$CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
[ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -eq 0 ] ||
error "lockless truncate disabling failed"
- rm $DIR1/$tfile
- # restore lockless_truncate default values
- restore_lustre_params < $p
- rm -f $p
+ rm -f $DIR1/$tfile
}
run_test 32a "lockless truncate"
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
}
test_47g() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ sync
+ sync_all_data
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
$LFS mkdir -i 1 $DIR1/$tfile &
PID1=$!
- sleep 1
+ sleep 2
stat $DIR2/$tfile > /dev/null || error "stat must succeed"
check_pdo_conflict $PID1 && { wait $PID1;
error "getattr isn't blocked"; }
{ skip "checkfiemap not runnable: $?" && return; }
# write data this way: hole - data - hole - data
dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
- [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR1/$tfile) + 1)))" = \
+ [ "$(facet_fstype ost$(($($LFS getstripe -i $DIR1/$tfile) + 1)))" = \
"zfs" ] &&
skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
$LFS setstripe -c -1 $DIR1/$tdir || error "setstripe failed"
dd if=/dev/urandom of=$DIR1/$tdir/$tfile bs=40K count=1
- [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR1/$tdir/$tfile) + 1)))" = \
+ [ "$(facet_fstype ost$(($($LFS getstripe -i $DIR1/$tdir/$tfile) + 1)))" = \
"zfs" ] &&
skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
checkfiemap $DIR1/$tdir/$tfile 40960 || error "checkfiemap failed"
chmod 777 $dir
do_nodes $CLIENTS $myRUNAS \
- dd if=/dev/zero of="$dir/nrs_r_$HOSTNAME" bs=1M count=$n ||
+ dd if=/dev/zero of="$dir/nrs_r_\$HOSTNAME" bs=1M count=$n ||
error "dd at 0 on client failed (1)"
- for ((i = 0; i < $n; i++)); do
- do_nodes $CLIENTS $myRUNAS dd if=/dev/zero \
- of="$dir/nrs_w_$HOSTNAME" bs=1M seek=$i count=1 ||
- error "dd at ${i}MB on client failed (2)" &
- local pids_w[$i]=$!
- done
+ do_nodes $CLIENTS $myRUNAS \
+ "declare -a pids_w;
+ for ((i = 0; i < $n; i++)); do
+ dd if=/dev/zero of=$dir/nrs_w_\$HOSTNAME bs=1M \
+seek=\\\$i count=1 conv=notrunc &
+ pids_w[\\\$i]=\\\$!;
+ done;
+ rc_w=0;
+ for ((i = 0; i < $n; i++)); do
+ wait \\\${pids_w[\\\$i]};
+ newrc=\\\$?;
+ [ \\\$newrc -gt \\\$rc_w ] && rc_w=\\\$newrc;
+ done;
+ exit \\\$rc_w" &
+ local pid_w=$!
do_nodes $CLIENTS sync;
cancel_lru_locks osc
- for ((i = 0; i < $n; i++)); do
- do_nodes $CLIENTS $myRUNAS dd if="$dir/nrs_w_$HOSTNAME" \
- of=/dev/zero bs=1M seek=$i count=1 > /dev/null ||
- error "dd at ${i}MB on client failed (3)" &
- local pids_r[$i]=$!
- done
+ do_nodes $CLIENTS $myRUNAS \
+ "declare -a pids_r;
+ for ((i = 0; i < $n; i++)); do
+ dd if=$dir/nrs_r_\$HOSTNAME bs=1M of=/dev/null \
+seek=\\\$i count=1 &
+ pids_r[\\\$i]=\\\$!;
+ done;
+ rc_r=0;
+ for ((i = 0; i < $n; i++)); do
+ wait \\\${pids_r[\\\$i]};
+ newrc=\\\$?;
+ [ \\\$newrc -gt \\\$rc_r ] && rc_r=\\\$newrc;
+ done;
+ exit \\\$rc_r" &
+ local pid_r=$!
cancel_lru_locks osc
- for ((i = 0; i < $n; i++)); do
- wait ${pids_w[$i]}
- wait ${pids_r[$i]}
- done
- rm -rf $dir || error "rm -rf $dir failed"
+ wait $pid_w || error "dd (write) failed (2)"
+ wait $pid_r || error "dd (read) failed (3)"
+ rm -rvf $dir || error "rm -rf $dir failed"
}
test_77a() { #LU-3266
[[ $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"
# Configure jobid_var
local saved_jobid_var=$($LCTL get_param -n 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
do_nodes $(comma_list $(osts_nodes)) \
local current_jobid_var=$($LCTL get_param -n 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
}
run_test 77n "check wildcard support for TBF JobID NRS policy"
}
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) ]] ||
#define OBD_FAIL_MDS_LOV_CREATE_RACE 0x163
do_facet $SINGLEMDS "lctl set_param fail_loc=0x00000163"
- $SETSTRIPE -c -1 $DIR1/$tfile-1/file1 &
+ $LFS setstripe -c -1 $DIR1/$tfile-1/file1 &
local PID1=$!
sleep 1
- $SETSTRIPE -c -1 $DIR2/$tfile-2/file2 &
+ $LFS setstripe -c -1 $DIR2/$tfile-2/file2 &
local PID2=$!
wait $PID2
wait $PID1
do_facet $SINGLEMDS "lctl set_param -n \
'lod.lustre-MDT*/qos_threshold_rr' $old_rr"
- $GETSTRIPE $DIR1/$tfile-1/file1
- rc1=$($GETSTRIPE -q $DIR1/$tfile-1/file1 |
+ $LFS getstripe $DIR1/$tfile-1/file1
+ rc1=$($LFS getstripe -q $DIR1/$tfile-1/file1 |
awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
- $GETSTRIPE $DIR2/$tfile-2/file2
- rc2=$($GETSTRIPE -q $DIR2/$tfile-2/file2 |
+ $LFS getstripe $DIR2/$tfile-2/file2
+ rc2=$($LFS getstripe -q $DIR2/$tfile-2/file2 |
awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
echo "rc1=$rc1 and rc2=$rc2 "
[ $rc1 -eq 0 ] && [ $rc2 -eq 0 ] ||
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #1"
# first stat from server should return size data and save glimpse
- local gls=$(lctl get_param -n mdc.*.stats | \
- awk '/ldlm_glimpse/ {print $2}')
- [ -z $gls ] || error "Unexpected $gls glimpse RPCs"
+ local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
+ [ $gls -eq 0 ] || error "Unexpected $gls glimpse RPCs"
# second stat to check size is NOT cached on client without IO lock
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
- local gls=$(lctl get_param -n mdc.*.stats | grep ldlm_glimpse | wc -l)
- [ "1" == "$gls" ] || error "Expect 1 glimpse RPCs but got $gls"
+ local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
+ [ $gls -ge 1 ] || error "Expect glimpse RPCs but none"
rm -f $dom
}
run_test 100a "DoM: glimpse RPCs for stat without IO lock (DoM only file)"
# second stat to check size is cached on client
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
- local gls=$(lctl get_param -n mdc.*.stats |
- awk '/ldlm_glimpse/ {print $2}')
+ local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
# both stats should cause no glimpse requests
- [ -z $gls ] || error "Unexpected $gls glimpse RPCs"
+ [ $gls == 0 ] || error "Unexpected $gls glimpse RPCs"
rm -f $dom
}
run_test 100b "DoM: no glimpse RPC for stat with IO lock (DoM only file)"
$CHECKSTAT -t file -s 2097152 $DIR/$tdir/dom ||
error "Wrong size from stat #1"
- local gls=$(lctl get_param -n osc.*.stats | grep ldlm_glimpse | wc -l)
+ local gls=$(lctl get_param -n osc.*.stats | grep -c ldlm_glimpse)
[ $gls -eq 0 ] && error "Expect OST glimpse RPCs but got none"
rm -f $dom
$CHECKSTAT -t file -s 4096 $DIR/$tdir/dom ||
error "Wrong size from stat #1"
- local gls=$(lctl get_param -n osc.*.stats | grep ldlm_glimpse | wc -l)
+ local gls=$(lctl get_param -n osc.*.stats | grep -c ldlm_glimpse)
[ $gls -eq 0 ] && error "Expect OST glimpse but got none"
rm -f $dom
# 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 -c ost_write)
[ $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"
- local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l)
- echo $OLD_VAL > /proc/sys/vm/dirty_writeback_centisecs
+ mv $DIR2/${tfile}_2 $DIR2/$tfile || error "Rename fails"
+
+ local writes=$(lctl get_param -n mdc.*.stats | grep -c ost_write)
[ $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"
- 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 > /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 -c ost_write)
[ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
}
run_test 101c "Discard DoM data on close-unlink"
+# test to verify file handle related system calls
+# (name_to_handle_at/open_by_handle_at)
+# The new system calls are supported in glibc >= 2.14.
+
+# test to verify we can open by handle an unlinked file from > 1 client
+# This test opens the file normally on $DIR1, which is on one mount, and then
+# opens it by handle on $DIR2, which is on a different mount.
+test_102() {
+ echo "Test file_handle syscalls" > $DIR/$tfile ||
+ error "write failed"
+ check_fhandle_syscalls $DIR/$tfile $DIR2 ||
+ error "check_fhandle_syscalls failed"
+ rm -f $DIR2/$tfile
+}
+run_test 102 "Test open by handle of unlinked file"
+
log "cleanup: ======================================================"
# kill and wait in each test only guarentee script finish, but command in script