* scsi_debug: inject recovered errors
@ 2003-02-08 11:54 Kurt Garloff
0 siblings, 0 replies; only message in thread
From: Kurt Garloff @ 2003-02-08 11:54 UTC (permalink / raw)
To: Doug Gilbert; +Cc: Linux SCSI list
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-08 11:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-08 11:54 scsi_debug: inject recovered errors Kurt Garloff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox