Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Jan 2012 22:51:35 +0000 (UTC)
From:      "Christian S.J. Peron" <csjp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r230119 - head/sys/contrib/pf/net
Message-ID:  <201201142251.q0EMpZKd052199@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201142251.q0EMpZKd052199>