if (lqe->lqe_is_default) {
rec->qbr_hardlimit = 0;
rec->qbr_softlimit = 0;
- rec->qbr_time = LQUOTA_GRACE_FLAG(0, LQUOTA_FLAG_DEFAULT);
+ rec->qbr_time = LQUOTA_GRACE_FLAG(lqe->lqe_gracetime,
+ LQUOTA_FLAG_DEFAULT);
} else {
rec->qbr_hardlimit = lqe->lqe_hardlimit;
rec->qbr_softlimit = lqe->lqe_softlimit;
/* change quota limits */
lqe->lqe_hardlimit = hard;
lqe->lqe_softlimit = soft;
+ if (is_default) {
+ dirtied = true;
+ GOTO(quota_write, 0);
+ }
quota_set:
/* recompute qunit in case it was never initialized */
dirtied = true;
}
+quota_write:
if (dirtied) {
if (!is_updated) {
/* write new quota settings to disk */
}
run_test 82 "verify more than 8 qids for single operation"
+test_grace_with_default_quota()
+{
+ local qtype=$1
+ local qdtype=$2
+ local bgrace
+ local igrace
+ local bgrace2
+ local igrace2
+ echo "ttt1"
+ $LFS setquota $qdtype -b 0 -B 0 -i 0 -I 0 $DIR ||
+ error "clear default quota [$qdtype] failed"
+ echo "ttt2"
+ $LFS setquota -t $qtype --block-grace 1w --inode-grace 1w $DIR ||
+ error "reset quota [$qdtype] grace failed"
+ echo "ttt3"
+
+ eval $($LFS quota -t $qtype $DIR | awk -F "[; ]" \
+ '{printf("bgrace=%s;igrace=%s;", $4, $9)}')
+ echo "ttt4"
+
+ $LFS setquota $qdtype -B 10G -i 10k $DIR
+ echo "ttt5"
+
+ eval $($LFS quota -t $qtype $DIR | awk -F "[; ]" \
+ '{printf("bgrace2=%s;igrace2=%s;", $4, $9)}')
+
+ [ "$bgrace" == "$bgrace2" ] ||
+ error "set default quota shouldn't affect block grace"
+ [ "$igrace" == "$igrace2" ] ||
+ error "set default quota shouldn't affect inode grace"
+
+}
+
+test_83()
+{
+ setup_quota_test || error "setup quota failed with $?"
+ test_grace_with_default_quota "-u" "-U"
+ test_grace_with_default_quota "-g" "-G"
+
+ is_project_quota_supported || return 0
+ test_grace_with_default_quota "-p" "-P"
+}
+run_test 83 "Setting default quota shouldn't affect grace time"
+
quota_fini()
{
do_nodes $(comma_list $(nodes_list)) \
char timebuf[40];
char strbuf[STRBUF_LEN];
+ dqb->dqb_btime &= LQUOTA_GRACE_MASK;
+ dqb->dqb_itime &= LQUOTA_GRACE_MASK;
+
if (dqb->dqb_bhardlimit &&
lustre_stoqb(dqb->dqb_curspace) >= dqb->dqb_bhardlimit) {
bover = 1;
else
printf("%15s", mnt);
- if (bover)
- diff2str(dqb->dqb_btime, timebuf, now);
- else if (show_default)
+ if (show_default)
snprintf(timebuf, sizeof(timebuf), "%llu",
(unsigned long long)dqb->dqb_btime);
+ else if (bover)
+ diff2str(dqb->dqb_btime, timebuf, now);
kbytes2str(lustre_stoqb(dqb->dqb_curspace),
strbuf, sizeof(strbuf), h);
numbuf[0], bover ? '*' : ' ', numbuf[1],
numbuf[2], bover > 1 ? timebuf : "-");
- if (iover)
- diff2str(dqb->dqb_itime, timebuf, now);
- else if (show_default)
+ if (show_default)
snprintf(timebuf, sizeof(timebuf), "%llu",
(unsigned long long)dqb->dqb_itime);
+ else if (iover)
+ diff2str(dqb->dqb_itime, timebuf, now);
snprintf(numbuf[0], sizeof(numbuf),
(dqb->dqb_valid & QIF_INODES) ? "%ju" : "[%ju]",