Module Name:    src
Committed By:   mlelstv
Date:           Thu Jun  6 20:41:04 UTC 2019

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

Log Message:
Count only the initial start of a transfer, not the retries.
Should fix kern/54166.

Thanks to macallan@ for spotting the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.450 -r1.451 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.450 src/sys/dev/ata/wd.c:1.451
--- src/sys/dev/ata/wd.c:1.450	Fri May 24 06:01:05 2019
+++ src/sys/dev/ata/wd.c	Thu Jun  6 20:41:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.450 2019/05/24 06:01:05 mlelstv Exp $ */
+/*	$NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv 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.450 2019/05/24 06:01:05 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -734,7 +734,8 @@ wdstart1(struct wd_softc *wd, struct buf
 		xfer->c_bio.flags |= ATA_FUA;
 	}
 
-	wd->inflight++;
+	if (xfer->c_retries == 0)
+		wd->inflight++;
 	switch (wd->atabus->ata_bio(wd->drvp, xfer)) {
 	case ATACMD_TRY_AGAIN:
 		panic("wdstart1: try again");
@@ -989,7 +990,9 @@ noerror:	if ((xfer->c_bio.flags & ATA_CO
 
 	ata_free_xfer(wd->drvp->chnl_softc, xfer);
 
+	mutex_enter(&wd->sc_lock);
 	wd->inflight--;
+	mutex_exit(&wd->sc_lock);
 	dk_done(dksc, bp);
 	dk_start(dksc, NULL);
 }

Reply via email to