mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Relax locking of carp_forus().
This fixes deadlock between CARP and bridge. Bridge calls this function taking CARP lock while holding bridge lock. Same time CARP tries to send its announcements via the bridge while holding CARP lock. Use of CARP_LOCK() here does not solve anything, since sc_addr is constant while race on sc_state is harmless and use of the lock does not close it. Reviewed by: glebius MFC after: 2 weeks Sponsored by: iXsystems, Inc.
This commit is contained in:
parent
d930203192
commit
8c3fbf3c20
1 changed files with 4 additions and 3 deletions
|
|
@ -1230,14 +1230,15 @@ carp_forus(struct ifnet *ifp, u_char *dhost)
|
|||
|
||||
CIF_LOCK(ifp->if_carp);
|
||||
IFNET_FOREACH_CARP(ifp, sc) {
|
||||
CARP_LOCK(sc);
|
||||
/*
|
||||
* CARP_LOCK() is not here, since would protect nothing, but
|
||||
* cause deadlock with if_bridge, calling this under its lock.
|
||||
*/
|
||||
if (sc->sc_state == MASTER && !bcmp(dhost, LLADDR(&sc->sc_addr),
|
||||
ETHER_ADDR_LEN)) {
|
||||
CARP_UNLOCK(sc);
|
||||
CIF_UNLOCK(ifp->if_carp);
|
||||
return (1);
|
||||
}
|
||||
CARP_UNLOCK(sc);
|
||||
}
|
||||
CIF_UNLOCK(ifp->if_carp);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue