Skip to content

Commit 0ae80ba

Browse files
hreineckeJames Bottomley
authored andcommitted
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>
1 parent 0c958ec commit 0ae80ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
24232423
unsigned char cmd[12];
24242424
int use_10_for_ms;
24252425
int header_length;
2426-
int result;
2426+
int result, retry_count = retries;
24272427
struct scsi_sense_hdr my_sshdr;
24282428

24292429
memset(data, 0, sizeof(*data));
@@ -2502,6 +2502,11 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
25022502
data->block_descriptor_length = buffer[3];
25032503
}
25042504
data->header_length = header_length;
2505+
} else if ((status_byte(result) == CHECK_CONDITION) &&
2506+
scsi_sense_valid(sshdr) &&
2507+
sshdr->sense_key == UNIT_ATTENTION && retry_count) {
2508+
retry_count--;
2509+
goto retry;
25052510
}
25062511

25072512
return result;

0 commit comments

Comments
 (0)