Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/jdolecek-ncq]: src/sys/dev/ata introduce some code to test retry paths



details:   https://anonhg.NetBSD.org/src/rev/48ee93896ae7
branches:  jdolecek-ncq
changeset: 352705:48ee93896ae7
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Jul 03 19:31:16 2017 +0000

description:
introduce some code to test retry paths

diffstat:

 sys/dev/ata/wd.c |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r 9bb2debb45f8 -r 48ee93896ae7 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Mon Jul 03 18:17:01 2017 +0000
+++ b/sys/dev/ata/wd.c  Mon Jul 03 19:31:16 2017 +0000
@@ -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 @@
 #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 @@
        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



Home | Main Index | Thread Index | Old Index