Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata drop wd lock in wdstart1() before calling the at...



details:   https://anonhg.NetBSD.org/src/rev/bc3afaa84efa
branches:  trunk
changeset: 1008974:bc3afaa84efa
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Apr 07 13:22:05 2020 +0000

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

diffstat:

 sys/dev/ata/wd.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r 0e637b39eb50 -r bc3afaa84efa sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Tue Apr 07 12:42:11 2020 +0000
+++ b/sys/dev/ata/wd.c  Tue Apr 07 13:22:05 2020 +0000
@@ -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 @@
 
        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 @@
 
        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 @@
        default:
                panic("wdstart1: bad return code from ata_bio()");
        }
+
+       mutex_enter(&wd->sc_lock);
 }
 
 static int



Home | Main Index | Thread Index | Old Index