svn commit: r238600 - stable/9/sys/contrib/pf/net

Gleb Smirnoff glebius at FreeBSD.org
Wed Jul 18 16:13:04 UTC 2012


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)


More information about the svn-src-all mailing list