[PATCH v2 2/2] ufs: core: Do not forcibly complete SCSI commands
Bart Van Assche <[email protected]>
| Newsgroups | org.kernel.vger.linux-scsi |
|---|---|
| Message-ID | <c31da15ae9aa15d891ff69fd342294f9bf687480.1786569828.git.bvanassche@acm.org> |
The SCSI core error handler is responsible for deciding whether to abort or
to requeue SCSI commands. A SCSI LLD shouldn't interfere with this decision.
Hence, do not call scsi_done() from inside the UFS error handler.
Also call ufshcd_mcq_compl_all_cqes_lock() for reserved commands - there
is no reason to skip this call for reserved commands.
Fix the comment above ufshcd_mcq_compl_pending_transfer().
This patch makes the MCQ behavior consistent with the behavior for legacy mode.
Fixes: ab248643d3d6 ("scsi: ufs: core: Add error handling for MCQ mode")
Signed-off-by: Bart Van Assche <[email protected]>
---
drivers/ufs/core/ufshcd.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index d719100bfe38..b1d8900f9821 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -6020,28 +6020,13 @@ static int ufshcd_poll(struct Scsi_Host *shost, unsigned int queue_num)
static bool ufshcd_mcq_force_compl_one(struct request *rq, void *priv)
{
- struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq);
struct scsi_device *sdev = rq->q->queuedata;
struct Scsi_Host *shost = sdev->host;
struct ufs_hba *hba = shost_priv(shost);
struct ufs_hw_queue *hwq = ufshcd_mcq_req_to_hwq(hba, rq);
- if (blk_mq_is_reserved_rq(rq) || !hwq)
- return true;
-
- ufshcd_mcq_compl_all_cqes_lock(hba, hwq);
-
- /*
- * For those cmds of which the cqes are not present in the cq, complete
- * them explicitly.
- */
- scoped_guard(spinlock_irqsave, &hwq->cq_lock) {
- if (!test_bit(SCMD_STATE_COMPLETE, &cmd->state)) {
- set_host_byte(cmd, DID_REQUEUE);
- ufshcd_release_scsi_cmd(hba, cmd);
- scsi_done(cmd);
- }
- }
+ if (hwq)
+ ufshcd_mcq_compl_all_cqes_lock(hba, hwq);
return true;
}
@@ -6068,7 +6053,7 @@ static bool ufshcd_mcq_compl_one(struct request *rq, void *priv)
* @hba: per adapter instance
* @force_compl: This flag is set to true when invoked
* from ufshcd_host_reset_and_restore() in which case it requires special
- * handling because the host controller has been reset by ufshcd_hba_stop().
+ * handling because the host controller has been disabled by ufshcd_hba_stop().
*/
static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
bool force_compl)