Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen We can't take v_interlock with a spin lock ...



details:   https://anonhg.NetBSD.org/src/rev/d15ecd171758
branches:  trunk
changeset: 932405:d15ecd171758
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed May 06 19:49:00 2020 +0000

description:
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.

diffstat:

 sys/arch/xen/xen/xbdback_xenbus.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 78a9428b3eb9 -r d15ecd171758 sys/arch/xen/xen/xbdback_xenbus.c
--- a/sys/arch/xen/xen/xbdback_xenbus.c Wed May 06 19:47:05 2020 +0000
+++ b/sys/arch/xen/xen/xbdback_xenbus.c Wed May 06 19:49:00 2020 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/buf.h>
 #include <sys/condvar.h>
@@ -1387,6 +1387,8 @@
        }
        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 @@
                }
                /* 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:



Home | Main Index | Thread Index | Old Index