From 7cfb6126f76369728c04d6549a04a27e4aa4bda7 Mon Sep 17 00:00:00 2001 From: bouyer Date: Wed, 6 May 2020 19:49:00 +0000 Subject: [PATCH] We can't take v_interlock with a spin lock held. Release xbdi_lock before scheduling the I/O, and take again once queued. It looks safe to drop the lock here. --- sys/arch/xen/xen/xbdback_xenbus.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/arch/xen/xen/xbdback_xenbus.c b/sys/arch/xen/xen/xbdback_xenbus.c index 7b714a40c3a0..cf1387dfa6a0 100644 --- a/sys/arch/xen/xen/xbdback_xenbus.c +++ b/sys/arch/xen/xen/xbdback_xenbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.93 2020/05/05 17:02:01 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.94 2020/05/06 19:49:00 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.93 2020/05/05 17:02:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.94 2020/05/06 19:49:00 bouyer Exp $"); #include #include @@ -1387,6 +1387,8 @@ xbdback_co_do_io(struct xbdback_instance *xbdi, void *obj) } case BLKIF_OP_READ: case BLKIF_OP_WRITE: + KASSERT(mutex_owned(&xbdi->xbdi_lock)); + mutex_exit(&xbdi->xbdi_lock); xbd_io->xio_buf.b_data = (void *) (xbd_io->xio_vaddr + xbd_io->xio_start_offset); @@ -1397,6 +1399,7 @@ xbdback_co_do_io(struct xbdback_instance *xbdi, void *obj) } /* will call xbdback_iodone() asynchronously when done */ bdev_strategy(&xbd_io->xio_buf); + mutex_enter(&xbdi->xbdi_lock); xbdi->xbdi_cont = xbdback_co_main_incr; return xbdi; default: