[[ $(id -g $TSTUSR2) == $TSTID2 ]] || resetquota_one -g $TSTID2
is_project_quota_supported && resetquota_one -p $TSTPRJID
+ $LFS setquota -U -b 0 -B 0 -i 0 -I 0 $MOUNT ||
+ error "failed to reset default user quota"
+ $LFS setquota -G -b 0 -B 0 -i 0 -I 0 $MOUNT ||
+ error "failed to reset default group quota"
+ is_project_quota_supported &&
+ $LFS setquota -P -b 0 -B 0 -i 0 -I 0 $MOUNT ||
+ error "failed to reset default project quota"
+
sleep 1
}
}
run_test 41 "df should return projid-specific values"
+test_lfs_quota()
+{
+ local qdtype=$1
+ local qtype=$2
+ local bsl
+ local bhl
+ local isl
+ local ihl
+
+ eval $($LFS quota $qtype 2147483647 $MOUNT |
+ awk 'NR = 2 {printf("bsl=%d;bhl=%d;isl=%d;ihl=%d;", \
+ $3, $4, $7, $8)}')
+
+ (( $bsl != 0 || $bhl != 0 || $isl != 0 || $ihl != 0 )) &&
+ skip "qid 2147483647 is already used"
+
+ $LFS setquota $qdtype -b 100M -B 200M $MOUNT ||
+ error "fail to set default quota"
+
+ eval $($LFS quota $qtype 2147483647 $MOUNT |
+ awk 'NR = 2 {printf("bsl=%d;bhl=%d;isl=%d;ihl=%d;", \
+ $3, $4, $7, $8)}')
+
+ [ $bsl -ne 102400 -o $bhl -ne 204800 ] &&
+ error "fail to include default block quota"
+
+ $LFS setquota $qdtype -i 10K -I 20K $MOUNT ||
+ error "fail to set default quota"
+
+ eval $($LFS quota $qtype 2147483647 $MOUNT |
+ awk 'NR = 2 {printf("bsl=%d;bhl=%d;isl=%d;ihl=%d;", \
+ $3, $4, $7, $8)}')
+
+ [ $isl -ne 10240 -o $ihl -ne 20480 ] &&
+ error "fail to include default file quota"
+}
+
+test_42()
+{
+ setup_quota_test || error "setup quota failed with $?"
+ quota_init
+
+ test_lfs_quota "-U" "-u"
+ test_lfs_quota "-G" "-g"
+ is_project_quota_supported && test_lfs_quota "-P" "-p"
+
+ cleanup_quota_test
+}
+run_test 42 "lfs quota should include default quota info"
+
test_delete_qid()
{
local qslv_file=$1
char *obd_type = (char *)qctl->obd_type;
char *obd_uuid = (char *)qctl->obd_uuid.uuid;
__u64 total_ialloc = 0, total_balloc = 0;
- bool use_default_for_blk = false;
- bool use_default_for_file = false;
int inacc;
if (!show_default && qctl->qc_id == 0) {
}
if (qctl->qc_dqblk.dqb_valid & QIF_BTIME &&
- LQUOTA_FLAG(qctl->qc_dqblk.dqb_btime) & LQUOTA_FLAG_DEFAULT) {
- use_default_for_blk = true;
+ LQUOTA_FLAG(qctl->qc_dqblk.dqb_btime) & LQUOTA_FLAG_DEFAULT)
qctl->qc_dqblk.dqb_btime &= LQUOTA_GRACE_MASK;
- }
if (qctl->qc_dqblk.dqb_valid & QIF_ITIME &&
- LQUOTA_FLAG(qctl->qc_dqblk.dqb_itime) & LQUOTA_FLAG_DEFAULT) {
- use_default_for_file = true;
+ LQUOTA_FLAG(qctl->qc_dqblk.dqb_itime) & LQUOTA_FLAG_DEFAULT)
qctl->qc_dqblk.dqb_itime &= LQUOTA_GRACE_MASK;
- }
if (!show_qid && (qctl->qc_cmd == LUSTRE_Q_GETQUOTA ||
qctl->qc_cmd == LUSTRE_Q_GETQUOTAPOOL ||
(uintmax_t)total_ialloc, strbuf);
}
- if (use_default_for_blk)
- printf("%cid %u is using default block quota setting\n",
- *qtype_name(qctl->qc_type), qctl->qc_id);
-
- if (use_default_for_file)
- printf("%cid %u is using default file quota setting\n",
- *qtype_name(qctl->qc_type), qctl->qc_id);
-
if (!show_qid && (rc || rc1 || rc2 || inacc))
printf("%d Some errors happened when getting quota info. Some devices may be not working or deactivated. The data in \"[]\" is inaccurate.\n", inacc);