svn commit: r192127 - head/sys/dev/bge

Xin LI delphij at FreeBSD.org
Thu May 14 22:33:38 UTC 2009


Author: delphij
Date: Thu May 14 22:33:37 2009
New Revision: 192127
URL: http://svn.freebsd.org/changeset/base/192127

Log:
  Try to workaround a race where bge_stop() may sneak in when bge_rxeof()
  drops and re-grabs the softc mutex in the middle, resulting in kernel
  trap 12.  This may happen when a lot of traffic is being hammered on
  one bge(4) interface while the system is shutting down.
  
  Reported by:	Alexander Sack <pisymbol gmail com>
  PR:		kern/134548
  MFC After:	2 weeks

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Thu May 14 22:13:17 2009	(r192126)
+++ head/sys/dev/bge/if_bge.c	Thu May 14 22:33:37 2009	(r192127)
@@ -3193,6 +3193,9 @@ bge_rxeof(struct bge_softc *sc)
 		BGE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		BGE_LOCK(sc);
+
+		if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+			return;
 	}
 
 	if (stdcnt > 0)
@@ -3301,6 +3304,10 @@ bge_poll(struct ifnet *ifp, enum poll_cm
 
 	sc->rxcycles = count;
 	bge_rxeof(sc);
+	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+		BGE_UNLOCK(sc);
+		return;
+	}
 	bge_txeof(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		bge_start_locked(ifp);
@@ -3370,7 +3377,9 @@ bge_intr(void *xsc)
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		/* Check RX return ring producer/consumer. */
 		bge_rxeof(sc);
+	}
 
+	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		/* Check TX ring producer/consumer. */
 		bge_txeof(sc);
 	}


More information about the svn-src-head mailing list