run_test 11 "execution of file opened for write should return error ===="
test_12() {
- DIR=$DIR DIR2=$DIR2 sh lockorder.sh
+ DIR=$DIR DIR2=$DIR2 bash lockorder.sh
}
run_test 12 "test lock ordering (link, stat, unlink)"
test_15() { # bug 974 - ENOSPC
echo "PATH=$PATH"
- sh oos2.sh $MOUNT1 $MOUNT2
+ bash oos2.sh $MOUNT1 $MOUNT2
wait_delete_completed
grant_error=$(dmesg | grep "< tot_grant")
[ -z "$grant_error" ] || error "$grant_error"
test_19() { # bug3811
local node=$(facet_active_host ost1)
+ local device="$FSNAME-OST*"
- [ "x$DOM" = "xyes" ] && node=$(facet_active_host $SINGLEMDS)
+ [ "x$DOM" = "xyes" ] && node=$(facet_active_host $SINGLEMDS) &&
+ device="$FSNAME-MDT*"
# check whether obdfilter is cache capable at all
- get_osd_param $node '' read_cache_enable >/dev/null ||
+ get_osd_param $node $device read_cache_enable >/dev/null ||
skip "not cache-capable obdfilter"
- local MAX=$(get_osd_param $node '' readcache_max_filesize | head -n 1)
- set_osd_param $node '' readcache_max_filesize 4096
+ local max=$(get_osd_param $node $device readcache_max_filesize |\
+ head -n 1)
+ set_osd_param $node $device 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)
cp $TMP/$tfile $DIR1/$tfile
[ "$(cat $TMP/sum2)" = "$SUM" ] || \
error "$DIR2/$tfile $(cat $TMP/sum2) != $SUM"
done
- set_osd_param $node '' readcache_max_filesize $MAX
+ set_osd_param $node $device readcache_max_filesize $max
rm $DIR1/$tfile
}
run_test 19 "test concurrent uncached read races ==============="
test_30() { #b=11110, LU-2523
test_mkdir $DIR1/$tdir
cp -f /bin/bash $DIR1/$tdir/bash
- /bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash; cp /bin/bash $DIR2/$tdir' &
+ bash -c 'sleep 1; rm -f $DIR2/$tdir/bash; cp /bin/bash $DIR2/$tdir' &
$DIR1/$tdir/bash -c 'sleep 2;
openfile -f O_RDONLY /proc/$$/exe >& /dev/null; echo $?'
wait
}
run_test 31b "voluntary OST cancel / blocking ast race=============="
-# enable/disable lockless truncate feature, depending on the arg 0/1
-enable_lockless_truncate() {
- lctl set_param -n $OSC.*.lockless_truncate $1
-}
+#LU-14949 - multi-client version of the test 31r in sanity.
+test_31r() {
+ touch $DIR/$tfile.target
+ touch $DIR/$tfile.source
-test_32a() { # bug 11270
- local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
- local stripe_size=$(do_facet $SINGLEMDS \
- "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
+ ls -l $DIR/$tfile.target # cache it for sure
- 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
- lfs setstripe -c -1 $DIR1/$tfile
- dd if=/dev/zero of=$DIR1/$tfile count=$OSTCOUNT bs=$stripe_size > \
- /dev/null 2>&1
- clear_stats $OSC.*.${OSC}_stats
+ #OBD_FAIL_LLITE_OPEN_DELAY 0x1419
+ $LCTL set_param fail_loc=0x1419 fail_val=3
+ cat $DIR/$tfile.target &
+ CATPID=$!
- log "checking cached lockless truncate"
- $TRUNCATE $DIR1/$tfile 8000000
- $CHECKSTAT -s 8000000 $DIR2/$tfile ||
- error "cached truncate - wrong file size"
- [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
- error "cached truncate isn't lockless"
-
- log "checking not cached lockless truncate"
- $TRUNCATE $DIR2/$tfile 5000000
- $CHECKSTAT -s 5000000 $DIR1/$tfile ||
- error "not cached truncate - wrong file size"
- [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
- error "not cached truncate isn't lockless"
-
- log "disabled lockless truncate"
- enable_lockless_truncate 0
- clear_stats $OSC.*.${OSC}_stats
- $TRUNCATE $DIR2/$tfile 3000000
- $CHECKSTAT -s 3000000 $DIR1/$tfile ||
- error "lockless truncate disabled - wrong file size"
- [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -eq 0 ] ||
- error "lockless truncate disabling failed"
- rm -f $DIR1/$tfile
+ # Guarantee open is waiting before we get here
+ sleep 1
+ mv $DIR2/$tfile.source $DIR2/$tfile.target
+
+ wait $CATPID
+ RC=$?
+ if [[ $RC -ne 0 ]]; then
+ error "open with cat failed, rc=$RC"
+ fi
}
-run_test 32a "lockless truncate"
+run_test 31r "open-rename(replace) race"
test_32b() { # bug 11270
remote_ost_nodsh && skip "remote OST with nodsh" && return
restore_lustre_params <$p
rm -f $p
}
-run_test 32b "lockless i/o"
+# Disable test 32b prior to full removal
+#run_test 32b "lockless i/o"
print_jbd_stat () {
- local dev
- local mdts=$(get_facets MDS)
- local varcvs
- local mds
-
- local stat=0
- for mds in ${mdts//,/ }; do
- varsvc=${mds}_svc
- dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
- xargs readlink -f" ))
- val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null |
- head -n1")
- val=${val%% *};
- stat=$(( stat + val))
- done
- echo $stat
+ local mdts=$(get_facets MDS)
+ local stat=0
+ local varsvc
+ local dev
+ local mds
+
+ for mds in ${mdts//,/ }; do
+ varsvc=${mds}_svc
+
+ dev=$(basename $(do_facet $mds "lctl get_param -n \
+ osd*.${!varsvc}.mntdev | xargs readlink -f"))
+ val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info \
+ 2>/dev/null | head -n1")
+ val=${val%% *};
+ stat=$((stat + val))
+ done
+ echo $stat
}
# commit on sharing tests
local sync_count
- mkdir $DIR/$tdir
+ mkdir_on_mdt0 $DIR/$tdir
sync_all_data
do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
# do twice in case transaction is committed before unlock, see LU-8200
# trigger CoS twice in case transaction commit before unlock
for i in 1 2; do
- sh -c "$1"
+ bash -c "$1"
do_nodes $nodes "lctl set_param -n mdt.*.async_commit_count=0"
- sh -c "$2"
+ bash -c "$2"
commit_nr=$(do_nodes $nodes \
"lctl get_param -n mdt.*.async_commit_count" | calc_sum)
total=$((total + commit_nr));
skip "DNE CoS not supported"
# remote directory create
- op_trigger_cos "mkdir $DIR/$tdir" "$LFS mkdir -i 1 $DIR/$tdir/subdir"
+ op_trigger_cos "$LFS mkdir -i 0 $DIR/$tdir" "$LFS mkdir -i 1 $DIR/$tdir/subdir"
# remote directory unlink
op_trigger_cos "$LFS mkdir -i 1 $DIR/$tdir" "rmdir $DIR/$tdir"
# striped directory create
# test 40: check non-blocking operations
test_40a() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+ mkdir_on_mdt0 $DIR2/$tdir
pdo_lru_clear
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0x80000145 2>/dev/null || true"
- touch $DIR2
- mkdir $DIR1/$tfile &
+ mkdir $DIR1/$tdir/$tfile &
PID1=$!; pdo_sched
- touch $DIR2/$tfile-2
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
- mkdir $DIR2/$tfile-3
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
- link $DIR2/$tfile-2 $DIR2/$tfile-4
+ link $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-4
check_pdo_conflict $PID1 || error "link is blocked"
- mv $DIR2/$tfile-2 $DIR2/$tfile-5
+ mv $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-5
check_pdo_conflict $PID1 || error "rename is blocked"
- stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
+ stat $DIR2/$tdir/$tfile-3 $DIR2/$tdir/$tfile-4 > /dev/null
check_pdo_conflict $PID1 || error "getattr is blocked"
- rm $DIR2/$tfile-4 $DIR2/$tfile-5
- rmdir $DIR2/$tfile-3
+ rm $DIR2/$tdir/$tfile-4 $DIR2/$tdir/$tfile-5
+ rmdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "unlink is blocked"
# all operations above shouldn't wait the first one
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
- rm -rf $DIR/$tfile*
+ rm -rf $DIR/$tdir
return 0
}
run_test 40a "pdirops: create vs others =============="
test_40b() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+ mkdir_on_mdt0 $DIR2/$tdir
pdo_lru_clear
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0x80000145 2>/dev/null || true"
- touch $DIR1/$tfile &
+ touch $DIR1/$tdir/$tfile &
PID1=$!; pdo_sched
# open|create
- touch $DIR2/$tfile-2
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
- mkdir $DIR2/$tfile-3
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
- link $DIR2/$tfile-2 $DIR2/$tfile-4
+ link $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-4
check_pdo_conflict $PID1 || error "link is blocked"
- mv $DIR2/$tfile-2 $DIR2/$tfile-5
+ mv $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-5
check_pdo_conflict $PID1 || error "rename is blocked"
- stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
+ stat $DIR2/$tdir/$tfile-3 $DIR2/$tdir/$tfile-4 > /dev/null
check_pdo_conflict $PID1 || error "getattr is blocked"
- rm $DIR2/$tfile-4 $DIR2/$tfile-5
- rmdir $DIR2/$tfile-3
+ rm $DIR2/$tdir/$tfile-4 $DIR2/$tdir/$tfile-5
+ rmdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "unlink is blocked"
# all operations above shouldn't wait the first one
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
- rm -rf $DIR/$tfile*
+ rm -rf $DIR/$tdir
return 0
}
run_test 40b "pdirops: open|create and others =============="
test_40c() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+ mkdir_on_mdt0 $DIR2/$tdir
pdo_lru_clear
- touch $DIR1/$tfile
+ touch $DIR1/$tdir/$tfile
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0x80000145 2>/dev/null || true"
- link $DIR1/$tfile $DIR1/$tfile-0 &
+ link $DIR1/$tdir/$tfile $DIR1/$tdir/$tfile-0 &
PID1=$!; pdo_sched
# open|create
- touch $DIR2/$tfile-2
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
- mkdir $DIR2/$tfile-3
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
- link $DIR2/$tfile-2 $DIR2/$tfile-4
+ link $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-4
check_pdo_conflict $PID1 || error "link is blocked"
- mv $DIR2/$tfile-2 $DIR2/$tfile-5
+ mv $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-5
check_pdo_conflict $PID1 || error "rename is blocked"
- stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
+ stat $DIR2/$tdir/$tfile-3 $DIR2/$tdir/$tfile-4 > /dev/null
check_pdo_conflict $PID1 || error "getattr is blocked"
- rm $DIR2/$tfile-4 $DIR2/$tfile-5
- rmdir $DIR2/$tfile-3
+ rm $DIR2/$tdir/$tfile-4 $DIR2/$tdir/$tfile-5
+ rmdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "unlink is blocked"
# all operations above shouldn't wait the first one
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
- rm -rf $DIR/$tfile*
+ rm -rf $DIR/$tdir
return 0
}
run_test 40c "pdirops: link and others =============="
test_40d() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+ mkdir_on_mdt0 $DIR2/$tdir
pdo_lru_clear
- touch $DIR1/$tfile
+ touch $DIR1/$tdir/$tfile
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0x80000145 2>/dev/null || true"
- rm $DIR1/$tfile &
+ rm $DIR1/$tdir/$tfile &
PID1=$!; pdo_sched
# open|create
- touch $DIR2/$tfile-2
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
- mkdir $DIR2/$tfile-3
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
- link $DIR2/$tfile-2 $DIR2/$tfile-4
+ link $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-4
check_pdo_conflict $PID1 || error "link is blocked"
- mv $DIR2/$tfile-2 $DIR2/$tfile-5
+ mv $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-5
check_pdo_conflict $PID1 || error "rename is blocked"
- stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
+ stat $DIR2/$tdir/$tfile-3 $DIR2/$tdir/$tfile-4 > /dev/null
check_pdo_conflict $PID1 || error "getattr is blocked"
- rm $DIR2/$tfile-4 $DIR2/$tfile-5
- rmdir $DIR2/$tfile-3
+ rm $DIR2/$tdir/$tfile-4 $DIR2/$tdir/$tfile-5
+ rmdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "unlink is blocked"
# all operations above shouldn't wait the first one
test_40e() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+ mkdir_on_mdt0 $DIR2/$tdir
pdo_lru_clear
- touch $DIR1/$tfile
+ touch $DIR1/$tdir/$tfile
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0x80000145 2>/dev/null || true"
- mv $DIR1/$tfile $DIR1/$tfile-0 &
+ mv $DIR1/$tdir/$tfile $DIR1/$tdir/$tfile-0 &
PID1=$!; pdo_sched
# open|create
- touch $DIR2/$tfile-2
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
- mkdir $DIR2/$tfile-3
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
- link $DIR2/$tfile-2 $DIR2/$tfile-4
+ link $DIR2/$tdir/$tfile-2 $DIR2/$tdir/$tfile-4
check_pdo_conflict $PID1 || error "link is blocked"
- stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
+ stat $DIR2/$tdir/$tfile-3 $DIR2/$tdir/$tfile-4 > /dev/null
check_pdo_conflict $PID1 || error "getattr is blocked"
- rm $DIR2/$tfile-4 $DIR2/$tfile-2
- rmdir $DIR2/$tfile-3
+ rm $DIR2/$tdir/$tfile-4 $DIR2/$tdir/$tfile-2
+ rmdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "unlink is blocked"
# all operations above shouldn't wait the first one
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
- rm -rf $DIR/$tfile*
+ rm -rf $DIR/$tdir
return 0
}
run_test 40e "pdirops: rename and others =============="
run_test 42f "pdirops: mkdir and rename (src) =============="
test_42g() {
+ mkdir_on_mdt0 $DIR1/$tdir
pdo_lru_clear
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0x80000145 2>/dev/null || true"
- mkdir $DIR1/$tfile &
+ mkdir $DIR1/$tdir/$tfile &
PID1=$! ; pdo_sched
- stat $DIR2/$tfile > /dev/null &
+ stat $DIR2/$tdir/$tfile > /dev/null &
PID2=$! ; pdo_sched
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
wait $PID2 ; [ $? -eq 0 ] || error "stat must succeed"
- rm -rf $DIR/$tfile*
- return 0
+ rm -rf $DIR/$tdir
}
run_test 42g "pdirops: mkdir vs getattr =============="
[[ $MDS1_VERSION -lt $(version_code 2.13.52) ]] &&
skip "Need MDS version newer than 2.13.52"
+ mkdir_on_mdt0 $DIR1/$tdir
for i in {1..100}; do
#define OBD_FAIL_ONCE|OBD_FAIL_MDS_CREATE_RACE 0x167
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0x80000167 2>/dev/null ||
true"
OK=0
- mkdir $DIR1/$tdir &
+ mkdir $DIR1/$tdir/sub &
PID1=$!
- mkdir $DIR2/$tdir && ((OK++))
+ mkdir $DIR2/$tdir/sub && ((OK++))
wait $PID1 && ((OK++))
(( OK == 1 )) || error "exactly one mkdir should succeed"
- rmdir $DIR1/$tdir || error "rmdir failed"
+ rmdir $DIR1/$tdir/sub || error "rmdir failed"
done
return 0
}
run_test 51a "layout lock: refresh layout should work"
test_51b() {
- [[ "$MDS1_VERSION" -ge $(version_code 2.3.59) ]] ||
+ (( $MDS1_VERSION >= $(version_code 2.3.59) )) ||
skip "Need MDS version at least 2.3.59"
local tmpfile=`mktemp`
- $LFS setstripe -E 1M -c 1 -E -1 --extension-size 64M $DIR1/$tfile ||
+ $LFS setstripe -E 1m -S 1M -c 1 -E -1 -c 1 $DIR1/$tfile ||
error "Create $DIR1/$tfile failed"
dd if=/dev/zero of=$DIR1/$tfile bs=1k count=1 conv=notrunc ||
run_test 51d "layout lock: losing layout lock should clean up memory map region"
test_51e() {
+ (( $MDS1_VERSION >= $(version_code 2.13.54.148) )) ||
+ skip "MDS version must be at least 2.13.54.148"
+
local pid
$MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:eW_E+eUc &
run_test 54 "rename locking"
test_55a() {
- mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
+ mkdir_on_mdt0 $DIR/$tdir
+ mkdir -p $DIR/$tdir/d1/d2 $DIR/$tdir/d3 || error "(1) mkdir failed"
#define OBD_FAIL_MDS_RENAME4 0x156
do_facet mds1 $LCTL set_param fail_loc=0x80000156
- mv -T $DIR/d1/d2 $DIR/d3/d2 &
+ mv -T $DIR/$tdir/d1/d2 $DIR/$tdir/d3/d2 &
PID1=$!
sleep 1
- rm -r $DIR2/d3
+ rm -r $DIR2/$tdir/d3
wait $PID1 && error "(2) mv succeeded"
- rm -rf $DIR/d1
+ rm -rf $DIR/$tdir
}
run_test 55a "rename vs unlink target dir"
test_55b()
{
- mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
+ mkdir_on_mdt0 $DIR/$tdir
+ mkdir -p $DIR/$tdir/d1/d2 $DIR/$tdir/d3 || error "(1) mkdir failed"
#define OBD_FAIL_MDS_RENAME4 0x156
do_facet mds1 $LCTL set_param fail_loc=0x80000156
- mv -T $DIR/d1/d2 $DIR/d3/d2 &
+ mv -T $DIR/$tdir/d1/d2 $DIR/$tdir/d3/d2 &
PID1=$!
sleep 1
- rm -r $DIR2/d1
+ rm -r $DIR2/$tdir/d1
wait $PID1 && error "(2) mv succeeded"
- rm -rf $DIR/d3
+ rm -rf $DIR/$tdir
}
run_test 55b "rename vs unlink source dir"
test_55c()
{
- mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
+ mkdir_on_mdt0 $DIR/$tdir
+ mkdir -p $DIR/$tdir/d1/d2 $DIR/$tdir/d3 || error "(1) mkdir failed"
#define OBD_FAIL_MDS_RENAME4 0x156
do_facet mds1 $LCTL set_param fail_loc=0x156
- mv -T $DIR/d1/d2 $DIR/d3/d2 &
+ mv -T $DIR/$tdir/d1/d2 $DIR/$tdir/d3/d2 &
PID1=$!
sleep 1
# while rename is sleeping, open and remove d3
- $MULTIOP $DIR2/d3 D_c &
+ $MULTIOP $DIR2/$tdir/d3 D_c &
PID2=$!
sleep 1
- rm -rf $DIR2/d3
+ rm -rf $DIR2/$tdir/d3
sleep 5
# while rename is sleeping 2nd time, close d3
wait $PID1 && error "(2) mv succeeded"
- rm -rf $DIR/d1
+ rm -rf $DIR/$tdir
}
run_test 55c "rename vs unlink orphan target dir"
test_55d()
{
- touch $DIR/f1
+ mkdir_on_mdt0 $DIR/$tdir
+
+ touch $DIR/$tdir/f1
#define OBD_FAIL_MDS_RENAME3 0x155
do_facet mds1 $LCTL set_param fail_loc=0x155
- mv $DIR/f1 $DIR/$tdir &
+ mv $DIR/$tdir/f1 $DIR/$tdir/$tdir &
PID1=$!
sleep 2
# while rename is sleeping, create $tdir, but as a directory
- mkdir -p $DIR2/$tdir || error "(1) mkdir failed"
+ mkdir -p $DIR2/$tdir/$tdir || error "(1) mkdir failed"
# link in reverse locking order
- ln $DIR2/f1 $DIR2/$tdir/
+ ln $DIR2/$tdir/f1 $DIR2/$tdir/$tdir/
wait $PID1 && error "(2) mv succeeded"
- rm -rf $DIR/f1
+ rm -rf $DIR/$tdir
}
run_test 55d "rename file vs link"
}
run_test 77n "check wildcard support for TBF JobID NRS policy"
+test_77o() {
+ (( $OST1_VERSION > $(version_code 2.14.54) )) ||
+ skip "need OST > 2.14.54"
+
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_policies="tbf\ nid"
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="start\ name\ nid={192.168.*.*@tcp}\ rate=10000"
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="start\ name1\ nid={192.168.*.*@tcp}\ rate=10000"
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="change\ name1\ rank=name"
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="stop\ name"
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_policies="fifo"
+}
+run_test 77o "Changing rank should not panic"
+
+test_77q() {
+ local i
+
+ (( $MDS1_VERSION > $(version_code 2.14.54) )) ||
+ skip "need MDS >= 2.14.54"
+
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_policies="tbf"
+ stack_trap "do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_policies=fifo"
+
+ for i in {1..50}; do
+ local pid1 pid2
+
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="'start rule77q_1 uid={500}&gid={500} rate=100'" &
+ pid1=$!
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="'start rule77q_2 uid={1000}&gid={1000} rate=100'" &
+ pid2=$!
+ wait $pid1 || error "$i: Fail to start TBF rule 'rule77q_1'"
+ wait $pid2 || error "$i: Fail to start TBF rule 'rule77q_2'"
+
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="'stop rule77q_1'" &
+ pid1=$!
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="'stop rule77q_2'" &
+ pid2=$!
+ wait $pid1 || error "$i: Fail to stop TBF rule 'rule77q_1'"
+ wait $pid2 || error "$i: Fail to stop TBF rule 'rule77q_2'"
+ done
+}
+run_test 77q "Parallel TBF rule definitions should not panic"
+
+test_77p() {
+ local c
+ local -a spec_chars=(
+ '@' '.' '~' '#' '/' '^' '%' '*' ';' ',' '?' '<' '>' ':'
+ '+' '=' ')' '(' '{' '}' '|' '[' ']' '!' '&' '\$' '\`' '\\')
+
+ (( $MDS1_VERSION > $(version_code 2.14.54) )) ||
+ skip "need MDS >= 2.14.54"
+
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_policies="tbf"
+ stack_trap "do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_policies=fifo"
+
+ # TBF rule name size is 16 bytes
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="start\ test_77p_overflo\ uid={500}\ rate=500" &&
+ error "The length of tbf rule name is not checked" || true
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="start\ \ uid={500}\ rate=500" &&
+ error "The server should not accept empty tbf rule name" || true
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="start\ test_77p_empty" &&
+ error "The server should not accept 'start <tbf_rule_name>' without an expression" || true
+
+ # Test with special chars
+ for c in "${spec_chars[@]}"; do
+ do_facet mds1 $LCTL set_param mds.MDS.mdt.nrs_tbf_rule="'start test77p${c}spec uid={500} rate=500'" &&
+ error "Special char '${c}' should not be accepted in a tbf rule name" || true
+ done
+
+}
+run_test 77p "Check validity of rule names for TBF policies"
+
test_78() { #LU-6673
local rc
local file
local pid
+ mkdir_on_mdt0 $DIR1/$tdir
mkdir -p $DIR1/$tdir/dir
createmany -o $DIR1/$tdir/dir/f 10 ||
error "create files under remote dir failed $i"
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
+ error "check_fhandle_syscalls $tfile failed"
+
+ # test this is working on DNE directories also
+ if (( MDSCOUNT > 1 MDS1_VERSION >= $(version_code 2.14.52) )); then
+ $LFS mkdir -i 1 $DIR/$tdir.remote
+ cancel_lru_locks mdc
+ check_fhandle_syscalls $DIR/$tdir.remote $DIR2 ||
+ error "check_fhandle_syscalls $tdir.remote failed"
+ $LFS mkdir -c -1 $DIR/$tdir.remote/subdir
+ cancel_lru_locks mdc
+ check_fhandle_syscalls $DIR/$tdir.remote/subdir $DIR2 ||
+ error "check_fhandle_syscalls $tdir.remote/subdir fail"
+
+ $LFS mkdir -c -1 $DIR/$tdir.stripe
+ cancel_lru_locks mdc
+ check_fhandle_syscalls $DIR/$tdir.stripe $DIR2 ||
+ error "check_fhandle_syscalls $tdir.stripe failed"
+ $LFS mkdir -c -1 $DIR/$tdir.stripe/subdir
+ cancel_lru_locks mdc
+ check_fhandle_syscalls $DIR/$tdir.stripe/subdir $DIR2 ||
+ error "check_fhandle_syscalls $tdir.stripe/subdir fail"
+ fi
}
run_test 102 "Test open by handle of unlinked file"
}
run_test 108a "lseek: parallel updates"
+# LU-14110
+test_109() {
+ local i
+ local pid1 pid2
+
+ ! local_mode ||
+ skip "Clients need to be on different nodes than the servers"
+
+ umount_client $MOUNT
+ umount_client $MOUNT2
+
+ echo "Starting race between client mount instances (50 iterations):"
+ for i in {1..50}; do
+ log "Iteration $i"
+
+#define OBD_FAIL_ONCE|OBD_FAIL_LLITE_RACE_MOUNT 0x80001417
+ $LCTL set_param -n fail_loc=0x80001417
+
+ mount_client $MOUNT & pid1=$!
+ mount_client $MOUNT2 & pid2=$!
+ wait $pid1 || error "Mount $MOUNT fails with $?"
+ wait $pid2 || error "Mount $MOUNT2 fails with $?"
+
+ umount_client $MOUNT & pid1=$!
+ umount_client $MOUNT2 & pid2=$!
+ wait $pid1 || error "Umount $MOUNT fails with $?"
+ wait $pid2 || error "Umount $MOUNT2 fails with $?"
+
+ $LUSTRE_RMMOD || error "Fail to remove lustre modules"
+ load_modules
+ echo
+ done
+
+ mount_client $MOUNT
+ mount_client $MOUNT2
+}
+
+run_test 109 "Race with several mount instances on 1 node"
+
+test_110() {
+ local before=$(date +%s)
+ local evict
+
+ mkdir -p $DIR/$tdir
+ touch $DIR/$tdir/f1
+ touch $DIR/$tfile
+
+ #define OBD_FAIL_PTLRPC_RESEND_RACE 0x525
+ do_facet mds1 lctl set_param fail_loc=0x525 fail_val=3
+
+ # disable last_xid logic by dropping link reply
+ ln $DIR/$tdir/f1 $DIR/$tdir/f2 &
+ sleep 1
+
+ #define OBD_FAIL_PTLRPC_ENQ_RESEND 0x534
+ do_facet mds1 lctl set_param fail_loc=0x534
+
+ # RPC will race with its Resend and the Resend will sleep to let
+ # the original lock to get granted & cancelled.
+ #
+ # AST_SENT is set artificially, so an explicit conflict is not needed
+ #
+ # The woken up Resend gets a new lock, but client does not wait for it
+ stat $DIR/$tfile
+ sleep $TIMEOUT
+ do_facet mds1 lctl set_param fail_loc=0 fail_val=0
+
+ # Take a conflict to wait long enough to see the eviction
+ touch $DIR2/$tfile
+
+ # let the client reconnect
+ client_reconnect
+ evict=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state |
+ awk -F"[ [,]" '/EVICTED ]$/ { if (mx<$5) {mx=$5;} } END { print mx }')
+
+ [ -z "$evict" ] || [[ $evict -le $before ]] ||
+ (do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state;
+ error "eviction happened: $evict before:$before")
+}
+run_test 110 "do not grant another lock on resend"
+
+test_111() {
+ [ $MDSCOUNT -ge 2 ] || skip "needs >= 2 MDTs"
+ [[ $(facet_active_host mds1) = $(facet_active_host mds2) ]] ||
+ skip "MDT0 and MDT1 should be on the same node"
+
+ mkdir $DIR1/$tdir
+ $LFS mkdir -i 0 $DIR1/$tdir/mdt0dir
+ $LFS mkdir -i 1 $DIR1/$tdir/mdt1dir
+
+ mkdir $DIR1/$tdir/mdt0dir/foodir
+ touch $DIR1/$tdir/mdt0dir/foodir/{file1,file2}
+
+ $MULTIOP $DIR2/$tdir/mdt0dir/foodir/file2 Ow4096_c &
+ MULTIOP_PID=$!
+ ln $DIR1/$tdir/mdt0dir/foodir/file2 $DIR1/$tdir/mdt1dir/file2
+
+ #define OBD_FAIL_MDS_LINK_RENAME_RACE 0x18a
+ do_facet mds1 $LCTL set_param fail_loc=0x8000018a
+
+ ln $DIR1/$tdir/mdt0dir/foodir/file2 $DIR1/$tdir/mdt1dir/file2x &
+ sleep 1
+
+ rm $DIR2/$tdir/mdt1dir/file2
+ sleep 1
+
+ mv $DIR2/$tdir/mdt0dir/foodir/file1 $DIR2/$tdir/mdt0dir/foodir/file2
+ sleep 1
+
+ kill $MULTIOP_PID
+ wait
+ rm -r $DIR1/$tdir || error "Removing test dir failed"
+}
+run_test 111 "A racy rename/link an open file should not cause fs corruption"
+
+test_112() {
+ (( MDSCOUNT >= 2 )) ||
+ skip "We need at least 2 MDTs for this test"
+
+ (( MDS1_VERSION >= $(version_code 2.14.54) )) ||
+ skip "Need server version at least 2.14.54"
+
+ local rr
+ local count
+
+ rr=$($LCTL get_param -n lmv.*.qos_threshold_rr | head -n1)
+ rr=${rr%%%}
+ stack_trap "$LCTL set_param lmv.*.qos_threshold_rr=$rr > /dev/null"
+
+ mkdir -p $DIR1/$tdir/s1/s2 || error "mkdir s2 failed"
+ $LFS mkdir -i 0 $DIR1/$tdir/s1/s2/s3 || error "mkdir s3 failed"
+ $LFS setdirstripe -D -i -1 --max-inherit-rr=0 $DIR1/$tdir/s1/s2/s3 ||
+ error "setdirstripe s3 failed"
+ $LCTL set_param lmv.*.qos_threshold_rr=90
+ mkdir $DIR2/$tdir/s1/s2/s3/d{1..64}
+ count=$($LFS getstripe -m $DIR2/$tdir/s1/s2/s3/d* | grep ^0 | wc -l)
+ (( count == 64 )) || error "only $count subdirs created on MDT0"
+
+ $LFS setdirstripe -D -i -1 --max-inherit-rr=3 $DIR1/$tdir/s1/s2/s3 ||
+ error "setdirstripe s3 failed"
+ mkdir $DIR2/$tdir/s1/s2/s3/s{1..64}
+ count=$($LFS getstripe -m $DIR2/$tdir/s1/s2/s3/s* | grep ^0 | wc -l)
+ (( count == 64 / MDSCOUNT )) || error "$count subdirs created on MDT0"
+}
+run_test 112 "update max-inherit in default LMV"
+
log "cleanup: ======================================================"
# kill and wait in each test only guarentee script finish, but command in script