diff options
author | Mike Christie <michael.christie@oracle.com> | 2024-01-22 18:22:13 -0600 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2024-01-29 21:20:54 -0500 |
commit | 21bdff48e12bf674208e0575a03ca89d663f1a3c (patch) | |
tree | 75ca37d33509ff97a9491694473e23f3604d7c32 /drivers/scsi/scsi_lib.c | |
parent | e11f35c46ebd746049a3d84dc68e7e8681aa26e8 (diff) | |
download | linux-21bdff48e12bf674208e0575a03ca89d663f1a3c.tar.gz linux-21bdff48e12bf674208e0575a03ca89d663f1a3c.tar.bz2 linux-21bdff48e12bf674208e0575a03ca89d663f1a3c.zip |
scsi: core: Have midlayer retry scsi_mode_sense() UAs
This has scsi_mode_sense() have the SCSI midlayer retry UAs instead of
driving them itself.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20240123002220.129141-13-michael.christie@oracle.com
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 16a33a558842..8a79e4f36636 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2262,11 +2262,25 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + int result; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { /* caller might not be interested in sense, but we need it */ .sshdr = sshdr ? : &my_sshdr, + .failures = &failures, }; memset(data, 0, sizeof(*data)); @@ -2328,12 +2342,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } |