PERFORCE change 188787 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Feb 13 17:07:32 UTC 2011


http://p4web.freebsd.org/@@188787?ac=10

Change 188787 by trasz at trasz_victim on 2011/02/13 17:06:50

	If warning couldn't be logged due to ppsratecheck(), don't mark link
	as exceeded; this way we might log a warning later.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#31 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#31 (text+ko) ====

@@ -280,7 +280,7 @@
 	struct rctl_rule *rule;
 	struct rctl_rule_link *link;
 	struct sbuf sb;
-	int should_deny = 0, already_exceeded;
+	int should_deny = 0;
 	char *buf;
 	static int curtime = 0;
 	static struct timeval lasttime;
@@ -300,15 +300,16 @@
 			continue;
 		}
 
-		already_exceeded = link->rrl_exceeded;
-		link->rrl_exceeded = 1;
-
 		switch (rule->rr_action) {
 		case RCTL_ACTION_DENY:
 			should_deny = 1;
 			continue;
 		case RCTL_ACTION_LOG:
-			if (already_exceeded)
+			/*
+			 * If rrl_exceeded != 0, it means we've already
+			 * logged a warning for this process.
+			 */
+			if (link->rrl_exceeded != 0)
 				continue;
 
 			if (!ppsratecheck(&lasttime, &curtime, 10))
@@ -328,9 +329,10 @@
 			    p->p_ucred->cr_prison->pr_id);
 			sbuf_delete(&sb);
 			free(buf, M_RCTL);
+			link->rrl_exceeded = 1;
 			continue;
 		default:
-			if (already_exceeded)
+			if (link->rrl_exceeded != 0)
 				continue;
 
 			KASSERT(rule->rr_action > 0 &&
@@ -343,6 +345,7 @@
 			 * are equal to their counterparts from sys/signal.h.
 			 */
 			psignal(p, rule->rr_action);
+			link->rrl_exceeded = 1;
 			continue;
 		}
 	}


More information about the p4-projects mailing list