xen-netback: fix LOR

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffffe00357ff538 xnb_softc (xen netback softc lock) @ /usr/src/sys/dev/xen/netback/netback.c:1069
 2nd 0xffffffff81fdccb0 intrsrc (intrsrc) @ /usr/src/sys/x86/x86/intr_machdep.c:224

There's no need to hold the lock since the cleaning of the interrupt
cannot happen in parallel due to the XNBF_IN_SHUTDOWN flag being set.
Note that the locking in netback needs some improvement or
clarification.

While there also remove a double newline.

Sponsored by:   Citrix Systems R&D
This commit is contained in:
royger 2018-06-26 14:07:11 +00:00
parent cc43f1dd4f
commit de5c5868df

View File

@ -662,6 +662,7 @@ xnb_disconnect(struct xnb_softc *xnb)
mtx_lock(&xnb->rx_lock);
mtx_unlock(&xnb->rx_lock);
mtx_lock(&xnb->sc_lock);
/* Free malloc'd softc member variables */
if (xnb->bridge != NULL) {
free(xnb->bridge, M_XENSTORE);
@ -689,6 +690,8 @@ xnb_disconnect(struct xnb_softc *xnb)
sizeof(struct xnb_ring_config));
xnb->flags &= ~XNBF_RING_CONNECTED;
mtx_unlock(&xnb->sc_lock);
return (0);
}
@ -1066,18 +1069,15 @@ xnb_shutdown(struct xnb_softc *xnb)
if_free(xnb->xnb_ifp);
xnb->xnb_ifp = NULL;
}
mtx_lock(&xnb->sc_lock);
xnb_disconnect(xnb);
mtx_unlock(&xnb->sc_lock);
if (xenbus_get_state(xnb->dev) < XenbusStateClosing)
xenbus_set_state(xnb->dev, XenbusStateClosing);
mtx_lock(&xnb->sc_lock);
xnb->flags &= ~XNBF_IN_SHUTDOWN;
/* Indicate to xnb_detach() that is it safe to proceed. */
wakeup(xnb);