Module Name: src
Committed By: jdolecek
Date: Mon Jul 3 19:31:16 UTC 2017
Modified Files:
src/sys/dev/ata [jdolecek-ncq]: wd.c
Log Message:
introduce some code to test retry paths
To generate a diff of this commit:
cvs rdiff -u -r1.428.2.23 -r1.428.2.24 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.428.2.23 src/sys/dev/ata/wd.c:1.428.2.24
--- src/sys/dev/ata/wd.c:1.428.2.23 Sat Jun 24 00:00:10 2017
+++ src/sys/dev/ata/wd.c Mon Jul 3 19:31:16 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.428.2.23 2017/06/24 00:00:10 jdolecek Exp $ */
+/* $NetBSD: wd.c,v 1.428.2.24 2017/07/03 19:31:16 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.23 2017/06/24 00:00:10 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.24 2017/07/03 19:31:16 jdolecek Exp $");
#include "opt_ata.h"
@@ -115,6 +115,10 @@ int wdcdebug_wd_mask = 0x0;
#define ATADEBUG_PRINT(args, level)
#endif
+#ifdef WD_CHAOS_MONKEY
+int wdcdebug_wd_chaos = 0;
+#endif
+
int wdprobe(device_t, cfdata_t, void *);
void wdattach(device_t, device_t, void *);
int wddetach(device_t, int);
@@ -691,6 +695,20 @@ wdstart1(struct wd_softc *wd, struct buf
KASSERT(bp == xfer->c_bio.bp || xfer->c_bio.bp == NULL);
xfer->c_bio.bp = bp;
+#ifdef WD_CHAOS_MONKEY
+ /*
+ * Override blkno to be over device capacity to trigger error,
+ * but only if it's read, to avoid trashing disk contents should
+ * the command be clipped, or otherwise misinterpreted, by the
+ * driver or controller.
+ */
+ if (BUF_ISREAD(bp) && (++wdcdebug_wd_chaos % WD_CHAOS_MONKEY) == 0) {
+ aprint_normal_dev(wd->sc_dev, "%s: chaos xfer %d\n",
+ __func__, xfer->c_slot);
+ xfer->c_bio.blkno = 7777777 + wd->sc_capacity;
+ }
+#endif
+
/*
* If we're retrying, retry in single-sector mode. This will give us
* the sector number of the problem, and will eventually allow the