[ "$SLOW" = "no" ] && EXCEPT_SLOW="61"
if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
- # bug number for skipped test: LU-2836 LU-6836 LU-2836
- ALWAYS_EXCEPT="$ALWAYS_EXCEPT 3 4a 6"
+ # bug number for skipped test: LU-6836
+ ALWAYS_EXCEPT="$ALWAYS_EXCEPT 4a"
# bug number: LU-2887
# Test duration: 21 9 min"
local free_space=$(lfs_df | grep "summary" | awk '{print $4}')
[ $free_space -le $((MB * 1024)) ] &&
skip "not enough space ${free_space} KB, " \
- "required $((MB * 1024)) KB" && return
+ "required $((MB * 1024)) KB"
setup_quota_test || error "setup quota failed with $?"
trap cleanup_quota_test EXIT
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
+ skip "not enough free inodes $FREE_INODES required $LIMIT"
setup_quota_test || error "setup quota failed with $?"
trap cleanup_quota_test EXIT
# quota reintegration (inode limits)
test_7e() {
- [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs" && return
+ [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
# LU-2435: skip this quota test if underlying zfs version has not
# supported native dnode accounting
local feature=$(do_facet mds1 $ZPOOL get -H $F $pool)
[[ "$feature" != *" active "* ]] &&
- skip "requires zpool with active userobj_accounting" &&
- return
+ skip "requires zpool with active userobj_accounting"
}
local ilimit=$((1024 * 2)) # 2k inodes
run_test 11 "Chown/chgrp ignores quota"
test_12a() {
- [ "$OSTCOUNT" -lt "2" ] && skip "needs >= 2 OSTs" && return
+ [ "$OSTCOUNT" -lt "2" ] && skip "needs >= 2 OSTs"
local blimit=22 # 22M
local blk_cnt=$((blimit - 5))
run_test 12a "Block quota rebalancing"
test_12b() {
- [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs" && return
+ [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
local ilimit=$((1024 * 2)) # 2k inodes
local TESTFILE0=$DIR/$tdir/$tfile
test_23() {
[ $(facet_fstype ost1) == "zfs" ] &&
skip "Overwrite in place is not guaranteed to be " \
- "space neutral on ZFS" && return
+ "space neutral on ZFS"
local OST0_MIN=$((6 * 1024)) # 6MB, extra space for meta blocks.
check_whether_skip && return 0
# LU-5006
test_37() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.93) ] &&
- skip "Old server doesn't have LU-5006 fix." && return
+ skip "Old server doesn't have LU-5006 fix."
setup_quota_test || error "setup quota failed with $?"
trap cleanup_quota_test EXIT
# LU-8801
test_38() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.60) ] &&
- skip "Old server doesn't have LU-8801 fix." && return
+ skip "Old server doesn't have LU-8801 fix."
[ "$UID" != 0 ] && skip_env "must run as root" && return
test_39() {
local TESTFILE="$DIR/$tdir/project"
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
setup_quota_test || error "setup quota failed with $?"
test_40a() {
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
local dir1="$DIR/$tdir/dir1"
local dir2="$DIR/$tdir/dir2"
test_40b() {
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
local dir1="$DIR/$tdir/dir1"
local dir2="$DIR/$tdir/dir2"
run_test 40b "Mv across different project ID"
test_40c() {
- [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs" && return
+ [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
setup_quota_test || error "setup quota failed with $?"
local dir="$DIR/$tdir/dir"
test_50() {
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
setup_quota_test || error "setup quota failed with $?"
local dir="$DIR/$tdir/dir"
test_51() {
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
setup_quota_test || error "setup quota failed with $?"
local dir="$DIR/$tdir/dir"
test_52() {
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
setup_quota_test || error "setup quota failed with $?"
local dir="$DIR/$tdir/dir"
mkdir $dir && change_project -sp 1 $dir
test_53() {
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
setup_quota_test || error "setup quota failed with $?"
local dir="$DIR/$tdir/dir"
mkdir $dir && change_project -s $dir
test_54() {
! is_project_quota_supported &&
- skip "Project quota is not supported" && return 0
+ skip "Project quota is not supported"
setup_quota_test || error "setup quota failed with $?"
trap cleanup_quota_test EXIT
local testfile="$DIR/$tdir/$tfile-0"
test_55() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
- skip "Not supported before 2.10.58." && return
+ skip "Not supported before 2.10.58."
setup_quota_test || error "setup quota failed with $?"
set_ost_qtype $QTYPE || error "enable ost quota failed"
run_test 57 "lfs project could tolerate errors"
test_59() {
- if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
+ [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
skip "ldiskfs only test"
- return
- fi
disable_project_quota
setup_quota_test || error "setup quota failed with $?"
quota_init
# test default quota
test_default_quota() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.51) ] &&
- skip "Not supported before 2.11.51." && return
+ skip "Not supported before 2.11.51."
local qtype=$1
local qpool=$2
}
run_test 61 "default quota tests"
+test_62() {
+ ! is_project_quota_supported &&
+ skip "Project quota is not supported"
+ [[ "$(chattr -h 2>&1)" =~ "project" ]] ||
+ skip "chattr did not support project quota"
+ setup_quota_test || error "setup quota failed with $?"
+ local testdir=$DIR/$tdir/
+
+ $RUNAS mkdir -p $testdir || error "failed to mkdir"
+ change_project -s $testdir
+ [[ $($LFS project -d $testdir) =~ "P" ]] ||
+ error "inherit attribute should be set"
+ # chattr used FS_IOC_SETFLAGS ioctl
+ $RUNAS chattr -P $testdir &&
+ error "regular user clear inherit should fail"
+ [[ $($LFS project -d $testdir) =~ "P" ]] ||
+ error "inherit attribute should still be set"
+ chattr -P $testdir || error "root failed to clear inherit"
+ [[ $($LFS project -d $testdir) =~ "P" ]] &&
+ error "inherit attribute should be cleared"
+ cleanup_quota_test
+}
+run_test 62 "Project inherit should be only changed by root"
+
+test_dom() {
+ [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.55) ] &&
+ skip "Not supported before 2.11.55" && return
+
+ local qtype=$1
+ local qid=$TSTUSR
+ local dd_failed=false
+ local tdir_dom=${tdir}_dom
+ local LIMIT=20480 #20M
+
+ [ $qtype == "p" ] && ! is_project_quota_supported &&
+ echo "Project quota is not supported" && return 0
+
+ [ $qtype == "p" ] && qid=$TSTPRJID
+
+ setup_quota_test || error "setup quota failed with $?"
+ trap cleanup_quota_test EXIT
+
+ quota_init
+
+ # enable mdt/ost quota
+ set_mdt_qtype $QTYPE || error "enable mdt quota failed"
+ set_ost_qtype $QTYPE || error "enable ost quota failed"
+
+ # make sure the system is clean
+ local USED=$(getquota -$qtype $qid global curspace)
+ [ $USED -ne 0 ] && error "Used space for $qid isn't 0."
+
+ chown $TSTUSR.$TSTUSR $DIR/$tdir || error "chown $tdir failed"
+
+ mkdir $DIR/$tdir_dom || error "mkdir $tdir_dom failed"
+ $SETSTRIPE -E 1M -L mdt $DIR/$tdir_dom ||
+ error "setstripe $tdir_dom failed"
+ chown $TSTUSR.$TSTUSR $DIR/$tdir_dom || error "chown $tdir_dom failed"
+
+ [ $qtype == "p" ] && {
+ change_project -sp $TSTPRJID $DIR/$tdir
+ change_project -sp $TSTPRJID $DIR/$tdir_dom
+ }
+
+ $LFS setquota -$qtype $qid -b $LIMIT -B $LIMIT $DIR ||
+ error "set $qid quota failed"
+
+ for ((i = 0; i < $((LIMIT/2048)); i++)); do
+ $RUNAS $DD of=$DIR/$tdir_dom/$tfile-$i count=1 oflag=sync ||
+ dd_failed=true
+ done
+
+ $dd_failed && quota_error $qtype $qid "write failed, expect succeed"
+
+ for ((i = $((LIMIT/2048)); i < $((LIMIT/1024 + 10)); i++)); do
+ $RUNAS $DD of=$DIR/$tdir_dom/$tfile-$i count=1 oflag=sync ||
+ dd_failed=true
+ done
+
+ $dd_failed || quota_error $qtype $qid "write succeed, expect EDQUOT"
+
+ rm -f $DIR/$tdir_dom/*
+
+ # flush cache, ensure noquota flag is set on client
+ cancel_lru_locks osc
+ cancel_lru_locks mdc
+ sync; sync_all_data || true
+
+ dd_failed=false
+
+ $RUNAS $DD of=$DIR/$tdir/file count=$((LIMIT/2048)) oflag=sync ||
+ quota_error $qtype $qid "write failed, expect succeed"
+
+ for ((i = 0; i < $((LIMIT/2048 + 10)); i++)); do
+ $RUNAS $DD of=$DIR/$tdir_dom/$tfile-$i count=1 oflag=sync ||
+ dd_failed=true
+ done
+
+ $dd_failed || quota_error $qtype $TSTID "write succeed, expect EDQUOT"
+
+ rm -f $DIR/$tdir/*
+ rm -f $DIR/$tdir_dom/*
+
+ # flush cache, ensure noquota flag is set on client
+ cancel_lru_locks osc
+ cancel_lru_locks mdc
+ sync; sync_all_data || true
+
+ dd_failed=false
+
+ for ((i = 0; i < $((LIMIT/2048)); i++)); do
+ $RUNAS $DD of=$DIR/$tdir_dom/$tfile-$i count=1 oflag=sync ||
+ dd_failed=true
+ done
+
+ $dd_failed && quota_error $qtype $qid "write failed, expect succeed"
+
+ $RUNAS $DD of=$DIR/$tdir/file count=$((LIMIT/2048 + 10)) oflag=sync &&
+ quota_error $qtype $qid "write succeed, expect EDQUOT"
+
+ rm -f $DIR/$tdir/*
+ rm -fr $DIR/$tdir_dom
+
+ $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR ||
+ error "reset usr quota failed"
+
+ cleanup_quota_test
+}
+
+test_63() {
+ test_dom "u"
+ test_dom "g"
+ test_dom "p"
+}
+run_test 63 "quota on DoM tests"
+
quota_fini()
{
do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"