tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

quota2 grace time (was: setting the quota2 grace period)



So, I'm not doing anything wrong.

The quota2 code simply lacks the logic to put the user into grace if the soft limit is exceeded not by raising the usage, but by lowering the limit.
The quota1 code has this logic in sys/ufs/ufs/ufs_quota1.c:637.

The attached patch tries to add an equivalent logic to ufs_quota2.c and appears to work. I have copied the non-correspondence of the wording in the comment and the order of logic in the code from the quota1 code. The logic first tests the "but" condition and then the condition the sentence begins with.


Btw., there's an equivalent logic in edquota which I can't believe doing anything useful. My impession is that qv_timelimit is ignored upon quota_put().
Index: ufs_quota2.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ufs/ufs_quota2.c,v
retrieving revision 1.34.2.1
diff -u -r1.34.2.1 ufs_quota2.c
--- ufs_quota2.c        1 Oct 2012 19:55:22 -0000       1.34.2.1
+++ ufs_quota2.c        22 Jul 2013 21:00:09 -0000
@@ -42,6 +42,7 @@
 #include <sys/wapbl.h>
 #include <sys/quota.h>
 #include <sys/quotactl.h>
+#include <sys/timevar.h>
 
 #include <ufs/ufs/quota2.h>
 #include <ufs/ufs/inode.h>
@@ -631,6 +632,15 @@
                goto out_il;
        
        quota2_ufs_rwq2e(q2ep, &q2e, needswap);
+       /*
+        * Reset time limit if previously had no soft limit or were
+        * under it, but now have a soft limit and are over it.
+        */
+       if (val->qv_softlimit &&
+           q2e.q2e_val[key->qk_objtype].q2v_cur >= val->qv_softlimit &&
+           (q2e.q2e_val[key->qk_objtype].q2v_softlimit == 0 ||
+            q2e.q2e_val[key->qk_objtype].q2v_cur < 
q2e.q2e_val[key->qk_objtype].q2v_softlimit))
+               q2e.q2e_val[key->qk_objtype].q2v_time = time_second + 
val->qv_grace;
        quota2_dict_update_q2e_limits(key->qk_objtype, val, &q2e);
        quota2_ufs_rwq2e(&q2e, q2ep, needswap);
        quota2_bwrite(ump->um_mountp, bp);


Home | Main Index | Thread Index | Old Index