Module Name:    src
Committed By:   mrg
Date:           Sun Mar 11 02:16:55 UTC 2012

Modified Files:
        src/sys/dev/scsipi: scsiconf.c

Log Message:
scsidevdetached ioctl path enters scsipi code without kernel lock
and this upsets the newer kasserts.  take kernel lock here.


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/sys/dev/scsipi/scsiconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.262 src/sys/dev/scsipi/scsiconf.c:1.263
--- src/sys/dev/scsipi/scsiconf.c:1.262	Tue Apr 26 07:41:18 2011
+++ src/sys/dev/scsipi/scsiconf.c	Sun Mar 11 02:16:55 2012
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -378,11 +378,17 @@ scsidevdetached(device_t self, device_t 
 	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);
 }
 
 /*

Reply via email to