mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
FROMGIT: scsi: ufs: Improve SCSI abort handling further
Release resources when aborting a command. Make sure that aborted commands are completed once by clearing the corresponding tag bit from hba->outstanding_reqs. This patch is an improved version of commit3ff1f6b6ba("scsi: ufs: core: Improve SCSI abort handling"). Link: https://lore.kernel.org/r/20211203231950.193369-14-bvanassche@acm.org Fixes:7a3e97b0dc("[SCSI] ufshcd: UFS Host controller driver") Tested-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit1fbaa02dfdgit://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Bug: 204438323 Change-Id: Ifdf7f016c0d1986fe905f13be8abbeb54af4bce5 Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
committed by
Bart Van Assche
parent
c36f34dff6
commit
f23e2c8fa8
@@ -7033,6 +7033,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
|
||||
struct ufshcd_lrb *lrbp = &hba->lrb[tag];
|
||||
unsigned long flags;
|
||||
int err = FAILED;
|
||||
bool outstanding;
|
||||
u32 reg;
|
||||
|
||||
WARN_ONCE(tag < 0, "Invalid tag %d\n", tag);
|
||||
@@ -7110,7 +7111,17 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
|
||||
goto release;
|
||||
}
|
||||
|
||||
lrbp->cmd = NULL;
|
||||
/*
|
||||
* Clear the corresponding bit from outstanding_reqs since the command
|
||||
* has been aborted successfully.
|
||||
*/
|
||||
spin_lock_irqsave(&hba->outstanding_lock, flags);
|
||||
outstanding = __test_and_clear_bit(tag, &hba->outstanding_reqs);
|
||||
spin_unlock_irqrestore(&hba->outstanding_lock, flags);
|
||||
|
||||
if (outstanding)
|
||||
ufshcd_release_scsi_cmd(hba, lrbp);
|
||||
|
||||
err = SUCCESS;
|
||||
|
||||
release:
|
||||
|
||||
Reference in New Issue
Block a user