exec $LUSTRE/tests/sanity-quota-old.sh
fi
-# if e2fsprogs support quota feature?
-if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] && \
- ! $DEBUGFS -c -R supported_features | grep -q 'quota'; then
+# Does e2fsprogs support quota feature?
+if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
+ do_facet $SINGLEMDS "! $DEBUGFS -c -R supported_features |
+ grep -q 'quota'"; then
skip "e2fsprogs doesn't support quota" && exit 0
fi
+# bug number for skipped test: LU-4515
+ALWAYS_EXCEPT="$ALWAYS_EXCEPT 34"
+
if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
# bug number for skipped test: LU-2872 LU-2836 LU-2836 LU-2059
ALWAYS_EXCEPT="$ALWAYS_EXCEPT 1 3 6 7d"
build_test_filter
lustre_fail() {
- local fail_node=$1
+ local fail_node=$1
local fail_loc=$2
local fail_val=${3:-0}
+ local NODES=
- if [ $fail_node == "mds" ] || [ $fail_node == "mds_ost" ]; then
- do_facet $SINGLEMDS "lctl set_param fail_val=$fail_val"
- do_facet $SINGLEMDS "lctl set_param fail_loc=$fail_loc"
- fi
+ case $fail_node in
+ mds_ost|mdt_ost) NODES="$(comma_list $(mdts_nodes) $(osts_nodes))";;
+ mds|mdt) NODES="$(comma_list $(mdts_nodes))";;
+ ost) NODES="$(comma_list $(osts_nodes))";;
+ esac
- if [ $fail_node == "ost" ] || [ $fail_node == "mds_ost" ]; then
- for num in `seq $OSTCOUNT`; do
- do_facet ost$num "lctl set_param fail_val=$fail_val"
- do_facet ost$num "lctl set_param fail_loc=$fail_loc"
- done
- fi
+ do_nodes $NODES "lctl set_param fail_val=$fail_val fail_loc=$fail_loc"
}
RUNAS="runas -u $TSTID -g $TSTID"
rate=$((size * 1024 / delta))
if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
# LU-2872 - see LU-2887 for fix
- [ $rate -gt 256 ] ||
+ [ $rate -gt 64 ] ||
error "SLOW IO for $TSTUSR (user): $rate KB/sec"
else
[ $rate -gt 1024 ] ||
[ "$SLOW" = "no" ] && LIMIT=1024 # 1k inodes
- local FREE_INODES=$(lfs_df -i | grep "summary" | awk '{print $4}')
+ local FREE_INODES=$(mdt_free_inodes 0)
+ echo "$FREE_INODES free inodes on master MDT"
[ $FREE_INODES -lt $LIMIT ] &&
skip "not enough free inodes $FREE_INODES required $LIMIT" &&
return
rm -f $TMP/lustre-log-${TESTNAME}.log
- # write should continue & succeed
+ # write should continue then fail with EDQUOT
local count=0
- local o_size=$(stat -c %s $TESTFILE)
local c_size
while [ true ]; do
if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi
count=$((count + 1))
if [ $((count % 30)) -eq 0 ]; then
c_size=$(stat -c %s $TESTFILE)
- if [ $c_size -eq $o_size ]; then
- quota_error u $TSTUSR "file not growed" \
- "in 30 seconds $o_size/$c_size"
- else
- echo "Waiting $count secs. $o_size/$c_size"
- o_size=$c_size
- fi
+ echo "Waiting $count secs. $c_size"
+ $SHOW_QUOTA_USER
fi
sleep 1
done
# trigger reintegration
local procf="osd-$(facet_fstype ost1).$FSNAME-OST*."
procf=${procf}quota_slave.force_reint
- $LCTL set_param $procf=1 || "force reintegration failed"
+ do_facet ost1 $LCTL set_param $procf=1 ||
+ error "force reintegration failed"
echo "Stop mds..."
stop mds1
# test when mds does failover, the ost still could work well
# this test shouldn't trigger watchdog b=14840
test_18() {
+ # Clear dmesg so watchdog is not triggered by previous
+ # test output
+ do_facet ost1 dmesg -c > /dev/null
+
test_18_sub normal
test_18_sub directio
# check if watchdog is triggered
do_facet ost1 dmesg > $TMP/lustre-log-${TESTNAME}.log
- local watchdog=$(awk '/sanity-quota test 18/ {start = 1;}
- /Service thread pid/ && /was inactive/ {
- if (start) {
- print;
- }
- }' $TMP/lustre-log-${TESTNAME}.log)
+ local watchdog=$(awk '/Service thread pid/ && /was inactive/ \
+ { print; }' $TMP/lustre-log-${TESTNAME}.log)
[ -z "$watchdog" ] || error "$watchdog"
rm -f $TMP/lustre-log-${TESTNAME}.log
}
}
run_test 27b "lfs quota/setquota should handle user/group ID (b20200)"
+test_27c() {
+ local limit
+
+ $LFS setquota -u $TSTID -b 30M -B 3T $DIR ||
+ error "lfs setquota failed"
+
+ limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $3}')
+ [ $limit != "30M" ] && error "softlimit $limit isn't human-readable"
+ limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $4}')
+ [ $limit != "3T" ] && error "hardlimit $limit isn't human-readable"
+
+ $LFS setquota -u $TSTID -b 1500M -B 18500G $DIR ||
+ error "lfs setquota for $TSTID failed"
+
+ limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $3}')
+ [ $limit != "1.465G" ] && error "wrong softlimit $limit"
+ limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $4}')
+ [ $limit != "18.07T" ] && error "wrong hardlimit $limit"
+
+ $LFS quota -u $TSTID -v -h $DIR | grep -q "Total allocated" ||
+ error "total allocated inode/block limit not printed"
+
+ resetquota -u $TSTUSR
+}
+run_test 27c "lfs quota should support human-readable output"
+
test_30() {
local output
local LIMIT=4 # 4MB
# over-quota flag has not yet settled since we do not trigger async
# events based on grace time period expiration
$SHOW_QUOTA_USER
- $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=1 || true
+ $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=4 || true
cancel_lru_locks osc
# now over-quota flag should be settled and further writes should fail
$SHOW_QUOTA_USER
- $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=1 &&
+ $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=4 &&
error "grace times were reset"
# cleanup
cleanup_quota_test
do_node $mdt0_node mkdir $mntpt/OBJECTS
do_node $mdt0_node cp $LUSTRE/tests/admin_quotafile_v2.usr $mntpt/OBJECTS
do_node $mdt0_node cp $LUSTRE/tests/admin_quotafile_v2.grp $mntpt/OBJECTS
- do_node $mdt0_node umount -f $mntpt
+ do_node $mdt0_node umount -d -f $mntpt
echo "Setup all..."
setupall