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
This commit is contained in:
csjp 2012-01-14 22:51:34 +00:00
parent b166a3a409
commit 1ea7d0d666

View File

@ -927,16 +927,12 @@ pfr_create_kentry(struct pfr_addr *ad, int intr)
{ {
struct pfr_kentry *ke; struct pfr_kentry *ke;
#ifdef __FreeBSD__
ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
#else
if (intr) if (intr)
#ifdef __FreeBSD__
ke = pool_get(&V_pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
#else
ke = pool_get(&pfr_kentry_pl, PR_NOWAIT | PR_ZERO); ke = pool_get(&pfr_kentry_pl, PR_NOWAIT | PR_ZERO);
#endif
else 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); ke = pool_get(&pfr_kentry_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL);
#endif #endif
if (ke == NULL) if (ke == NULL)
@ -2081,16 +2077,12 @@ pfr_create_ktable(struct pfr_table *tbl, long tzero, int attachruleset,
struct pfr_ktable *kt; struct pfr_ktable *kt;
struct pf_ruleset *rs; struct pf_ruleset *rs;
#ifdef __FreeBSD__
kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
#else
if (intr) if (intr)
#ifdef __FreeBSD__
kt = pool_get(&V_pfr_ktable_pl, PR_NOWAIT|PR_ZERO);
#else
kt = pool_get(&pfr_ktable_pl, PR_NOWAIT|PR_ZERO|PR_LIMITFAIL); kt = pool_get(&pfr_ktable_pl, PR_NOWAIT|PR_ZERO|PR_LIMITFAIL);
#endif
else 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); kt = pool_get(&pfr_ktable_pl, PR_WAITOK|PR_ZERO|PR_LIMITFAIL);
#endif #endif
if (kt == NULL) if (kt == NULL)