[PATCH v3 07/11] scsi: mpt3sas: Reset the TUR retry count for each device
From: Jeff Layton
Date: Wed Nov 18 2026 - 18:10:40 EST
_scsih_ublock_io_all_device() and _scsih_ublock_io_device_wait() poll
each blocked sdev with TEST UNIT READY, for up to command_retry_count
retries. These functions set the retry counter to 0 once per call, not
once per sdev. Thus retries on one device consume the retry budget of
all later devices. When the budget is empty, the driver marks a device
deleted after its first TUR and sets it SDEV_OFFLINE. This occurs even
for a device that needs only one retry.
Start the count from 0 for each sdev.
Fixes: 72340fecd0c8 ("scsi: mpt3sas: Add configurable command retry limit for slow-to-respond devices")
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 5657bda241f7..1269446eec4e 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -4089,7 +4089,7 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc, u8 no_turs)
enum device_responsive_state rc;
struct _sas_device *sas_device = NULL;
struct _pcie_device *pcie_device = NULL;
- int count = 0;
+ int count;
u8 tr_method = 0;
u8 tr_timeout = 30;
@@ -4113,6 +4113,7 @@ _scsih_ublock_io_all_device(struct MPT3SAS_ADAPTER *ioc, u8 no_turs)
continue;
}
+ count = 0;
do {
pcie_device = mpt3sas_get_pdev_by_handle(ioc, sas_target->handle);
if (pcie_device && (!ioc->tm_custom_handling) &&
@@ -4199,7 +4200,7 @@ _scsih_ublock_io_device_wait(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,
struct _pcie_device *pcie_device;
u8 tr_timeout = 30;
u8 tr_method = 0;
- int count = 0;
+ int count;
/* moving devices from SDEV_OFFLINE to SDEV_BLOCK */
shost_for_each_device(sdev, ioc->shost) {
@@ -4234,6 +4235,7 @@ _scsih_ublock_io_device_wait(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,
if (!sas_device_priv_data->block)
continue;
+ count = 0;
do {
host_reset_completion_count = 0;
pcie_device = mpt3sas_get_pdev_by_handle(ioc, sas_target->handle);
--
2.56.1