xen-blkback: don't unbind the interrupt while holding the lock

There's no need to perform the interrupt unbind while holding the
blkback lock, and doing so leads to the following LOR:

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffff8000802fe90 xbbd1 (xbbd1) @ /usr/src/sys/dev/xen/blkback/blkback.c:3423
 2nd 0xffffffff81fdf890 intrsrc (intrsrc) @ /usr/src/sys/x86/x86/intr_machdep.c:224
stack backtrace:
#0 0xffffffff80bdd993 at witness_debugger+0x73
#1 0xffffffff80bdd814 at witness_checkorder+0xe34
#2 0xffffffff80b7d798 at _sx_xlock+0x68
#3 0xffffffff811b3913 at intr_remove_handler+0x43
#4 0xffffffff811c63ef at xen_intr_unbind+0x10f
#5 0xffffffff80a12ecf at xbb_disconnect+0x2f
#6 0xffffffff80a12e54 at xbb_shutdown+0x1e4
#7 0xffffffff80a10be4 at xbb_frontend_changed+0x54
#8 0xffffffff80ed66a4 at xenbusb_back_otherend_changed+0x14
#9 0xffffffff80a2a382 at xenwatch_thread+0x182
#10 0xffffffff80b34164 at fork_exit+0x84
#11 0xffffffff8101ec9e at fork_trampoline+0xe

Reported by:    Nathan Friess <nathan.friess@gmail.com>
Sponsored by:   Citrix Systems R&D
This commit is contained in:
Roger Pau Monné 2018-05-24 10:19:54 +00:00
parent b3a5ba30e5
commit e2e4a0e02a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334145

View File

@ -2803,9 +2803,8 @@ xbb_disconnect(struct xbb_softc *xbb)
if ((xbb->flags & XBBF_RING_CONNECTED) == 0)
return (0);
xen_intr_unbind(&xbb->xen_intr_handle);
mtx_unlock(&xbb->lock);
xen_intr_unbind(&xbb->xen_intr_handle);
taskqueue_drain(xbb->io_taskqueue, &xbb->io_task);
mtx_lock(&xbb->lock);