eventhandler: Fix the NODEBUG build
Reported by: Michael Butler <imb at protected-networks.net>
Fixes: 735b16d490ae ("eventhandler: Fix a race when pruning eventhandlers")
(cherry picked from commit 3d8928114c4fec6cefbb1cd566ef8d1b3d2999e2)
eventhandler: Fix a race when pruning eventhandlers
By default, eventhandler_deregister() blocks until it reaches some point
where no threads are invoking the event. At this point, it knows that
1) no threads are currently executing the handler,
2) some thread has freed the eventhandler structure by virtue of having
called eventhandler_prune_list(),
so it is safe to return.
Suppose a thread is trying to deregister an event handler. A different
thread prunes it, and wakes up the first thread. Before the first
thread runs, a third thread grabs the event handler lock, and starts
executing handlers. The first thread observes el_runcount > 0, and goes
back to sleep. The third thread sees no event handlers to prune, and
doesn't wake up the first thread, which sleeps forever.
This change fixes the race and tries to make eventhandler_invoke() more
efficient: keep a count of the number of dead list entries and only
prune the list if there is at least one dead entry. Also, in
[9 lines not shown]
if_vlan: Use the exclusive lock everywhere
Running sys/net tests in parallel reveals some panics which look like
the one below:
```
shared lock of (sx) vlan_sx @ /home/markj/sb/main/src/sys/net/if_vlan.c:2395
while exclusively locked from /home/markj/sb/main/src/sys/net/if_vlan.c:1850
panic: excl->share
cpuid = 9
time = 1776467219
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00d84e0780
vpanic() at vpanic+0x136/frame 0xfffffe00d84e08b0
panic() at panic+0x43/frame 0xfffffe00d84e0910
witness_checkorder() at witness_checkorder+0xdb1/frame 0xfffffe00d84e0ad0
_sx_slock_int() at _sx_slock_int+0x64/frame 0xfffffe00d84e0b10
vlan_ioctl() at vlan_ioctl+0x25c/frame 0xfffffe00d84e0b70
if_setflag() at if_setflag+0xdc/frame 0xfffffe00d84e0be0
[29 lines not shown]
vtfontcvt: Return error from write_fnt_source
Previously write_fnt_source always returned 0, silently discarding
errors. Return rv so that errors set vtfontcvt's shell exit
appropriately.
Sponsored by: The FreeBSD Foundation
devel/pinact: Add port: CLI to pin GitHub Actions and Reusable Workflows
pinact is a CLI to edit GitHub Workflow and Composite action files and
pin versions of Actions and Reusable Workflows. pinact can also update
their versions and verify version annotations.
WWW: https://github.com/suzuki-shunsuke/pinact
www/lua-stream-nginx-module: Add new port
The lua-stream-nginx-module port provides the OpenResty
stream-lua-nginx-module third-party module source tree for
NGINX stream subsystem Lua integration.
WWW: https://github.com/openresty/stream-lua-nginx-module
Sponsored by: Netzkommune GmbH