summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeoseong Park <keosung.park@samsung.com>2023-04-25 05:17:21 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2023-05-08 13:15:05 +0200
commit1a7edd041f2d252f251523ba3f2eaead076a8f8d (patch)
tree834cbd7d0ec5cb7ecb0057713f86d0a151777e15
parentLinux 6.4-rc1 (diff)
downloadlinux-1a7edd041f2d252f251523ba3f2eaead076a8f8d.tar.xz
linux-1a7edd041f2d252f251523ba3f2eaead076a8f8d.zip
scsi: ufs: core: Fix I/O hang that occurs when BKOPS fails in W-LUN suspend
Even when urgent BKOPS fails, the consumer will get stuck in runtime suspend status. Like commit 1a5665fc8d7a ("scsi: ufs: core: WLUN suspend SSU/enter hibern8 fail recovery"), trigger the error handler and return -EBUSY to break the suspend. Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Signed-off-by: Keoseong Park <keosung.park@samsung.com> Link: https://lore.kernel.org/r/20230425031721epcms2p5d4de65616478c967d466626e20c42a3a@epcms2p5 Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/ufs/core/ufshcd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 17d7bb875fee..45fd374fe56c 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9459,8 +9459,16 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* that performance might be impacted.
*/
ret = ufshcd_urgent_bkops(hba);
- if (ret)
+ if (ret) {
+ /*
+ * If return err in suspend flow, IO will hang.
+ * Trigger error handler and break suspend for
+ * error recovery.
+ */
+ ufshcd_force_error_recovery(hba);
+ ret = -EBUSY;
goto enable_scaling;
+ }
} else {
/* make sure that auto bkops is disabled */
ufshcd_disable_auto_bkops(hba);