From 16c65421fc7dc81dcd8bb6500e135c3f36802ce6 Mon Sep 17 00:00:00 2001 From: anserper Date: Thu, 20 Aug 2009 19:09:01 +0000 Subject: [PATCH] b=16890 i=Johann Lombardi i=ZhiYong Tian do not reset grace times if setquota is given only hardlimit params --- lustre/tests/sanity-quota.sh | 24 ++++++++++++++++++++++++ lustre/utils/lfs.c | 11 +++++++++++ 2 files changed, 35 insertions(+) diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 88a6343..c4183f9 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -2103,6 +2103,30 @@ test_28() { } run_test_with_stat 28 "test for consistency for qunit when setquota (18574) ===========" +test_30() +{ + local output + local LIMIT=1024 + local TESTFILE="$DIR/$tdir/$tfile" + local GRACE=10 + + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir + + $LFS setquota -t -u --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR + $LFS setquota -u $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR + $RUNAS dd if=/dev/zero of=$TESTFILE bs=1024 count=$((LIMIT * 2)) || true + cancel_lru_locks osc + sleep 5 + $LFS setquota -u $TSTUSR -B 0 $DIR + output=`$SHOW_QUOTA_USER | grep $MOUNT | awk '{ print $5 }' | tr -d s` + [ "$output" -le "$((GRACE - 5))" ] || error "grace times were reset or unexpectedly high latency" + rm -f $TESTFILE + resetquota -u $TSTUSR + $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR +} +run_test_with_stat 30 "hard limit updates should not reset grace times ================" + # turn off quota quota_fini() { diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 3d1726f..3e4325c 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -1809,6 +1809,17 @@ int lfs_setquota(int argc, char **argv) dqb->dqb_ihardlimit = tmp_qctl.qc_dqblk.dqb_ihardlimit; if (!(limit_mask & ISLIMIT)) dqb->dqb_isoftlimit = tmp_qctl.qc_dqblk.dqb_isoftlimit; + + /* Keep grace times if we have got no softlimit arguments */ + if ((limit_mask & BHLIMIT) && !(limit_mask & BSLIMIT)) { + dqb->dqb_valid |= QIF_BTIME; + dqb->dqb_btime = tmp_qctl.qc_dqblk.dqb_btime; + } + + if ((limit_mask & IHLIMIT) && !(limit_mask & ISLIMIT)) { + dqb->dqb_valid |= QIF_ITIME; + dqb->dqb_itime = tmp_qctl.qc_dqblk.dqb_itime; + } } dqb->dqb_valid |= (limit_mask & (BHLIMIT | BSLIMIT)) ? QIF_BLIMITS : 0; -- 1.8.3.1