Module Name:    src
Committed By:   jdolecek
Date:           Fri Jul 21 17:32:27 UTC 2017

Modified Files:
        src/sys/dev/ata [jdolecek-ncq]: atavar.h wd.c

Log Message:
KASSERT() that chaosed xfer actually ends up with error; might end up being
returned as successful due to bugs in error recovery code


To generate a diff of this commit:
cvs rdiff -u -r1.92.8.17 -r1.92.8.18 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.428.2.27 -r1.428.2.28 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/atavar.h
diff -u src/sys/dev/ata/atavar.h:1.92.8.17 src/sys/dev/ata/atavar.h:1.92.8.18
--- src/sys/dev/ata/atavar.h:1.92.8.17	Wed Jul 19 19:39:28 2017
+++ src/sys/dev/ata/atavar.h	Fri Jul 21 17:32:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: atavar.h,v 1.92.8.17 2017/07/19 19:39:28 jdolecek Exp $	*/
+/*	$NetBSD: atavar.h,v 1.92.8.18 2017/07/21 17:32:27 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -186,6 +186,7 @@ struct ata_xfer {
 #define	C_NCQ		0x0100		/* command is queued  */
 #define C_IMMEDIATE	0x0200		/* execute command without queuing */
 #define C_WAITTIMO	0x0400		/* race vs. timeout */
+#define C_CHAOS		0x0800		/* forced error xfer */
 
 /* reasons for c_kill_xfer() */
 #define KILL_GONE 1		/* device is gone while xfer was active */

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.428.2.27 src/sys/dev/ata/wd.c:1.428.2.28
--- src/sys/dev/ata/wd.c:1.428.2.27	Wed Jul 19 19:46:52 2017
+++ src/sys/dev/ata/wd.c	Fri Jul 21 17:32:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.428.2.27 2017/07/19 19:46:52 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.428.2.28 2017/07/21 17:32:27 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.428.2.27 2017/07/19 19:46:52 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.28 2017/07/21 17:32:27 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -713,6 +713,7 @@ wdstart1(struct wd_softc *wd, struct buf
 		aprint_normal_dev(wd->sc_dev, "%s: chaos xfer %d\n",
 		    __func__, xfer->c_slot);
 		xfer->c_bio.blkno = 7777777 + wd->sc_capacity;
+		xfer->c_flags |= C_CHAOS;
 	}
 #endif
 
@@ -893,6 +894,9 @@ out:
 noerror:	if ((xfer->c_bio.flags & ATA_CORR) || xfer->c_retries > 0)
 			aprint_error_dev(wd->sc_dev,
 			    "soft error (corrected)\n");
+#ifdef WD_CHAOS_MONKEY
+		KASSERT((xfer->c_flags & C_CHAOS) == 0);
+#endif
 		break;
 	case ERR_NODEV:
 		bp->b_error = EIO;

Reply via email to