svn commit: r356711 - stable/12/sys/netinet
Alexander Motin
mav at FreeBSD.org
Tue Jan 14 00:50:31 UTC 2020
Author: mav
Date: Tue Jan 14 00:50:30 2020
New Revision: 356711
URL: https://svnweb.freebsd.org/changeset/base/356711
Log:
MFC r356240: 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.
Modified:
stable/12/sys/netinet/ip_carp.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/netinet/ip_carp.c
==============================================================================
--- stable/12/sys/netinet/ip_carp.c Mon Jan 13 23:09:00 2020 (r356710)
+++ stable/12/sys/netinet/ip_carp.c Tue Jan 14 00:50:30 2020 (r356711)
@@ -1232,14 +1232,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);
More information about the svn-src-stable
mailing list