Date: Tue, 24 Apr 2012 11:15:25 +0200 From: Nikos Vassiliadis <nvass@gmx.com> To: Christian Lavoie <christian.lavoie@gmail.com> Cc: freebsd-virtualization@freebsd.org Subject: Re: kern/165252 patch Message-ID: <4F966F2D.1070709@gmx.com> In-Reply-To: <CAPdoznF15ft_hoN-pQbbKa7w-Au-Z76r0PdH_BcL2JTUO=X%2BCQ@mail.gmail.com> References: <CAPdoznF15ft_hoN-pQbbKa7w-Au-Z76r0PdH_BcL2JTUO=X%2BCQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------090606060902000909020903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 4/23/2012 6:33 PM, Christian Lavoie wrote: > The patch mentioned at > http://www.freebsd.org/cgi/query-pr.cgi?pr=165252&cat=kern#reply1 is > working for me -- without the patch my FreeBSD machine crashes within > a minute or two of booting, and with it it's been up for about half a > day now, under non-trivial networking load. > > I've contacted the author directly, and he asked that I mention here > that the patch is working for me, and ask that it be reviewed. Can > someone review said patch? > > I'm running 9.0-RELEASE, running two jails created following the > vimage/vnet howto at > http://wiki.polymorf.fr/index.php/Howto:FreeBSD_jail_vnet#Advenced_networking_:_NAT_and_firewalling > Hi Christian, You may want to try this better version of the patch. Warning: it's untested, I can't test it at moment in my FreeBSD-10, because pf panics in several places. I believe it should apply cleanly to FreeBSD-9.0. Nikos --------------090606060902000909020903 Content-Type: text/x-diff; name="pf.c[1].diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pf.c[1].diff" Index: sys/contrib/pf/net/pf.c =================================================================== --- sys/contrib/pf/net/pf.c (revision 234438) +++ sys/contrib/pf/net/pf.c (working copy) @@ -203,6 +203,8 @@ VNET_DEFINE(uma_zone_t, pf_state_key_pl); VNET_DEFINE(uma_zone_t, pf_state_item_pl); VNET_DEFINE(uma_zone_t, pf_altq_pl); + +#define V_cur VNET(cur) #else struct pf_state_tree pf_statetbl; @@ -1661,7 +1663,7 @@ pf_purge_expired_states(u_int32_t maxcheck) #endif { - static struct pf_state *cur = NULL; + static VNET_DEFINE(struct pf_state *, cur) = NULL; struct pf_state *next; #ifdef __FreeBSD__ int locked = waslocked; @@ -1671,20 +1673,20 @@ while (maxcheck--) { /* wrap to start of list when we hit the end */ - if (cur == NULL) { + if (V_cur == NULL) { #ifdef __FreeBSD__ - cur = TAILQ_FIRST(&V_state_list); + V_cur = TAILQ_FIRST(&V_state_list); #else - cur = TAILQ_FIRST(&state_list); + V_cur = TAILQ_FIRST(&state_list); #endif - if (cur == NULL) + if (V_cur == NULL) break; /* list empty */ } /* get next state, as cur may get deleted */ - next = TAILQ_NEXT(cur, entry_list); + next = TAILQ_NEXT(V_cur, entry_list); - if (cur->timeout == PFTM_UNLINKED) { + if (V_cur->timeout == PFTM_UNLINKED) { /* free unlinked state */ if (! locked) { #ifdef __FreeBSD__ @@ -1695,10 +1697,10 @@ #endif locked = 1; } - pf_free_state(cur); - } else if (pf_state_expires(cur) <= time_second) { + pf_free_state(V_cur); + } else if (pf_state_expires(V_cur) <= time_second) { /* unlink and free expired state */ - pf_unlink_state(cur); + pf_unlink_state(V_cur); if (! locked) { #ifdef __FreeBSD__ if (!sx_try_upgrade(&V_pf_consistency_lock)) @@ -1708,9 +1710,9 @@ #endif locked = 1; } - pf_free_state(cur); + pf_free_state(V_cur); } - cur = next; + V_cur = next; } #ifdef __FreeBSD__ --------------090606060902000909020903--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F966F2D.1070709>