Date: Tue, 14 Jan 2020 00:51:35 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r356712 - stable/11/sys/netinet Message-ID: <202001140051.00E0pZqT046038@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Tue Jan 14 00:51:35 2020 New Revision: 356712 URL: https://svnweb.freebsd.org/changeset/base/356712 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/11/sys/netinet/ip_carp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/ip_carp.c ============================================================================== --- stable/11/sys/netinet/ip_carp.c Tue Jan 14 00:50:30 2020 (r356711) +++ stable/11/sys/netinet/ip_carp.c Tue Jan 14 00:51:35 2020 (r356712) @@ -1136,14 +1136,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001140051.00E0pZqT046038>