Module Name:    src
Committed By:   jdolecek
Date:           Sun Sep 18 21:52:37 UTC 2016

Modified Files:
        src/sys/dev/ic: ld_nvme.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/ld_nvme.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/ic/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.4 src/sys/dev/ic/ld_nvme.c:1.5
--- src/sys/dev/ic/ld_nvme.c:1.4	Sun Sep 18 21:19:39 2016
+++ src/sys/dev/ic/ld_nvme.c	Sun Sep 18 21:52:36 2016
@@ -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 <non...@netbsd.org>
@@ -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 ld_nvme_softc {
 	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_nvme_attach(device_t parent, device_t
 	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_nvme_attach(device_t parent, device_t
 	ld->sc_flush = ld_nvme_flush;
 	ld->sc_flags = LDF_ENABLED;
 	ldattach(ld, "fcfs");
+
+	sc->sc_attaching = 0;
 }
 
 static int
@@ -156,7 +160,8 @@ ld_nvme_dobio(struct ld_nvme_softc *sc, 
 {
 	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)

Reply via email to