Module Name:    src
Committed By:   msaitoh
Date:           Tue Mar 18 08:43:33 UTC 2014

Modified Files:
        src/sys/ufs/ufs [netbsd-6]: ufs_quota2.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1027):
        sys/ufs/ufs/ufs_quota2.c: revision 1.37
Patch from Edgar Fuss 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.34.2.1 -r1.34.2.2 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.34.2.1 src/sys/ufs/ufs/ufs_quota2.c:1.34.2.2
--- src/sys/ufs/ufs/ufs_quota2.c:1.34.2.1	Mon Oct  1 19:55:22 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Tue Mar 18 08:43:33 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.34.2.1 2012/10/01 19:55:22 riz Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.34.2.2 2014/03/18 08:43:33 msaitoh 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.34.2.1 2012/10/01 19:55:22 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota2.c,v 1.34.2.2 2014/03/18 08:43:33 msaitoh 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>
@@ -631,6 +632,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