Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 08d95e3

Browse files
bvanasscheBart Van Assche
authored andcommitted
FROMLIST: scsi: ufs: Fix a race condition in the clock gating code
The hba->outstanding_reqs bitmask only has information about outstanding requests if MCQ is disabled. Replace this expression with scsi_host_busy(hba->host) to support both modes (MCQ disabled and MCQ enabled). Fixes: eacb139 ("scsi: ufs: core: mcq: Enable multi-circular queue") Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/linux-scsi/[email protected]/ Change-Id: Ie1874e3487cf17baaad84b060073c26694a592fd Signed-off-by: Bart Van Assche <[email protected]>
1 parent 55cef59 commit 08d95e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,8 @@ static void ufshcd_print_host_state(struct ufs_hba *hba)
632632
const struct scsi_device *sdev_ufs = hba->ufs_device_wlun;
633633

634634
dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
635-
dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n",
636-
hba->outstanding_reqs, hba->outstanding_tasks);
635+
dev_err(hba->dev, "outstanding reqs=%d tasks=0x%lx\n",
636+
scsi_host_busy(hba->host), hba->outstanding_tasks);
637637
dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n",
638638
hba->saved_err, hba->saved_uic_err);
639639
dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n",
@@ -1848,7 +1848,7 @@ static void ufshcd_gate_work(struct work_struct *work)
18481848

18491849
if (hba->clk_gating.active_reqs
18501850
|| hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL
1851-
|| hba->outstanding_reqs || hba->outstanding_tasks
1851+
|| scsi_host_busy(hba->host) || hba->outstanding_tasks
18521852
|| hba->active_uic_cmd || hba->uic_async_done)
18531853
goto rel_lock;
18541854

@@ -9003,7 +9003,7 @@ static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd)
90039003
dev_info(hba->dev, "%s() finished; outstanding_tasks = %#lx.\n",
90049004
__func__, hba->outstanding_tasks);
90059005

9006-
return hba->outstanding_reqs ? SCSI_EH_RESET_TIMER : SCSI_EH_DONE;
9006+
return scsi_host_busy(hba->host) ? SCSI_EH_RESET_TIMER : SCSI_EH_DONE;
90079007
}
90089008

90099009
static const struct attribute_group *ufshcd_driver_groups[] = {

0 commit comments

Comments
 (0)