Module Name:    src
Committed By:   jdolecek
Date:           Sat Apr  4 22:30:03 UTC 2020

Modified Files:
        src/sys/dev/ata: ata_recovery.c ata_subr.c

Log Message:
stop xfer timeouts during recovery, all xfers will be requeued anyway

this avoids race with the timeout routine when processing the xfers
for requeueing

should fix PR kern/54790 by Izumi Tsutsui


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ata/ata_recovery.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ata/ata_subr.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/ata_recovery.c
diff -u src/sys/dev/ata/ata_recovery.c:1.2 src/sys/dev/ata/ata_recovery.c:1.3
--- src/sys/dev/ata/ata_recovery.c:1.2	Mon Oct 22 20:13:47 2018
+++ src/sys/dev/ata/ata_recovery.c	Sat Apr  4 22:30:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_recovery.c,v 1.2 2018/10/22 20:13:47 jdolecek Exp $	*/
+/*	$NetBSD: ata_recovery.c,v 1.3 2020/04/04 22:30:02 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_recovery.c,v 1.2 2018/10/22 20:13:47 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_recovery.c,v 1.3 2020/04/04 22:30:02 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -171,6 +171,9 @@ ata_recovery_resume(struct ata_channel *
 
 	ata_queue_hold(chp);
 
+	/* Stop the timeout callout, recovery will requeue once done */
+	callout_stop(&chp->c_timo_callout);
+
 	KASSERT(drive < chp->ch_ndrives);
 	drvp = &chp->ch_drive[drive];
 

Index: src/sys/dev/ata/ata_subr.c
diff -u src/sys/dev/ata/ata_subr.c:1.8 src/sys/dev/ata/ata_subr.c:1.9
--- src/sys/dev/ata/ata_subr.c:1.8	Wed Nov  7 17:05:54 2018
+++ src/sys/dev/ata/ata_subr.c	Sat Apr  4 22:30:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_subr.c,v 1.8 2018/11/07 17:05:54 jdolecek Exp $	*/
+/*	$NetBSD: ata_subr.c,v 1.9 2020/04/04 22:30:02 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.8 2018/11/07 17:05:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.9 2020/04/04 22:30:02 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -235,6 +235,11 @@ ata_timeout(void *v)
 
 	callout_ack(&chp->c_timo_callout);
 
+	if (chp->ch_flags & ATACH_RECOVERING) {
+		/* Do nothing, recovery will requeue the xfers */
+		return;
+	}
+
 	/*
 	 * If there is a timeout, means the last enqueued command
 	 * timed out, and thus all commands timed out.

Reply via email to