Module Name:    src
Committed By:   bouyer
Date:           Wed Jan 29 20:13:04 UTC 2014

Modified Files:
        src/sys/ufs/ufs: ufs_quota2.c

Log Message:
Patch from Edgar Fu� on tech-kern:
set grace time if lowering the limit cause the user/group to now be overquota.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/ufs/ufs/ufs_quota2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.36 src/sys/ufs/ufs/ufs_quota2.c:1.37
--- src/sys/ufs/ufs/ufs_quota2.c:1.36	Sun Oct 20 00:29:10 2013
+++ src/sys/ufs/ufs/ufs_quota2.c	Wed Jan 29 20:13:04 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.36 2013/10/20 00:29:10 htodd Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.37 2014/01/29 20:13:04 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.36 2013/10/20 00:29:10 htodd Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.37 2014/01/29 20:13:04 bouyer Exp $");
 
 #include <sys/buf.h>
 #include <sys/param.h>
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c
 #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>
@@ -627,6 +628,15 @@ quota2_handle_cmd_put(struct ufsmount *u
 		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);

Reply via email to