As discussed in a thread on this list titled: "RFC: short reads on block devices" this patch provides additional information associated with a medium error. And that is that the data-in buffer contains no valid data. This patch is against lk 2.6.36 Changelog: set resid to the requested data-in length when a MEDIUM ERROR is simulated. This implies no valid data is returned in the data-in buffer Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx>
--- linux/drivers/scsi/scsi_debug.c 2010-12-03 17:17:54.000000000 -0500 +++ linux/drivers/scsi/scsi_debug.c2636resid1 2010-12-16 00:48:25.000000000 -0500 @@ -1790,6 +1790,7 @@ static int resp_read(struct scsi_cmnd *S devip->sense_buff[5] = (ret >> 8) & 0xff; devip->sense_buff[6] = ret & 0xff; } + scsi_set_resid(SCpnt, scsi_bufflen(SCpnt)); return check_condition_result; }