diff options
author | Hannes Reinecke <hare@suse.de> | 2015-06-12 16:12:48 +0200 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-07-30 12:37:20 -0700 |
commit | 0ae80ba91f57726f31b5b5890cb7c5173e624ca4 (patch) | |
tree | 42c8c0b21ec3456a11dc3400ec3ffa85afdf4d90 /drivers | |
parent | 0c958ecc69c277b25f38f72bc6d18ab145e8167c (diff) |
scsi: retry MODE SENSE on unit attention
The 'sd' driver is calling scsi_mode_sense() to figure out
internal details. But scsi_mode_sense() never checks for
any pending unit attentions, so we're getting annoying error
messages like:
MODE SENSE: unimplemented page/subpage: 0x00/0x00
and a possible wrong decision for device cache handling.
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 448ebdaa3d69..dffa91c67f5b 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2423,7 +2423,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result; + int result, retry_count = retries; struct scsi_sense_hdr my_sshdr; memset(data, 0, sizeof(*data)); @@ -2502,6 +2502,11 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, data->block_descriptor_length = buffer[3]; } data->header_length = header_length; + } else if ((status_byte(result) == CHECK_CONDITION) && + scsi_sense_valid(sshdr) && + sshdr->sense_key == UNIT_ATTENTION && retry_count) { + retry_count--; + goto retry; } return result; |