Once default LMV is set on ROOT, and default stripe offset is "-1",
mkdir may not create directory on MDT0, but it's a premise for many
tests. Add a function mkdir_on_mdt0() to create directory on MDT0
by "lfs mkdir -i 0".
Replace mkdir with mkdir_on_mdt0() for such tests in sanity.sh and
sanityn.sh.
Test-Parameters: trivial testlist=sanityn
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I6155d036e6b28153d0bdbdbc01088bd68ee9e0af
Reviewed-on: https://review.whamcloud.com/43489
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
local FAILIDX=${3:-$OSTIDX}
local ofacet=ost$((OSTIDX + 1))
local FAILIDX=${3:-$OSTIDX}
local ofacet=ost$((OSTIDX + 1))
- test_mkdir -p -c1 $DIR/$tdir
+ mkdir_on_mdt0 $DIR/$tdir
local mdtidx=$($LFS getstripe -m $DIR/$tdir)
local mfacet=mds$((mdtidx + 1))
echo OSTIDX=$OSTIDX MDTIDX=$mdtidx
local mdtidx=$($LFS getstripe -m $DIR/$tdir)
local mfacet=mds$((mdtidx + 1))
echo OSTIDX=$OSTIDX MDTIDX=$mdtidx
reset_enospc
rm -f $DIR/$tdir/$tfile
reset_enospc
rm -f $DIR/$tdir/$tfile
+ mkdir_on_mdt0 $DIR/$tdir
$MCREATE $DIR/$tdir/$tfile || error "mcreate $DIR/$tdir/$tfile failed"
$TRUNCATE $DIR/$tdir/$tfile 80000000 ||
error "truncate $DIR/$tdir/$tfile failed"
$MCREATE $DIR/$tdir/$tfile || error "mcreate $DIR/$tdir/$tfile failed"
$TRUNCATE $DIR/$tdir/$tfile 80000000 ||
error "truncate $DIR/$tdir/$tfile failed"
local atime_diff=$(do_facet $SINGLEMDS \
lctl get_param -n mdd.*MDT0000*.atime_diff)
rm -rf $DIR/$tdir
local atime_diff=$(do_facet $SINGLEMDS \
lctl get_param -n mdd.*MDT0000*.atime_diff)
rm -rf $DIR/$tdir
+ mkdir_on_mdt0 $DIR/$tdir
# test setting directory atime to future
touch -a -d @$TEST_39_ATIME $DIR/$tdir
# test setting directory atime to future
touch -a -d @$TEST_39_ATIME $DIR/$tdir
[[ $MDS1_VERSION -lt $(version_code 2.7.54) ]] &&
skip "Need MDS version at least 2.7.54"
[[ $MDS1_VERSION -lt $(version_code 2.7.54) ]] &&
skip "Need MDS version at least 2.7.54"
- mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
+ mkdir_on_mdt0 $DIR/$tdir || error "failed to create $DIR/$tdir"
cancel_lru_locks mdc
local nsdir="ldlm.namespaces.*-MDT0000-mdc-*"
cancel_lru_locks mdc
local nsdir="ldlm.namespaces.*-MDT0000-mdc-*"
[[ $MDS1_VERSION -lt $(version_code 2.7.54) ]] &&
skip "Need MDS version at least 2.7.54"
[[ $MDS1_VERSION -lt $(version_code 2.7.54) ]] &&
skip "Need MDS version at least 2.7.54"
- mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
+ mkdir_on_mdt0 $DIR/$tdir || error "failed to create $DIR/$tdir"
cancel_lru_locks mdc
local low_wm=$(do_facet mds1 $LCTL get_param -n \
cancel_lru_locks mdc
local low_wm=$(do_facet mds1 $LCTL get_param -n \
changelog_users $SINGLEMDS | grep -q $cl_user ||
error "User $cl_user not found in changelog_users"
changelog_users $SINGLEMDS | grep -q $cl_user ||
error "User $cl_user not found in changelog_users"
+ mkdir_on_mdt0 $DIR/$tdir
+
# change something
test_mkdir -p $DIR/$tdir/pics/2008/zachy
changelog_clear 0 || error "changelog_clear failed"
# change something
test_mkdir -p $DIR/$tdir/pics/2008/zachy
changelog_clear 0 || error "changelog_clear failed"
[[ $MDS1_VERSION -lt $(version_code 2.3.56) ]] &&
skip "Need MDS version at least 2.3.56"
[[ $MDS1_VERSION -lt $(version_code 2.3.56) ]] &&
skip "Need MDS version at least 2.3.56"
- mkdir -p $DIR/$tdir || error "creating dir $DIR/$tdir"
+ mkdir_on_mdt0 $DIR/$tdir || error "creating dir $DIR/$tdir"
echo aaa > $DIR/$tdir/$tfile
#define OBD_FAIL_MDS_NEGATIVE_POSITIVE 0x148
echo aaa > $DIR/$tdir/$tfile
#define OBD_FAIL_MDS_NEGATIVE_POSITIVE 0x148
+ cmd="$LFS mkdir -i 0 -c 1 $DIR/$tdir"
verify_jobstats "$cmd" "$SINGLEMDS"
# rmdir
cmd="rmdir $DIR/$tdir"
verify_jobstats "$cmd" "$SINGLEMDS"
# rmdir
cmd="rmdir $DIR/$tdir"
[ $left -ge 0 ] && wait_update_facet $SINGLEMDS \
"lctl get_param *.*.job_stats | grep -c 'job_id.*mkdir'" \
"0" $left
[ $left -ge 0 ] && wait_update_facet $SINGLEMDS \
"lctl get_param *.*.job_stats | grep -c 'job_id.*mkdir'" \
"0" $left
- cmd="mkdir $DIR/$tdir.expire"
+ cmd="$LFS mkdir -i 0 -c 1 $DIR/$tdir.expire"
verify_jobstats "$cmd" "$SINGLEMDS"
[ $(do_facet $SINGLEMDS lctl get_param *.*.job_stats |
grep -c "job_id.*mkdir") -gt 1 ] && error "old jobstats not expired"
verify_jobstats "$cmd" "$SINGLEMDS"
[ $(do_facet $SINGLEMDS lctl get_param *.*.job_stats |
grep -c "job_id.*mkdir") -gt 1 ] && error "old jobstats not expired"
local OSTIDX=0
# create on MDT0000 so the last_id and next_id are correct
local OSTIDX=0
# create on MDT0000 so the last_id and next_id are correct
+ mkdir_on_mdt0 $DIR/$tdir
local OST=$($LFS df $DIR | awk '/OST:'$OSTIDX'/ { print $1 }')
OST=${OST%_UUID}
local OST=$($LFS df $DIR | awk '/OST:'$OSTIDX'/ { print $1 }')
OST=${OST%_UUID}
+ mkdir_on_mdt0 $DIR/$tdir
mkdir $DIR/$tdir/migrate_dir
mkdir $DIR/$tdir/other_dir
touch $DIR/$tdir/migrate_dir/a
mkdir $DIR/$tdir/migrate_dir
mkdir $DIR/$tdir/other_dir
touch $DIR/$tdir/migrate_dir/a
test_242() {
remote_mds_nodsh && skip "remote MDS with nodsh"
test_242() {
remote_mds_nodsh && skip "remote MDS with nodsh"
+ mkdir_on_mdt0 $DIR/$tdir
touch $DIR/$tdir/$tfile
#define OBD_FAIL_MDS_READPAGE_PACK 0x105
touch $DIR/$tdir/$tfile
#define OBD_FAIL_MDS_READPAGE_PACK 0x105
grep -q subtree ||
skip "Fileset feature is not supported"
grep -q subtree ||
skip "Fileset feature is not supported"
- mkdir $DIR/$tdir || error "mkdir $tdir failed"
+ mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
$LFS mkdir -i $((MDSCOUNT - 1)) $DIR/$tdir/remote ||
error "mkdir remote failed"
mkdir $DIR/$tdir/remote/subdir || error "mkdir remote/subdir failed"
$LFS mkdir -i $((MDSCOUNT - 1)) $DIR/$tdir/remote ||
error "mkdir remote failed"
mkdir $DIR/$tdir/remote/subdir || error "mkdir remote/subdir failed"
changelog_register || error "changelog_register failed"
rm -rf $DIR/$tdir
changelog_register || error "changelog_register failed"
rm -rf $DIR/$tdir
+ mkdir_on_mdt0 $DIR/$tdir
changelog_clear 0 || error "changelog_clear failed"
changelog_clear 0 || error "changelog_clear failed"
local dom=$DIR/$tdir/dom_file
local tmp=$DIR/$tdir/tmp_file
local dom=$DIR/$tdir/dom_file
local tmp=$DIR/$tdir/tmp_file
+ mkdir_on_mdt0 $DIR/$tdir
# basic checks for DoM component creation
$LFS setstripe -E 1024K -E 2048K -L mdt $dom 2>/dev/null &&
# basic checks for DoM component creation
$LFS setstripe -E 1024K -E 2048K -L mdt $dom 2>/dev/null &&
+ mkdir_on_mdt0 $DIR/$tdir
$LFS setdirstripe -i 0 -c 2 $DIR/$tdir/striped_dir ||
error "set striped dir error"
$LFS setdirstripe -i 0 -c 2 $DIR/$tdir/striped_dir ||
error "set striped dir error"
local stripe_count
local stripe_index
local stripe_count
local stripe_index
+ mkdir_on_mdt0 $DIR/$tdir
mkdir $DIR/$tdir/normal_dir
#Checking when client cache stripe index
mkdir $DIR/$tdir/normal_dir
#Checking when client cache stripe index
[ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
remote_mds_nodsh && skip "remote MDS with nodsh"
[ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
remote_mds_nodsh && skip "remote MDS with nodsh"
+ mkdir_on_mdt0 $DIR/$tdir
#define OBD_FAIL_OUT_ENOSPC 0x1704
do_facet mds2 lctl set_param fail_loc=0x80001704
#define OBD_FAIL_OUT_ENOSPC 0x1704
do_facet mds2 lctl set_param fail_loc=0x80001704
[ $MDS1_VERSION -lt $(version_code 2.10.54) ] &&
skip "MDS needs to be newer than 2.10.54"
[ $MDS1_VERSION -lt $(version_code 2.10.54) ] &&
skip "MDS needs to be newer than 2.10.54"
+ mkdir_on_mdt0 $DIR/$tdir
# Create some objects on all MDTs to trigger related logs objects
for idx in $(seq $MDSCOUNT); do
$LFS mkdir -c $MDSCOUNT -i $((idx % $MDSCOUNT)) \
# Create some objects on all MDTs to trigger related logs objects
for idx in $(seq $MDSCOUNT); do
$LFS mkdir -c $MDSCOUNT -i $((idx % $MDSCOUNT)) \
fi
do_facet $SINGLEMDS zfs set quota=$(((usedkb+freekb)*1024)) $fsset
trap cleanup_805 EXIT
fi
do_facet $SINGLEMDS zfs set quota=$(((usedkb+freekb)*1024)) $fsset
trap cleanup_805 EXIT
+ mkdir_on_mdt0 $DIR/$tdir
$LFS setstripe -E 1M -c2 -E 4M -c2 -E -1 -c2 $DIR/$tdir ||
error "Can't set PFL layout"
createmany -m $DIR/$tdir/f- 1000000 && error "ENOSPC wasn't met"
$LFS setstripe -E 1M -c2 -E 4M -c2 -E -1 -c2 $DIR/$tdir ||
error "Can't set PFL layout"
createmany -m $DIR/$tdir/f- 1000000 && error "ENOSPC wasn't met"
stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
rm -rf $DIR/$tdir || error "rm $tdir failed"
stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
rm -rf $DIR/$tdir || error "rm $tdir failed"
- mkdir -p $DIR/$tdir || error "mkdir $tdir failed"
+ mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
touch $DIR/$tdir/trunc || error "touch $tdir/trunc failed"
$TRUNCATE $DIR/$tdir/trunc 1024 || error "truncate $tdir/trunc failed"
$TRUNCATE $DIR/$tdir/trunc 1048576 ||
touch $DIR/$tdir/trunc || error "touch $tdir/trunc failed"
$TRUNCATE $DIR/$tdir/trunc 1024 || error "truncate $tdir/trunc failed"
$TRUNCATE $DIR/$tdir/trunc 1048576 ||
+ 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
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
skip "DNE CoS not supported"
# remote directory create
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
# 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
# test 40: check non-blocking operations
test_40a() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
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"
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 &
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
check_pdo_conflict $PID1 || error "create is blocked"
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
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"
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"
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"
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
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
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
return 0
}
run_test 40a "pdirops: create vs others =============="
test_40b() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
return 0
}
run_test 40a "pdirops: create vs others =============="
test_40b() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
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"
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/$tdir/$tfile &
PID1=$!; pdo_sched
# open|create
PID1=$!; pdo_sched
# open|create
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
check_pdo_conflict $PID1 || error "create is blocked"
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
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"
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"
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"
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
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
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
return 0
}
run_test 40b "pdirops: open|create and others =============="
test_40c() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
return 0
}
run_test 40b "pdirops: open|create and others =============="
test_40c() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ 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"
#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
PID1=$!; pdo_sched
# open|create
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
check_pdo_conflict $PID1 || error "create is blocked"
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
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"
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"
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"
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
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
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
return 0
}
run_test 40c "pdirops: link and others =============="
test_40d() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
return 0
}
run_test 40c "pdirops: link and others =============="
test_40d() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ 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"
#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/$tdir/$tfile &
PID1=$!; pdo_sched
# open|create
PID1=$!; pdo_sched
# open|create
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
check_pdo_conflict $PID1 || error "create is blocked"
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
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"
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"
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"
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
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
test_40e() {
remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ 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"
#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
PID1=$!; pdo_sched
# open|create
+ touch $DIR2/$tdir/$tfile-2
check_pdo_conflict $PID1 || error "create is blocked"
check_pdo_conflict $PID1 || error "create is blocked"
+ mkdir $DIR2/$tdir/$tfile-3
check_pdo_conflict $PID1 || error "mkdir is blocked"
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"
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"
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
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
do_nodes $(comma_list $(mdts_nodes)) \
"lctl set_param -n fail_loc=0 2>/dev/null || true"
wait $PID1
return 0
}
run_test 40e "pdirops: rename and others =============="
return 0
}
run_test 40e "pdirops: rename and others =============="
run_test 42f "pdirops: mkdir and rename (src) =============="
test_42g() {
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"
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/$tdir/$tfile &
- 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"
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
}
run_test 42g "pdirops: mkdir vs getattr =============="
}
run_test 42g "pdirops: mkdir vs getattr =============="
[[ $MDS1_VERSION -lt $(version_code 2.13.52) ]] &&
skip "Need MDS version newer than 2.13.52"
[[ $MDS1_VERSION -lt $(version_code 2.13.52) ]] &&
skip "Need MDS version newer than 2.13.52"
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
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/sub &
- mkdir $DIR2/$tdir && ((OK++))
+ mkdir $DIR2/$tdir/sub && ((OK++))
wait $PID1 && ((OK++))
(( OK == 1 )) || error "exactly one mkdir should succeed"
wait $PID1 && ((OK++))
(( OK == 1 )) || error "exactly one mkdir should succeed"
- rmdir $DIR1/$tdir || error "rmdir failed"
+ rmdir $DIR1/$tdir/sub || error "rmdir failed"
run_test 54 "rename locking"
test_55a() {
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
#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 &
wait $PID1 && error "(2) mv succeeded"
wait $PID1 && error "(2) mv succeeded"
}
run_test 55a "rename vs unlink target dir"
test_55b()
{
}
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
#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 &
wait $PID1 && error "(2) mv succeeded"
wait $PID1 && error "(2) mv succeeded"
}
run_test 55b "rename vs unlink source dir"
test_55c()
{
}
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
#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
PID1=$!
sleep 1
# while rename is sleeping, open and remove d3
- $MULTIOP $DIR2/d3 D_c &
+ $MULTIOP $DIR2/$tdir/d3 D_c &
sleep 5
# while rename is sleeping 2nd time, close d3
sleep 5
# while rename is sleeping 2nd time, close d3
wait $PID1 && error "(2) mv succeeded"
wait $PID1 && error "(2) mv succeeded"
}
run_test 55c "rename vs unlink orphan target dir"
test_55d()
{
}
run_test 55c "rename vs unlink orphan target dir"
test_55d()
{
+ mkdir_on_mdt0 $DIR/$tdir
+
+ touch $DIR/$tdir/f1
#define OBD_FAIL_MDS_RENAME3 0x155
do_facet mds1 $LCTL set_param fail_loc=0x155
#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
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
# link in reverse locking order
- ln $DIR2/f1 $DIR2/$tdir/
+ ln $DIR2/$tdir/f1 $DIR2/$tdir/$tdir/
wait $PID1 && error "(2) mv succeeded"
wait $PID1 && error "(2) mv succeeded"
}
run_test 55d "rename file vs link"
}
run_test 55d "rename file vs link"
is_mounted $MOUNT || setupall
rm -rf $DIR/[df][0-9]* || error "Fail to cleanup the env!"
is_mounted $MOUNT || setupall
rm -rf $DIR/[df][0-9]* || error "Fail to cleanup the env!"
- mkdir $DIR/$tdir || error "Fail to mkdir $DIR/$tdir."
+ mkdir_on_mdt0 $DIR/$tdir || error "Fail to mkdir $DIR/$tdir."
for idx in $(seq $MDSCOUNT); do
local name="MDT$(printf '%04x' $((idx - 1)))"
rm -rf $MOUNT/.lustre/lost+found/$name/*
for idx in $(seq $MDSCOUNT); do
local name="MDT$(printf '%04x' $((idx - 1)))"
rm -rf $MOUNT/.lustre/lost+found/$name/*
[[ -z "${saved_OPENCACHE_value}" ]] ||
$LCTL set_param -n "llite.*.opencache_threshold_count"=${saved_OPENCACHE_value}
}
[[ -z "${saved_OPENCACHE_value}" ]] ||
$LCTL set_param -n "llite.*.opencache_threshold_count"=${saved_OPENCACHE_value}
}
+
+# LU-13417: XXX lots of tests assume the directory to be created under MDT0,
+# using this function to create directory under MDT0 explicitly.
+# Don't use it in new tests, and remove it from old tests.
+mkdir_on_mdt0() {
+ $LFS mkdir -i 0 -c 1 $*
+}