CVSROOT:        /cvs
Module name:    src
Changes by:     d...@cvs.openbsd.org    2019/11/07 01:03:18

Modified files:
        sys/net        : if.c 

Log message:
serialise hook adds and dels with a mutex instead of an implicit NET_LOCK.

i had NET_ASSERT_LOCKED() in the hook add and remove operations,
because that's what's held when the hooks are run. some callers do
not hold the NET_LOCK when calling them though, eg, bridge(4). aggr
and tpmr used to not hold NET_LOCK while being destroyed, which
also caused the asserts to fire, so i moved the port destroys inside
NET_LOCK, but now I have deadlocks with some barrier calls.

the hooks having their own lock means callers don't have to hold
NET_LOCK and the list will stay sane. the code that runs the hooks
gives up the mutex when calling the hook, but keeps track of where
it's up to bey putting a cursor in the list.

there's a single global mutex for all the interface linkstate and
detach hooks, but this stuff isn't a hot path by any stretch of the
imagination.

based on (a lot of) testing by hrvoje popovski. thank you.

Reply via email to