Source-Changes-HG archive

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

[src/trunk]: src/sys Acquire kernel_lock in the bp->b_iodone callback.



details:   https://anonhg.NetBSD.org/src/rev/9e8f8a810130
branches:  trunk
changeset: 848096:9e8f8a810130
user:      ad <ad%NetBSD.org@localhost>
date:      Fri Jan 17 19:30:51 2020 +0000

description:
Acquire kernel_lock in the bp->b_iodone callback.

diffstat:

 sys/arch/xen/xen/xbdback_xenbus.c |  7 +++++--
 sys/dev/ata/ld_ataraid.c          |  6 ++++--
 sys/dev/cgd.c                     |  6 ++++--
 sys/dev/vnd.c                     |  6 ++++--
 4 files changed, 17 insertions(+), 8 deletions(-)

diffs (132 lines):

diff -r 3455079d871f -r 9e8f8a810130 sys/arch/xen/xen/xbdback_xenbus.c
--- a/sys/arch/xen/xen/xbdback_xenbus.c Fri Jan 17 19:13:25 2020 +0000
+++ b/sys/arch/xen/xen/xbdback_xenbus.c Fri Jan 17 19:30:51 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback_xenbus.c,v 1.72 2019/04/07 12:21:20 bouyer Exp $      */
+/*      $NetBSD: xbdback_xenbus.c,v 1.73 2020/01/17 19:30:51 ad Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.72 2019/04/07 12:21:20 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.73 2020/01/17 19:30:51 ad Exp $");
 
 #include <sys/atomic.h>
 #include <sys/buf.h>
@@ -1620,6 +1620,8 @@
        struct xbdback_instance *xbdi;
        int errp;
 
+       KERNEL_LOCK(1, NULL);           /* XXXSMP */
+
        xbd_io = bp->b_private;
        xbdi = xbd_io->xio_xbdi;
 
@@ -1675,6 +1677,7 @@
        xbdback_pool_put(&xbdback_io_pool, xbd_io);
 
        xbdback_wakeup_thread(xbdi);
+       KERNEL_UNLOCK_ONE(NULL);        /* XXXSMP */
 }
 
 /*
diff -r 3455079d871f -r 9e8f8a810130 sys/dev/ata/ld_ataraid.c
--- a/sys/dev/ata/ld_ataraid.c  Fri Jan 17 19:13:25 2020 +0000
+++ b/sys/dev/ata/ld_ataraid.c  Fri Jan 17 19:30:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_ataraid.c,v 1.49 2019/01/27 02:08:41 pgoyette Exp $ */
+/*     $NetBSD: ld_ataraid.c,v 1.50 2020/01/17 19:31:31 ad Exp $ */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.49 2019/01/27 02:08:41 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.50 2020/01/17 19:31:31 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "bio.h"
@@ -500,6 +500,7 @@
        int s, iodone;
 
        s = splbio();
+       KERNEL_LOCK(1, NULL);           /* XXXSMP */
 
        iodone = cbp->cb_flags & CBUF_IODONE;
        other_cbp = cbp->cb_other;
@@ -571,6 +572,7 @@
                lddone(&sc->sc_ld, bp);
 
 out:
+       KERNEL_UNLOCK_ONE(NULL);        /* XXXSMP */
        splx(s);
 }
 
diff -r 3455079d871f -r 9e8f8a810130 sys/dev/cgd.c
--- a/sys/dev/cgd.c     Fri Jan 17 19:13:25 2020 +0000
+++ b/sys/dev/cgd.c     Fri Jan 17 19:30:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.118 2019/12/14 16:58:38 riastradh Exp $ */
+/* $NetBSD: cgd.c,v 1.119 2020/01/17 19:31:30 ad Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.118 2019/12/14 16:58:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.119 2020/01/17 19:31:30 ad Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -591,8 +591,10 @@
        if (obp->b_error != 0)
                obp->b_resid = obp->b_bcount;
 
+       KERNEL_LOCK(1, NULL);           /* XXXSMP */
        dk_done(dksc, obp);
        dk_start(dksc, NULL);
+       KERNEL_UNLOCK_ONE(NULL);        /* XXXSMP */
 }
 
 static int
diff -r 3455079d871f -r 9e8f8a810130 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Fri Jan 17 19:13:25 2020 +0000
+++ b/sys/dev/vnd.c     Fri Jan 17 19:30:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.272 2019/03/01 11:06:56 pgoyette Exp $       */
+/*     $NetBSD: vnd.c,v 1.273 2020/01/17 19:31:30 ad Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.272 2019/03/01 11:06:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.273 2020/01/17 19:31:30 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -968,6 +968,7 @@
        struct buf *obp = bp->b_private;
        int s = splbio();
 
+       KERNEL_LOCK(1, NULL);           /* XXXSMP */
        KASSERT(&vnx->vx_buf == bp);
        KASSERT(vnd->sc_active > 0);
 #ifdef DEBUG
@@ -982,6 +983,7 @@
        if (vnd->sc_active == 0) {
                wakeup(&vnd->sc_tab);
        }
+       KERNEL_UNLOCK_ONE(NULL);        /* XXXSMP */
        splx(s);
        obp->b_error = bp->b_error;
        obp->b_resid = bp->b_resid;



Home | Main Index | Thread Index | Old Index