svn commit: r230119 - head/sys/contrib/pf/net

Christian S.J. Peron csjp at FreeBSD.org
Sat Jan 14 22:51:35 UTC 2012


Author: csjp
Date: Sat Jan 14 22:51:34 2012
New Revision: 230119
URL: http://svn.freebsd.org/changeset/base/230119

Log:
  Revert to the old behavior of allocating table/table entries using
  M_NOWAIT.  Currently, the code allows for sleeping in the ioctl path
  to guarantee allocation.  However code also handles ENOMEM gracefully, so
  propagate this error back to user-space, rather than sleeping while
  holding the global pf mutex.
  
  Reviewed by:	glebius
  Discussed with:	bz

Modified:
  head/sys/contrib/pf/net/pf_table.c

Modified: head/sys/contrib/pf/net/pf_table.c
==============================================================================
--- head/sys/contrib/pf/net/pf_table.c	Sat Jan 14 22:46:18 2012	(r230118)
+++ head/sys/contrib/pf/net/pf_table.c	Sat Jan 14 22:51:34 2012	(r230119)
@@ -927,16 +927,12 @@ pfr_create_kentry(struct pfr_addr *ad, i
 {
 	struct pfr_kentry	*ke;
 
-	if (intr)
 #ifdef __FreeBSD__
-		ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
+	ke =  pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
 #else
+	if (intr)
 		ke = pool_get(&pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
-#endif
 	else
-#ifdef __FreeBSD__
-		ke = pool_get(&V_pfr_kentry_pl, PR_WAITOK|PR_ZERO);
-#else
 		ke = pool_get(&pfr_kentry_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL);
 #endif
 	if (ke == NULL)
@@ -2081,16 +2077,12 @@ pfr_create_ktable(struct pfr_table *tbl,
 	struct pfr_ktable	*kt;
 	struct pf_ruleset	*rs;
 
-	if (intr)
 #ifdef __FreeBSD__
-		kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
+	kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
 #else
+	if (intr)
 		kt = pool_get(&pfr_ktable_pl, PR_NOWAIT|PR_ZERO|PR_LIMITFAIL);
-#endif
 	else
-#ifdef __FreeBSD__
-		kt = pool_get(&V_pfr_ktable_pl, PR_WAITOK|PR_ZERO);
-#else
 		kt = pool_get(&pfr_ktable_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL);
 #endif
 	if (kt == NULL)


More information about the svn-src-head mailing list