pf: leave the epoch to purge unlinked rules

pf_purge_thread() calls pf_purge_unlinked_rules() in the network
epoch, where sleeping is not allowed, and it takes pf_config_lock, an
sx lock. If a rule is being added at the time, the purge thread
can sleep on the lock, which panics with INVARIANTS.

Reviewed by:		kp
Approved by:		kp (mentor)
Fixes:			f92d9b1aad ("pflow: import from OpenBSD")
MFC after:		1 week
Sponsored by:		Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D60160
This commit is contained in:
R. Christian McDonald committed 2026-09-30 19:30:54 -04:00
1 parent be7e57fbf9
commit 82ab4adec9
1 file changed
+6
+6
View File
@@ -2935,7 +2935,13 @@ pf_purge_thread(void *unused __unused)
*/
pf_purge_expired_fragments();
pf_purge_expired_src_nodes();
/*
* Takes the config lock, and may have to
* sleep for it.
*/
NET_EPOCH_EXIT(et);
pf_purge_unlinked_rules();
NET_EPOCH_ENTER(et);
pf_source_purge();
pfi_kkif_purge();
}