HomeFreeBSD

pf: Fix possible shutdown race

Description

pf: Fix possible shutdown race

Prevent possible races in the pf_unload() / pf_purge_thread() shutdown
code. Lock the pf_purge_thread() with the new pf_end_lock to prevent
these races.

Use a shared/exclusive lock, as we need to also acquire another sx lock
(VNET_LIST_RLOCK). It's fine for both pf_purge_thread() and pf_unload()
to sleep,

Pointed out by: eri, glebius, jhb
Differential Revision: https://reviews.freebsd.org/D10026

Details

Provenance
kpAuthored on
Differential Revision
D10026: pf: Fix possible shutdown race
Parents
rS315740: Simplify the code a little.
Branches
Unknown
Tags
Unknown