@@ -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)
@@ -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;
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@samsung.com> --- drivers/scsi/ufs/ufshcd.c | 8 ++++++-- drivers/scsi/ufs/ufshcd.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)