scsi: retry MODE SENSE on unit attention
PATCH 1/1 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.
--- drivers/scsi/scsi_lib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +6 -1
@@ -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;
Signature · 1 line
1.8.5.2
Quoted 29 lines · Hannes Reinecke
The 'sd' driver is calling
scsi_mode_sense()to figure out internal details. Butscsi_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.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_lib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/scsi/scsi_lib.c +1
-1@@ -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 ];
drivers/scsi/scsi_lib.c scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, · line 2512
Quoted 10 lines
drivers/scsi/scsi_lib.c +5
-0} 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;
Great, but shouldn't we be doing this more generally? What about scsi_mode_select()?
(And, with the number of status changes that can get reported by
UAs, we might want to think about increasing the retry count on these commands up from 3 at some point.)
Quoted 39 lines · Ewan Milne
Quoted 38 lines · Hannes Reinecke
The 'sd' driver is calling
scsi_mode_sense()to figure out internal details. Butscsi_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.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_lib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/scsi/scsi_lib.c +6
-1@@ -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; }
Quoted 5 lines
drivers/scsi/scsi_lib.c scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, · line 2512
Quoted 1 line
drivers/scsi/scsi_lib.c +0
-0return result;Great, but shouldn't we be doing this more generally? What about
scsi_mode_select()?
I haven't seen any issues with scsi_mode_select() as of now, so I didn't do anything about this :-)
Quoted 4 lines
(And, with the number of status changes that can get reported by
UAs, we might want to think about increasing the retry count on these commands up from 3 at some point.)
Hmm. _Actually_, we're not getting _more_ UAs (neither the number nor the situation at which UAs are being send has changed). It's just that we're trying to _use_ UAs so these things pop up. But yeah, raising the number or retries to eg 5 is probably a good idea.
Quoted 2 lines
Reviewed-by Ewan D. Milne <[email protected]>
Cheers,
Hannes
Signature · 9 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 48 lines · Hannes Reinecke
Quoted 39 lines · Ewan Milne
Quoted 38 lines · Hannes Reinecke
The 'sd' driver is calling
scsi_mode_sense()to figure out internal details. Butscsi_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.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_lib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/scsi/scsi_lib.c +6
-1@@ -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; }Quoted 5 lines
drivers/scsi/scsi_lib.c scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, · line 2512
Quoted 1 line
drivers/scsi/scsi_lib.c +0
-0return result;Great, but shouldn't we be doing this more generally? What about
scsi_mode_select()?I haven't seen any issues with
scsi_mode_select()as of now, so I didn't do anything about this :-)
Quoted 8 lines
Quoted 4 lines
(And, with the number of status changes that can get reported by
UAs, we might want to think about increasing the retry count on these commands up from 3 at some point.)Hmm. _Actually_, we're not getting _more_ UAs (neither the number nor the situation at which UAs are being send has changed). It's just that we're trying to _use_ UAs so these things pop up. But yeah, raising the number or retries to eg 5 is probably a good idea.
Yeah, or maybe add a time limit to we don't drag out the boot time. We can do this later, though, I'm fine with your patch as it is.
Quoted 6 lines
Quoted 3 lines
Reviewed-by Ewan D. Milne <[email protected]>Cheers,
Hannes