Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2012 16:13:04 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r238600 - stable/9/sys/contrib/pf/net
Message-ID:  <201207181613.q6IGD4gZ087600@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Jul 18 16:13:03 2012
New Revision: 238600
URL: http://svn.freebsd.org/changeset/base/238600

Log:
  Merge r230119, r238498 from head:
  
  ------------------------------------------------------------------------
  r230119 | csjp | 2012-01-15 02:51:34 +0400 (вс, 15 янв 2012) | 9 lines
  
  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
  
  ------------------------------------------------------------------------
  r238498 | glebius | 2012-07-15 23:10:00 +0400 (вс, 15 июл 2012) | 2 lines
  
  Use M_NOWAIT while holding the pf giant lock.
  
  Approved by:	re (kib)

Modified:
  stable/9/sys/contrib/pf/net/pf_if.c
  stable/9/sys/contrib/pf/net/pf_table.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)

Modified: stable/9/sys/contrib/pf/net/pf_if.c
==============================================================================
--- stable/9/sys/contrib/pf/net/pf_if.c	Wed Jul 18 15:52:09 2012	(r238599)
+++ stable/9/sys/contrib/pf/net/pf_if.c	Wed Jul 18 16:13:03 2012	(r238600)
@@ -506,8 +506,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *a
 	if (aw->type != PF_ADDR_DYNIFTL)
 		return (0);
 #ifdef __FreeBSD__
-	/* XXX: revisit! */
-	if ((dyn = pool_get(&V_pfi_addr_pl, PR_WAITOK | PR_ZERO))
+	if ((dyn = pool_get(&V_pfi_addr_pl, PR_NOWAIT | PR_ZERO))
 #else
 	if ((dyn = pool_get(&pfi_addr_pl, PR_WAITOK | PR_LIMITFAIL | PR_ZERO))
 #endif

Modified: stable/9/sys/contrib/pf/net/pf_table.c
==============================================================================
--- stable/9/sys/contrib/pf/net/pf_table.c	Wed Jul 18 15:52:09 2012	(r238599)
+++ stable/9/sys/contrib/pf/net/pf_table.c	Wed Jul 18 16:13:03 2012	(r238600)
@@ -926,16 +926,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)
@@ -2080,16 +2076,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?201207181613.q6IGD4gZ087600>