diff options
author | Can Guo <[email protected]> | 2020-02-10 19:40:48 -0800 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2020-02-12 19:42:36 -0500 |
commit | c63d6099a7959ecc919b2549dc6b71f53521f819 (patch) | |
tree | d74b1e95f6b2352308da81421b213d13ce0d658a | |
parent | 38f3242e9e2022a7613dd4c108f2b7d55a9bb00a (diff) |
scsi: ufs: Fix ufshcd_hold() caused scheduling while atomic
The async version of ufshcd_hold(async == true), which is only called in
queuecommand path as for now, is expected to work in atomic context, thus
it should not sleep or schedule out. When it runs into the condition that
clocks are ON but link is still in hibern8 state, it should bail out
without flushing the clock ungate work.
Fixes: f2a785ac2312 ("scsi: ufshcd: Fix race between clk scaling and ungate work")
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Hongwu Su <[email protected]>
Reviewed-by: Asutosh Das <[email protected]>
Reviewed-by: Bean Huo <[email protected]>
Reviewed-by: Stanley Chu <[email protected]>
Signed-off-by: Can Guo <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 661ba376b4da..19270748ecd4 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1518,6 +1518,11 @@ start: */ if (ufshcd_can_hibern8_during_gating(hba) && ufshcd_is_link_hibern8(hba)) { + if (async) { + rc = -EAGAIN; + hba->clk_gating.active_reqs--; + break; + } spin_unlock_irqrestore(hba->host->host_lock, flags); flush_work(&hba->clk_gating.ungate_work); spin_lock_irqsave(hba->host->host_lock, flags); |