From a8568c930a6a13c941b2e1140c3c3690bf9d1a13 Mon Sep 17 00:00:00 2001 From: mrg Date: Sun, 11 Mar 2012 02:16:55 +0000 Subject: [PATCH] scsidevdetached ioctl path enters scsipi code without kernel lock and this upsets the newer kasserts. take kernel lock here. --- sys/dev/scsipi/scsiconf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/scsipi/scsiconf.c b/sys/dev/scsipi/scsiconf.c index 95faf780e3e4..1b72330a49b7 100644 --- a/sys/dev/scsipi/scsiconf.c +++ b/sys/dev/scsipi/scsiconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken Exp $ */ +/* $NetBSD: scsiconf.c,v 1.263 2012/03/11 02:16:55 mrg Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.263 2012/03/11 02:16:55 mrg Exp $"); #include #include @@ -378,11 +378,17 @@ scsidevdetached(device_t self, device_t child) target = device_locator(child, SCSIBUSCF_TARGET); lun = device_locator(child, SCSIBUSCF_LUN); + /* XXXSMP scsipi */ + KERNEL_LOCK(1, curlwp); + periph = scsipi_lookup_periph(chan, target, lun); KASSERT(periph->periph_dev == child); scsipi_remove_periph(chan, periph); free(periph, M_DEVBUF); + + /* XXXSMP scsipi */ + KERNEL_UNLOCK_ONE(curlwp); } /*