Whamcloud - gitweb
b=16890
authoranserper <anserper>
Thu, 20 Aug 2009 19:09:01 +0000 (19:09 +0000)
committeranserper <anserper>
Thu, 20 Aug 2009 19:09:01 +0000 (19:09 +0000)
i=Johann Lombardi
i=ZhiYong Tian

do not reset grace times if setquota is given only hardlimit params

lustre/tests/sanity-quota.sh
lustre/utils/lfs.c

index 88a6343..c4183f9 100644 (file)
@@ -2103,6 +2103,30 @@ test_28() {
 }
 run_test_with_stat 28 "test for consistency for qunit when setquota (18574) ==========="
 
 }
 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()
 {
 # turn off quota
 quota_fini()
 {
index 3d1726f..3e4325c 100644 (file)
@@ -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;
                         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;
         }
 
         dqb->dqb_valid |= (limit_mask & (BHLIMIT | BSLIMIT)) ? QIF_BLIMITS : 0;