Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/dev/scsipi Pull up revision 1.86 (requested by riastr...



details:   https://anonhg.NetBSD.org/src/rev/4187d5884c1f
branches:  netbsd-6
changeset: 774279:4187d5884c1f
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon Jul 02 21:11:50 2012 +0000

description:
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

diffstat:

 sys/dev/scsipi/atapiconf.c |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r ea528a2e3d34 -r 4187d5884c1f sys/dev/scsipi/atapiconf.c
--- a/sys/dev/scsipi/atapiconf.c        Mon Jul 02 21:01:48 2012 +0000
+++ b/sys/dev/scsipi/atapiconf.c        Mon Jul 02 21:11:50 2012 +0000
@@ -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 @@
        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 @@
                        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



Home | Main Index | Thread Index | Old Index