Module Name: src Committed By: jdc Date: Mon Jul 2 21:11:50 UTC 2012
Modified Files: src/sys/dev/scsipi [netbsd-6]: atapiconf.c Log Message: Pull up revision 1.86 (requested by riastradh in ticket #373). Take the kernel lock in atapibusdetach just like atapibuschilddet. Fixes kassert in scsipi_lookup_periph when I press the power button on one of my laptops (and maybe another one) to power it off. ok mrg To generate a diff of this commit: cvs rdiff -u -r1.83.14.2 -r1.83.14.3 src/sys/dev/scsipi/atapiconf.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/atapiconf.c diff -u src/sys/dev/scsipi/atapiconf.c:1.83.14.2 src/sys/dev/scsipi/atapiconf.c:1.83.14.3 --- src/sys/dev/scsipi/atapiconf.c:1.83.14.2 Mon Apr 23 16:28:30 2012 +++ src/sys/dev/scsipi/atapiconf.c Mon Jul 2 21:11:50 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: atapiconf.c,v 1.83.14.2 2012/04/23 16:28:30 riz Exp $ */ +/* $NetBSD: atapiconf.c,v 1.83.14.3 2012/07/02 21:11:50 jdc Exp $ */ /* * Copyright (c) 1996, 2001 Manuel Bouyer. All rights reserved. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.83.14.2 2012/04/23 16:28:30 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.83.14.3 2012/07/02 21:11:50 jdc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -194,13 +194,16 @@ atapibusdetach(device_t self, int flags) struct atapibus_softc *sc = device_private(self); struct scsipi_channel *chan = sc->sc_channel; struct scsipi_periph *periph; - int target, error; + int target, error = 0; /* * Shut down the channel. */ scsipi_channel_shutdown(chan); + /* XXXSMP scsipi */ + KERNEL_LOCK(1, curlwp); + /* * Now detach all of the periphs. */ @@ -210,10 +213,14 @@ atapibusdetach(device_t self, int flags) continue; error = config_detach(periph->periph_dev, flags); if (error) - return (error); + goto out; KASSERT(scsipi_lookup_periph(chan, target, 0) == NULL); } - return (0); + +out: + /* XXXSMP scsipi */ + KERNEL_UNLOCK_ONE(curlwp); + return error; } static int