tcp: fix deregistering stacks when vnets are used

This fixes a bug where stacks could not be deregistered when
end points in the non-default vnet are using it.

Reviewed by:		glebius, zlei
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D39514
This commit is contained in:
Michael Tuexen 2023-04-12 10:52:53 +02:00
parent 305edaa479
commit 73c48d9d8f

View File

@ -1355,8 +1355,6 @@ deregister_tcp_functions(struct tcp_function_block *blk, bool quiesce,
* to the default stack.
*/
if (force && blk->tfb_refcnt) {
struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
INPLOOKUP_WLOCKPCB);
struct inpcb *inp;
struct tcpcb *tp;
VNET_ITERATOR_DECL(vnet_iter);
@ -1366,6 +1364,9 @@ deregister_tcp_functions(struct tcp_function_block *blk, bool quiesce,
VNET_LIST_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
INPLOOKUP_WLOCKPCB);
while ((inp = inp_next(&inpi)) != NULL) {
tp = intotcpcb(inp);
if (tp == NULL || tp->t_fb != blk)