Author: delphij
Date: Wed May 20 21:17:10 2009
New Revision: 192478
URL: http://svn.freebsd.org/changeset/base/192478

Log:
  MFC r192127:
  
  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

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/dev/bge/if_bge.c

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c       Wed May 20 21:13:49 2009        
(r192477)
+++ stable/7/sys/dev/bge/if_bge.c       Wed May 20 21:17:10 2009        
(r192478)
@@ -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);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to