pf: Fix incorrect rw_sleep() in pf_unload()
When we unload we don't hold the pf_rules_lock, so we cannot call rw_sleep() with it, because it would release a lock we do not hold. There's no need for the lock either, so we can just tsleep(). While here also make the same change in pf_purge_thread(), because it explicitly takes the lock before rw_sleep() and then immediately releases it afterwards.
This commit is contained in:
parent
acdb1504ff
commit
2a57d24bd1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315136
@ -1429,9 +1429,7 @@ pf_purge_thread(void *unused __unused)
|
||||
u_int idx = 0;
|
||||
|
||||
for (;;) {
|
||||
PF_RULES_RLOCK();
|
||||
rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftm", hz / 10);
|
||||
PF_RULES_RUNLOCK();
|
||||
tsleep(pf_purge_thread, 0, "pftm", hz / 10);
|
||||
|
||||
VNET_LIST_RLOCK();
|
||||
VNET_FOREACH(vnet_iter) {
|
||||
|
@ -3791,7 +3791,7 @@ pf_unload(void)
|
||||
pf_end_threads = 1;
|
||||
while (pf_end_threads < 2) {
|
||||
wakeup_one(pf_purge_thread);
|
||||
rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0);
|
||||
tsleep(pf_purge_thread, 0, "pftmo", 0);
|
||||
}
|
||||
|
||||
if (pf_dev != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user