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
This commit is contained in:
Conrad Meyer 2015-10-13 23:42:13 +00:00
parent 2cd48421c9
commit 4d07d562c3

View File

@ -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_netdev *nt)
{
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