Skip to contentSkip to conversation

scsi: pm8001: do not wait for port reset timeout after link down

PATCH In review Sagar Biradar 2 participants 2 messages Apr 16 – May 15

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: pm8001: do not wait for port reset timeout after link down

From: Kumar Meiyappan <[email protected]>

During SATA hot removal with I/O in flight, commands may time out and enter the abort path. As part of abort handling, the driver issues a local PHY reset and then waits for the PORT_RESET_TMO event from firmware.

However, once the link is already down, firmware does not generate that event. The abort path then waits for a completion that will never arrive, which can lead to a call trace or stalled recovery during device removal.

Avoid waiting for port reset completion when the PHY link is already down.

---
 drivers/scsi/pm8001/pm8001_sas.c | 36 +++++++++++++++++---------------
 1 file changed, 19 insertions(+), 17 deletions(-)
drivers/scsi/pm8001/pm8001_sas.c +19 -17
index 645524f3fe2d..5d45c489d7f6 100644
@@ -1148,24 +1148,26 @@ int pm8001_abort_task(struct sas_task *task)
 				phy->reset_completion = NULL;
 			} else {
 				/* 3. Wait for Port Reset complete or
-				 * Port reset TMO
+				 * Port reset TMO, if Phy Link is still up
 				 */
-				pm8001_dbg(pm8001_ha, MSG,
-					   "Waiting for Port reset\n");
-				ret = wait_for_completion_timeout(
-					&completion_reset,
-					PM8001_TASK_TIMEOUT * HZ);
-				if (!ret)
-					phy->reset_completion = NULL;
-				WARN_ON(phy->port_reset_status ==
-						PORT_RESET_TMO);
-				if (phy->port_reset_status == PORT_RESET_TMO) {
-					pm8001_dev_gone_notify(dev);
-					PM8001_CHIP_DISP->hw_event_ack_req(
-						pm8001_ha, 0,
-						0x07, /*HW_EVENT_PHY_DOWN ack*/
-						port_id, phy_id, 0, 0);
-					goto out;
+				if (phy->phy_state != PHY_LINK_DISABLE) {
+					pm8001_dbg(pm8001_ha, MSG,
+						   "Waiting for Port reset\n");
+					ret = wait_for_completion_timeout(
+						&completion_reset,
+						PM8001_TASK_TIMEOUT * HZ);
+					if (!ret)
+						phy->reset_completion = NULL;
+					WARN_ON(phy->port_reset_status ==
+							PORT_RESET_TMO);
+					if (phy->port_reset_status == PORT_RESET_TMO) {
+						pm8001_dev_gone_notify(dev);
+						PM8001_CHIP_DISP->hw_event_ack_req(
+							pm8001_ha, 0,
+							0x07, /*HW_EVENT_PHY_DOWN ack*/
+							port_id, phy_id, 0, 0);
+						goto out;
+					}
 				}
 			}
 
Signature · 1 line
2.43.0