Module Name:    src
Committed By:   jdolecek
Date:           Tue Apr  7 13:22:05 UTC 2020

Modified Files:
        src/sys/dev/ata: wd.c

Log Message:
drop wd lock in wdstart1() before calling the ata_bio hook; when called
from ata thread context, that can still need to sleep for wdc attachments
in wdcwait()


To generate a diff of this commit:
cvs rdiff -u -r1.459 -r1.460 src/sys/dev/ata/wd.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/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.459 src/sys/dev/ata/wd.c:1.460
--- src/sys/dev/ata/wd.c:1.459	Mon Mar  2 16:01:56 2020
+++ src/sys/dev/ata/wd.c	Tue Apr  7 13:22:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.459 2020/03/02 16:01:56 riastradh Exp $ */
+/*	$NetBSD: wd.c,v 1.460 2020/04/07 13:22:05 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.459 2020/03/02 16:01:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.460 2020/04/07 13:22:05 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -666,6 +666,7 @@ wdstart1(struct wd_softc *wd, struct buf
 
 	KASSERT(bp == xfer->c_bio.bp || xfer->c_bio.bp == NULL);
 	KASSERT((xfer->c_flags & (C_WAITACT|C_FREE)) == 0);
+	KASSERT(mutex_owned(&wd->sc_lock));
 
 	/* Reset state, so that retries don't use stale info */
 	if (__predict_false(xfer->c_retries > 0)) {
@@ -757,6 +758,8 @@ wdstart1(struct wd_softc *wd, struct buf
 
 	if (xfer->c_retries == 0)
 		wd->inflight++;
+	mutex_exit(&wd->sc_lock);
+
 	switch (wd->atabus->ata_bio(wd->drvp, xfer)) {
 	case ATACMD_TRY_AGAIN:
 		panic("wdstart1: try again");
@@ -767,6 +770,8 @@ wdstart1(struct wd_softc *wd, struct buf
 	default:
 		panic("wdstart1: bad return code from ata_bio()");
 	}
+
+	mutex_enter(&wd->sc_lock);
 }
 
 static int

Reply via email to