Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic must use PR_NOWAIT also during ldattach()/dkwedge...



details:   https://anonhg.NetBSD.org/src/rev/6591ce794a87
branches:  trunk
changeset: 347852:6591ce794a87
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Sep 18 21:52:36 2016 +0000

description:
must use PR_NOWAIT also during ldattach()/dkwedge discover, our i/o is there
called with a spin lock held, which triggers LOCKDEBUG panic

diffstat:

 sys/dev/ic/ld_nvme.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (53 lines):

diff -r 848d31e91441 -r 6591ce794a87 sys/dev/ic/ld_nvme.c
--- a/sys/dev/ic/ld_nvme.c      Sun Sep 18 21:19:39 2016 +0000
+++ b/sys/dev/ic/ld_nvme.c      Sun Sep 18 21:52:36 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_nvme.c,v 1.4 2016/09/18 21:19:39 jdolecek Exp $     */
+/*     $NetBSD: ld_nvme.c,v 1.5 2016/09/18 21:52:36 jdolecek Exp $     */
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.4 2016/09/18 21:19:39 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.5 2016/09/18 21:52:36 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,6 +46,7 @@
        struct nvme_softc       *sc_nvme;
 
        uint16_t                sc_nsid;
+       int                     sc_attaching;
 };
 
 static int     ld_nvme_match(device_t, cfdata_t, void *);
@@ -91,6 +92,7 @@
        ld->sc_dv = self;
        sc->sc_nvme = nsc;
        sc->sc_nsid = naa->naa_nsid;
+       sc->sc_attaching = 1;
 
        aprint_naive("\n");
        aprint_normal("\n");
@@ -115,6 +117,8 @@
        ld->sc_flush = ld_nvme_flush;
        ld->sc_flags = LDF_ENABLED;
        ldattach(ld, "fcfs");
+
+       sc->sc_attaching = 0;
 }
 
 static int
@@ -156,7 +160,8 @@
 {
        struct nvme_ns_context *ctx;
        int error;
-       int waitok = (bp != NULL && !cpu_softintr_p() && !cpu_intr_p());
+       int waitok = (bp != NULL && !cpu_softintr_p() && !cpu_intr_p()
+           && !sc->sc_attaching);
 
        ctx = nvme_ns_get_ctx(sc, waitok ? PR_WAITOK : PR_NOWAIT);
        if (ctx == NULL)



Home | Main Index | Thread Index | Old Index