From: Kurt Garloff <garloff@suse.de>
To: Doug Gilbert <dgilbert@interlog.com>
Cc: Linux SCSI list <linux-scsi@vger.kernel.org>
Subject: scsi_debug: inject recovered errors
Date: Sat, 8 Feb 2003 12:54:46 +0100 [thread overview]
Message-ID: <20030208115446.GD26619@nbkurt> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 621 bytes --]
Hi Doug,
this patch allows to inject recovered errors with scsi_debug, to see
whether sd handles them correctly.
Attached patch is a port to scsi_debug as in 2.4.20. (I used 2.4.19 for
testing.)
It has been for verifying that the fix for recovered error sense (without
valid bit) actually works.
Regards,
--
Kurt Garloff <kurt@garloff.de> [Eindhoven, NL]
Physics: Plasma simulations <K.Garloff@TUE.NL> [TU Eindhoven, NL]
Linux: SCSI, Security <garloff@suse.de> [SuSE Nuernberg, DE]
(See mail header or public key servers for PGP2 and GPG public keys.)
[-- Attachment #1.2: scsi_debug_inj_recovered_errors.diff --]
[-- Type: text/plain, Size: 1839 bytes --]
diff -uNr linux-2.4.20.recerr/drivers/scsi/scsi_debug.c linux-2.4.20/drivers/scsi/scsi_debug.c
--- linux-2.4.20.recerr/drivers/scsi/scsi_debug.c 2002-11-29 00:53:14.000000000 +0100
+++ linux-2.4.20/drivers/scsi/scsi_debug.c 2003-02-08 02:40:21.000000000 +0100
@@ -80,6 +80,8 @@
static int scsi_debug_every_nth = DEF_EVERY_NTH;
static int scsi_debug_cmnd_count = 0;
static int scsi_debug_delay = DEF_DELAY;
+static int scsi_debug_inj_rec_err = 0;
+
#define NR_HOSTS_PRESENT (((scsi_debug_num_devs - 1) / 7) + 1)
#define N_HEAD 8
@@ -324,6 +326,12 @@
num = cmd[4];
}
errsts = resp_read(SCpnt, upper_blk, block, num, devip);
+ if (scsi_debug_inj_rec_err && !(SCpnt->pid % scsi_debug_inj_rec_err)) {
+ SCpnt->result = (COMMAND_COMPLETE << 8) |
+ (CHECK_CONDITION << 1);
+ mk_sense_buffer(devip, RECOVERED_ERROR, 0x5d, 0, 14);
+ } else
+ SCpnt->result = 0;
break;
case REPORT_LUNS:
errsts = resp_report_luns(cmd, buff, bufflen, devip);
@@ -361,6 +369,12 @@
case MODE_SENSE:
case MODE_SENSE_10:
errsts = resp_mode_sense(cmd, target, buff, bufflen, devip);
+ if (scsi_debug_inj_rec_err && !(SCpnt->pid % scsi_debug_inj_rec_err)) {
+ SCpnt->result = (COMMAND_COMPLETE << 8) |
+ (CHECK_CONDITION << 1);
+ mk_sense_buffer(devip, RECOVERED_ERROR, 0x5d, 0, 14);
+ } else
+ SCpnt->result = 0;
break;
default:
#if 0
@@ -1160,6 +1174,8 @@
MODULE_PARM_DESC(scsi_debug_every_nth, "timeout every nth command(def=100)");
MODULE_PARM(scsi_debug_delay, "i");
MODULE_PARM_DESC(scsi_debug_delay, "# of jiffies to delay response(def=1)");
+MODULE_PARM(scsi_debug_inj_rec_err, "i");
+MODULE_PARM_DESC(scsi_debug_inj_rec_err, "inject recovered errors every N read/write command");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2003-02-08 11:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030208115446.GD26619@nbkurt \
--to=garloff@suse.de \
--cc=dgilbert@interlog.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox