Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Mar 2021 22:39:19 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4058265d605d - stable/12 - The list of ports in configuration path shall be protected by locks, epoch shall be used only for fast path. Thus use LAGG_XLOCK() in lagg_[un]register_vlan. This fixes sleeping in epoch panic.
Message-ID:  <202103092239.129MdJwn042632@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=4058265d605de7e6e66d9ad5153ac496f4f3c628

commit 4058265d605de7e6e66d9ad5153ac496f4f3c628
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2020-12-08 16:46:00 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-03-09 22:39:06 +0000

    The list of ports in configuration path shall be protected by locks,
    epoch shall be used only for fast path.  Thus use LAGG_XLOCK() in
    lagg_[un]register_vlan.  This fixes sleeping in epoch panic.
    
    PR:             240609
    (cherry picked from commit e1074ed6a08033ee571b4bedb3ffe6049a4a7361)
---
 sys/net/if_lagg.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index 049978bcfd6c..6831b40d099f 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -462,10 +462,10 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 	if (ifp->if_softc !=  arg)   /* Not our event */
 		return;
 
-	LAGG_RLOCK();
+	LAGG_XLOCK(sc);
 	CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
 		EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-	LAGG_RUNLOCK();
+	LAGG_XUNLOCK(sc);
 }
 
 /*
@@ -481,10 +481,10 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 	if (ifp->if_softc !=  arg)   /* Not our event */
 		return;
 
-	LAGG_RLOCK();
+	LAGG_XLOCK(sc);
 	CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
 		EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-	LAGG_RUNLOCK();
+	LAGG_XUNLOCK(sc);
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103092239.129MdJwn042632>