local ost_list=$(seq $first_ost $ost_step $last_ost)
local ost_range="$first_ost $last_ost $ost_step"
- if ! combined_mgs_mds ; then
- mount_mgs_client
- fi
-
test_mkdir $DIR/$tdir
pool_add $POOL || error "pool_add failed"
pool_add_targets $POOL $ost_range || error "pool_add_targets failed"
error "llapi_layout_test failed"
destroy_test_pools || error "destroy test pools failed"
-
- if ! combined_mgs_mds ; then
- umount_mgs_client
- fi
}
run_test 27D "validate llapi_layout API"
local POOL=${POOL:-$TESTNAME}
- if ! combined_mgs_mds ; then
- mount_mgs_client
- trap umount_mgs_client EXIT
- fi
-
pool_add $POOL || error "pool_add failed"
lfs pool_list $MOUNT | grep -Fx "${FSNAME}.${POOL}" ||
}
run_test 27M "test O_APPEND striping"
+test_27N() {
+ combined_mgs_mds && skip "needs separate MGS/MDT"
+
+ pool_add $TESTNAME || error "pool_add failed"
+ do_facet mgs "$LCTL pool_list $FSNAME" |
+ grep -Fx "${FSNAME}.${TESTNAME}" ||
+ error "lctl pool_list on MGS failed"
+}
+run_test 27N "lctl pool_list on separate MGS gives correct pool name"
+
# createtest also checks that device nodes are created and
# then visible correctly (#2091)
test_28() { # bug 2091
error "mtime is lost on close: $mtime2, " \
"should be $mtime1"
- cancel_lru_locks $OSC
+ cancel_lru_locks
if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
done
lctl set_param fail_loc=0
[ "$mtime2" = $TEST_39_MTIME ] || \
error "mtime is lost on close: $mtime2, should be $TEST_39_MTIME"
- cancel_lru_locks osc
+ cancel_lru_locks
if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
done
}
local dir5_layout=$(get_layout_param $dir5)
[[ "$dir4_layout" = "$dir5_layout" ]] ||
error "$dir5 should inherit the default layout from $dir4"
+
+ # though subdir under ROOT doesn't inherit default layout, but
+ # its sub dir/file should be created with default layout.
+ [[ $MDSCOUNT -ge 2 ]] || skip_env "needs >= 2 MDTs"
+ [[ $MDS1_VERSION -ge $(version_code 2.12.59) ]] ||
+ skip "Need MDS version at least 2.12.59"
+
+ local default_lmv_count=$($LFS getdirstripe -D -c $MOUNT)
+ local default_lmv_index=$($LFS getdirstripe -D -i $MOUNT)
+ local default_lmv_hash=$($LFS getdirstripe -D -H $MOUNT)
+
+ if [ $default_lmv_hash == "none" ]; then
+ stack_trap "$LFS setdirstripe -D -d $MOUNT" EXIT
+ else
+ stack_trap "$LFS setdirstripe -D -i $default_lmv_index \
+ -c $default_lmv_count -H $default_lmv_hash $MOUNT" EXIT
+ fi
+
+ $LFS setdirstripe -D -c 2 $MOUNT ||
+ error "setdirstripe -D -c 2 failed"
+ mkdir $MOUNT/$tdir-6 || error "mkdir $tdir-6 failed"
+ local lmv_count=$($LFS getdirstripe -c $MOUNT/$tdir-6)
+ [ $lmv_count -eq 2 ] || error "$tdir-6 stripe count $lmv_count"
}
run_test 65n "don't inherit default layout from root for new subdirectories"
test_101a() {
[ $PARALLEL == "yes" ] && skip "skip parallel run"
- [ $MDSCOUNT -ge 2 ] && skip_env "needs < 2 MDTs" #LU-4322
local s
local discard
done
cleanup_101a
- if [[ $(($discard * 10)) -gt $nreads ]]; then
- $LCTL get_param osc.*-osc*.rpc_stats
- $LCTL get_param llite.*.read_ahead_stats
+ $LCTL get_param osc.*-osc*.rpc_stats
+ $LCTL get_param llite.*.read_ahead_stats
+
+ # Discard is generally zero, but sometimes a few random reads line up
+ # and trigger larger readahead, which is wasted & leads to discards.
+ if [[ $(($discard)) -gt $nreads ]]; then
error "too many ($discard) discarded pages"
fi
rm -f $DIR/$tfile || true
}
run_test 160j "client can be umounted while its chanangelog is being used"
+test_160k() {
+ [ $PARALLEL == "yes" ] && skip "skip parallel run"
+ remote_mds_nodsh && skip "remote MDS with nodsh"
+
+ mkdir -p $DIR/$tdir/1/1
+
+ changelog_register || error "changelog_register failed"
+ local cl_user="${CL_USERS[$SINGLEMDS]%% *}"
+
+ changelog_users $SINGLEMDS | grep -q $cl_user ||
+ error "User '$cl_user' not found in changelog_users"
+#define OBD_FAIL_MDS_CHANGELOG_REORDER 0x15d
+ do_facet mds1 $LCTL set_param fail_loc=0x8000015d fail_val=3
+ rmdir $DIR/$tdir/1/1 & sleep 1
+ mkdir $DIR/$tdir/2
+ touch $DIR/$tdir/2/2
+ rm -rf $DIR/$tdir/2
+
+ wait
+ sleep 4
+
+ changelog_dump | grep rmdir || error "rmdir not recorded"
+
+ rm -rf $DIR/$tdir
+ changelog_deregister
+}
+run_test 160k "Verify that changelog records are not lost"
+
test_161a() {
[ $PARALLEL == "yes" ] && skip "skip parallel run"
local subdir=$test_path/subdir
local rc=0
- if ! combined_mgs_mds ; then
- mount_mgs_client
- fi
-
while : ; do
# former test_200a test_200b
pool_add $POOL || { rc=$? ; break; }
destroy_test_pools
- if ! combined_mgs_mds ; then
- umount_mgs_client
- fi
return $rc
}
run_test 200 "OST pools"
$LFS df -i
- if ! combined_mgs_mds ; then
- mount_mgs_client
- fi
-
do_facet ost$((OSTIDX + 1)) lctl set_param fail_val=-1
#define OBD_FAIL_OST_ENOINO 0x229
do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x229
error "$LCTL pool_destroy $FSNAME.$TESTNAME failed"
echo "unlink $MDSOBJS files @$next_id..."
unlinkmany $DIR/$tdir/f $MDSOBJS || error "unlinkmany failed"
-
- if ! combined_mgs_mds ; then
- umount_mgs_client
- fi
}
run_test 220 "preallocated MDS objects still used if ENOSPC from OST"
wait_delete_completed
mkdir $DIR/$tdir
- if ! combined_mgs_mds ; then
- mount_mgs_client
- fi
pool_add $TESTNAME || error "Pool creation failed"
pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
if (( oa_status != 0 )); then
error "Object allocation still disable after rm"
fi
-
- if ! combined_mgs_mds ; then
- umount_mgs_client
- fi
}
run_test 253 "Check object allocation limit"
local def_stripe_size=$($LFS getstripe -S $MOUNT)
local test_pool=$TESTNAME
- if ! combined_mgs_mds ; then
- mount_mgs_client
- fi
pool_add $test_pool || error "pool_add failed"
pool_add_targets $test_pool 0 $(($OSTCOUNT - 1)) 1 ||
error "pool_add_targets failed"
local f=$DIR/$tdir/$tfile
pool_remove_all_targets $test_pool $f
pool_remove $test_pool $f
-
- if ! combined_mgs_mds ; then
- umount_mgs_client
- fi
}
run_test 406 "DNE support fs default striping"
sleep_maxage
local ffree
+ local bavail
local max
local min
local max_index
local min_index
+ local tmp
- ffree=($(lctl get_param -n mdc.*[mM][dD][cC]-[^M]*.filesfree | uniq))
- echo "MDT filesfree available: ${ffree[@]}"
- max=${ffree[0]}
- min=${ffree[0]}
+ ffree=($(lctl get_param -n mdc.*[mM][dD][cC]-[^M]*.filesfree))
+ bavail=($(lctl get_param -n mdc.*[mM][dD][cC]-[^M]*.kbytesavail))
+ bsize=$(lctl get_param -n mdc.*MDT0000*.blocksize)
+
+ max=$(((${ffree[0]} >> 8) * (${bavail[0]} * bsize >> 16)))
+ min=$(((${ffree[0]} >> 8) * (${bavail[0]} * bsize >> 16)))
max_index=0
min_index=0
- for ((i = 0; i < ${#ffree[@]}; i++)); do
- if [[ ${ffree[i]} -gt $max ]]; then
- max=${ffree[i]}
+ for ((i = 1; i < ${#ffree[@]}; i++)); do
+ tmp=$(((${ffree[i]} >> 8) * (${bavail[i]} * bsize >> 16)))
+ if [ $tmp -gt $max ]; then
+ max=$tmp
max_index=$i
fi
- if [[ ${ffree[i]} -lt $min ]]; then
- min=${ffree[i]}
+ if [ $tmp -lt $min ]; then
+ min=$tmp
min_index=$i
fi
done
- echo "Min free files: MDT$min_index: $min"
- echo "Max free files: MDT$max_index: $max"
- [ $min -eq 0 ] && skip "no free files in MDT$min_index"
- [ $min -gt 10000000 ] && skip "too much free files in MDT$min_index"
+ [ ${ffree[min_index]} -eq 0 ] &&
+ skip "no free files in MDT$min_index"
+ [ ${ffree[min_index]} -gt 100000000 ] &&
+ skip "too much free files in MDT$min_index"
# Check if we need to generate uneven MDTs
- test_mkdir -i $min_index -c 1 -p $DIR/$tdir-MDT$min_index
- local threshold=10
- local diff=$((max - min))
- local diff2=$((diff * 100 / min))
-
- echo -n "Check for uneven MDTs: "
- echo -n "diff=$diff files ($diff2%) must be > $threshold% ..."
+ local threshold=50
+ local diff=$(((max - min ) * 100 / min))
+ local value="$(generate_string 1024)"
+ local i
- if [ $diff2 -gt $threshold ]; then
- echo "ok"
- echo "Don't need to fill MDT$min_index"
- else
- # generate uneven MDTs, create till 25% diff
- echo "no"
- diff2=$((threshold - diff2))
- diff=$((min * diff2 / 100))
+ while [ $diff -lt $threshold ]; do
+ # generate uneven MDTs, create till $threshold% diff
+ echo -n "weight diff=$diff% must be > $threshold% ..."
+ count=$((${ffree[min_index]} / 10))
# 50 sec per 10000 files in vm
- [ $diff -gt 40000 ] && [ "$SLOW" = "no" ] &&
- skip "$diff files to create"
- echo "Fill $diff2% diff in MDT$min_index with $diff files"
- local i
- local value="$(generate_string 1024)"
- for i in $(seq $diff); do
+ [ $count -gt 40000 ] && [ "$SLOW" = "no" ] &&
+ skip "$count files to create"
+ echo "Fill MDT$min_index with $count files"
+ [ -d $DIR/$tdir-MDT$min_index ] ||
+ $LFS mkdir -i $min_index $DIR/$tdir-MDT$min_index ||
+ error "mkdir $tdir-MDT$min_index failed"
+ for i in $(seq $count); do
$OPENFILE -f O_CREAT:O_LOV_DELAY_CREATE \
$DIR/$tdir-MDT$min_index/f$i > /dev/null ||
error "create f$i failed"
$DIR/$tdir-MDT$min_index/f$i ||
error "setfattr f$i failed"
done
- fi
- min=$((100 *MDSCOUNT))
- max=0
+ ffree=($(lctl get_param -n mdc.*[mM][dD][cC]-*.filesfree))
+ bavail=($(lctl get_param -n mdc.*[mM][dD][cC]-*.kbytesavail))
+ max=$(((${ffree[max_index]} >> 8) * \
+ (${bavail[max_index]} * bsize >> 16)))
+ min=$(((${ffree[min_index]} >> 8) * \
+ (${bavail[min_index]} * bsize >> 16)))
+ diff=$(((max - min) * 100 / min))
+ done
+
+ echo "MDT filesfree available: ${ffree[@]}"
+ echo "MDT blocks available: ${bavail[@]}"
+ echo "weight diff=$diff%"
echo "mkdir with balanced space usage"
$LCTL set_param lmv.*.qos_prio_free=100
for i in $(seq $((100 * MDSCOUNT))); do
mkdir $DIR/$tdir/subdir$i || error "mkdir subdir$i failed"
done
+
for i in $(seq $MDSCOUNT); do
count=$($LFS getdirstripe -i $DIR/$tdir/* | grep ^$((i - 1))$ |
wc -w)
echo "$count directories created on MDT$((i - 1))"
- [ $min -gt $count ] && min=$count
- [ $max -lt $count ] && max=$count
done
- [ $((max - min)) -gt $MDSCOUNT ] ||
+
+ max=$($LFS getdirstripe -i $DIR/$tdir/* | grep ^$max_index$ | wc -l)
+ min=$($LFS getdirstripe -i $DIR/$tdir/* | grep ^$min_index$ | wc -l)
+
+ [ $((max - min)) -lt 10 ] &&
error "subdirs shouldn't be evenly distributed"
which getfattr > /dev/null 2>&1 || skip_env "no getfattr command"
$LFS setdirstripe -D -d $DIR/$tdir || error "setdirstripe -d failed"
- getfattr -n trusted.dmv $DIR/$tdir && error "default dir layout exists"
- true
+ getfattr -n trusted.dmv $DIR/$tdir &&
+ error "default dir layout exists" || true
}
run_test 413b "mkdir with balanced space usage"
}
run_test 421g "rmfid to return errors properly"
+test_422() {
+ test_mkdir -i 0 -c 1 -p $DIR/$tdir/d1
+ test_mkdir -i 0 -c 1 -p $DIR/$tdir/d2
+ test_mkdir -i 0 -c 1 -p $DIR/$tdir/d3
+ dd if=/dev/zero of=$DIR/$tdir/d1/file1 bs=1k count=1
+ dd if=/dev/zero of=$DIR/$tdir/d2/file1 bs=1k count=1
+
+ local amc=$(at_max_get client)
+ local amo=$(at_max_get mds1)
+ local timeout=`lctl get_param -n timeout`
+
+ at_max_set 0 client
+ at_max_set 0 mds1
+
+#define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
+ do_facet mds1 $LCTL set_param fail_loc=0x8000050a \
+ fail_val=$(((2*timeout + 10)*1000))
+ touch $DIR/$tdir/d3/file &
+ sleep 2
+#define OBD_FAIL_TGT_REPLY_DATA_RACE 0x722
+ do_facet mds1 $LCTL set_param fail_loc=0x80000722 \
+ fail_val=$((2*timeout + 5))
+ mv $DIR/$tdir/d1/file1 $DIR/$tdir/d1/file2 &
+ local pid=$!
+ sleep 1
+ kill -9 $pid
+ sleep $((2 * timeout))
+ echo kill $pid
+ kill -9 $pid
+ lctl mark touch
+ touch $DIR/$tdir/d2/file3
+ touch $DIR/$tdir/d2/file4
+ touch $DIR/$tdir/d2/file5
+
+ wait
+ at_max_set $amc client
+ at_max_set $amo mds1
+}
+run_test 422 "kill a process with RPC in progress"
+
prep_801() {
[[ $(lustre_version_code mds1) -lt $(version_code 2.9.55) ]] ||
[[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&
}
run_test 818 "unlink with failed llog"
+test_819a() {
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=1
+ cancel_lru_locks osc
+ #define OBD_FAIL_OST_2BIG_NIOBUF 0x248
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000248
+ dd if=$DIR/$tfile of=/dev/null bs=1M count=1
+ rm -f $TDIR/$tfile
+}
+run_test 819a "too big niobuf in read"
+
+test_819b() {
+ #define OBD_FAIL_OST_2BIG_NIOBUF 0x248
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x80000248
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=1
+ cancel_lru_locks osc
+ sleep 1
+ rm -f $TDIR/$tfile
+}
+run_test 819b "too big niobuf in write"
+
#
# tests that do cleanup/setup should be run at the end
#