Author: cem
Date: Tue Oct 13 23:42:13 2015
New Revision: 289273
URL: https://svnweb.freebsd.org/changeset/base/289273

Log:
  NTB: MFV fca4d518: Fix ntb_transport link down race
  
  A WARN_ON is being hit in ntb_qp_link_work due to the NTB transport link
  being down while the ntb qp link is still active.  This is caused by the
  transport link being brought down prior to the qp link worker thread
  being terminated.  To correct this, shutdown the qp's prior to bringing
  the transport link down.  Also, only call the qp worker thread if it is
  in interrupt context, otherwise call the function directly.
  
  Authored by:  Jon Mason
  Obtained from:        Linux (Dual BSD/GPL driver)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ntb/if_ntb/if_ntb.c

Modified: head/sys/dev/ntb/if_ntb/if_ntb.c
==============================================================================
--- head/sys/dev/ntb/if_ntb/if_ntb.c    Tue Oct 13 23:41:40 2015        
(r289272)
+++ head/sys/dev/ntb/if_ntb/if_ntb.c    Tue Oct 13 23:42:13 2015        
(r289273)
@@ -519,7 +519,7 @@ ntb_transport_free(void *transport)
        struct ntb_softc *ntb = nt->ntb;
        int i;
 
-       nt->transport_link = NTB_LINK_DOWN;
+       ntb_transport_link_cleanup(nt);
 
        callout_drain(&nt->link_work);
 
@@ -1257,16 +1257,16 @@ ntb_transport_link_cleanup(struct ntb_ne
 {
        int i;
 
-       if (nt->transport_link == NTB_LINK_DOWN)
-               callout_drain(&nt->link_work);
-       else
-               nt->transport_link = NTB_LINK_DOWN;
-
        /* Pass along the info to any clients */
        for (i = 0; i < nt->max_qps; i++)
                if (!test_bit(i, &nt->qp_bitmap))
                        ntb_qp_link_down(&nt->qps[i]);
 
+       if (nt->transport_link == NTB_LINK_DOWN)
+               callout_drain(&nt->link_work);
+       else
+               nt->transport_link = NTB_LINK_DOWN;
+
        /* 
         * The scratchpad registers keep the values if the remote side
         * goes down, blast them now to give them a sane value the next
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to