Acquire kernel_lock in the bp->b_iodone callback.

This commit is contained in:
ad 2020-01-17 19:30:51 +00:00
parent 99c1972654
commit bdf8ebffe6
4 changed files with 17 additions and 8 deletions

View File

@ -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 @@ xbdback_iodone(struct buf *bp)
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_iodone(struct buf *bp)
xbdback_pool_put(&xbdback_io_pool, xbd_io);
xbdback_wakeup_thread(xbdi);
KERNEL_UNLOCK_ONE(NULL); /* XXXSMP */
}
/*

View File

@ -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 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
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 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
lddone(&sc->sc_ld, bp);
out:
KERNEL_UNLOCK_ONE(NULL); /* XXXSMP */
splx(s);
}

View File

@ -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 @@ cgdiodone(struct buf *nbp)
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

View File

@ -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 @@ vndiodone(struct buf *bp)
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 @@ vndiodone(struct buf *bp)
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;