[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d036f1ee837697809533e8b14c62c4d850645143.1631519695.git.kwmad.kim@samsung.com>
Date: Mon, 13 Sep 2021 16:55:54 +0900
From: Kiwoong Kim <kwmad.kim@...sung.com>
To: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
alim.akhtar@...sung.com, avri.altman@....com, jejb@...ux.ibm.com,
martin.petersen@...cle.com, beanhuo@...ron.com,
cang@...eaurora.org, adrian.hunter@...el.com, sc.suh@...sung.com,
hy50.seo@...sung.com, sh425.lee@...sung.com,
bhoon95.kim@...sung.com
Cc: Kiwoong Kim <kwmad.kim@...sung.com>
Subject: [PATCH v2 2/3] scsi: ufs: introduce force requeue
When a data command is completed but its data integrity
isn't guaranteed, the driver doesn't return any errors
but user land could face various abnormal symtoms.
All the pending commands should be queued again only if
those events could be detected before the commands are
completed. Because it could be a disaster, especially if
the command is write.
Signed-off-by: Kiwoong Kim <kwmad.kim@...sung.com>
---
drivers/scsi/ufs/ufshcd.c | 8 ++++++--
drivers/scsi/ufs/ufshcd.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 604c505..6550052 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5294,8 +5294,11 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
ufshcd_update_monitor(hba, lrbp);
ufshcd_add_command_trace(hba, index, UFS_CMD_COMP);
- result = retry_requests ? DID_BUS_BUSY << 16 :
- ufshcd_transfer_rsp_status(hba, lrbp);
+ if (hba->force_requeue)
+ result = DID_REQUEUE << 16;
+ else
+ result = retry_requests ? DID_BUS_BUSY << 16 :
+ ufshcd_transfer_rsp_status(hba, lrbp);
scsi_dma_unmap(cmd);
cmd->result = result;
/* Mark completed command as NULL in LRB */
@@ -6200,6 +6203,7 @@ static void ufshcd_err_handler(struct Scsi_Host *host)
/* Fatal errors need reset */
if (needs_reset) {
hba->force_reset = false;
+ hba->force_requeue = false;
spin_unlock_irqrestore(hba->host->host_lock, flags);
err = ufshcd_reset_and_restore(hba);
if (err)
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 7af5d5b..642c547 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -855,6 +855,7 @@ struct ufs_hba {
bool force_reset;
bool force_pmc;
bool silence_err_logs;
+ bool force_requeue;
/* Device management request data */
struct ufs_dev_cmd dev_cmd;
--
2.7.4
Powered by blists - more mailing lists