[SCSI] scsi_debug: set resid to indicate no data-in when medium error
authorDouglas Gilbert <dgilbert@interlog.com>
Sat, 18 Dec 2010 00:16:06 +0000 (19:16 -0500)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 23 Dec 2010 05:26:49 +0000 (23:26 -0600)
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@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/scsi_debug.c

index 2f1f9b079b1067fb078b74c471134bba9a7f55bb..7b310934efed5509bbc7d78969ad912874c0140e 100644 (file)
@@ -1805,6 +1805,7 @@ static int resp_read(struct scsi_cmnd *SCpnt, unsigned long long lba,
                        devip->sense_buff[5] = (ret >> 8) & 0xff;
                        devip->sense_buff[6] = ret & 0xff;
                }
+               scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
                return check_condition_result;
        }