Skip to contentSkip to conversation

scsi_debug: set resid to indicate no data-in when medium error

PATCH New Douglas Gilbert 1 participant 1 message Dec 18, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_debug: set resid to indicate no data-in when medium error

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

drivers/scsi/scsi_debug.c2636resid1 renamed from drivers/scsi/scsi_debug.c +1 -0
@@ -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;
 	}