summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Barnett <kevin.barnett@microchip.com>2021-03-11 14:17:01 -0600
committerMartin K. Petersen <martin.petersen@oracle.com>2021-04-05 23:02:31 -0400
commit66f1c2b40270b759eb070990ebd5c8f94244360f (patch)
tree33ebeb6949ebd243f000277e8af2f75ea5026c18
parent2790cd4d3f6ac5a761b0e3851fce2e75490b5051 (diff)
scsi: smartpqi: Update device scan operations
Change return type from EINPROGRESS to EBUSY to signal applications to retry a REGNEWD if the driver cannot process the REGNEWD. Events such as OFA, suspend, and shutdown return EINPROGRESS if a scan is currently running. This prevents applications from immediately retrying REGNEWD. Schedule a new REGNEWD if system low on memory. Link: https://lore.kernel.org/r/161549382157.25025.16054784597622125373.stgit@brunhilda Reviewed-by: Scott Benesh <scott.benesh@microchip.com> Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com> Reviewed-by: Scott Teel <scott.teel@microchip.com> Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com> Signed-off-by: Don Brace <don.brace@microchip.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/smartpqi/smartpqi_init.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 89b6972a21f6..9f6ab2f4144f 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -2312,21 +2312,27 @@ out:
static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info)
{
- int rc = 0;
+ int rc;
+ int mutex_acquired;
if (pqi_ctrl_offline(ctrl_info))
return -ENXIO;
- if (!mutex_trylock(&ctrl_info->scan_mutex)) {
+ mutex_acquired = mutex_trylock(&ctrl_info->scan_mutex);
+
+ if (!mutex_acquired) {
+ if (pqi_ctrl_scan_blocked(ctrl_info))
+ return -EBUSY;
pqi_schedule_rescan_worker_delayed(ctrl_info);
- rc = -EINPROGRESS;
- } else {
- rc = pqi_update_scsi_devices(ctrl_info);
- if (rc)
- pqi_schedule_rescan_worker_delayed(ctrl_info);
- mutex_unlock(&ctrl_info->scan_mutex);
+ return -EINPROGRESS;
}
+ rc = pqi_update_scsi_devices(ctrl_info);
+ if (rc && !pqi_ctrl_scan_blocked(ctrl_info))
+ pqi_schedule_rescan_worker_delayed(ctrl_info);
+
+ mutex_unlock(&ctrl_info->scan_mutex);
+
return rc;
}