Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Oct 2015 23:42:13 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289273 - head/sys/dev/ntb/if_ntb
Message-ID:  <201510132342.t9DNgDR4015110@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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