Module Name:    src
Committed By:   perseant
Date:           Mon Mar 14 22:15:51 UTC 2022

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

Log Message:
Avoid an unaccounted extra channel freeze, if a reset is requested
more than once before the thread services the request.  Closes PR#56745.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/ata/ata.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.c
diff -u src/sys/dev/ata/ata.c:1.166 src/sys/dev/ata/ata.c:1.167
--- src/sys/dev/ata/ata.c:1.166	Wed Feb 23 21:54:40 2022
+++ src/sys/dev/ata/ata.c	Mon Mar 14 22:15:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.166 2022/02/23 21:54:40 andvar Exp $	*/
+/*	$NetBSD: ata.c,v 1.167 2022/03/14 22:15:51 perseant Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.166 2022/02/23 21:54:40 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.167 2022/03/14 22:15:51 perseant Exp $");
 
 #include "opt_ata.h"
 
@@ -1600,12 +1600,14 @@ ata_thread_run(struct ata_channel *chp, 
 			/* NOTREACHED */
 		}
 
-		/*
-		 * Block execution of other commands while reset is scheduled
-		 * to a thread.
-		 */
-		ata_channel_freeze_locked(chp);
-		chp->ch_flags |= type;
+		if (!(chp->ch_flags & type)) {
+			/*
+			 * Block execution of other commands while
+			 * reset is scheduled to a thread.
+			 */
+			ata_channel_freeze_locked(chp);
+			chp->ch_flags |= type;
+		}
 
 		cv_signal(&chp->ch_thr_idle);
 		return;

Reply via email to