diff options
| author | Bao D. Nguyen <nguyenb@codeaurora.org> | 2017-06-05 17:31:53 -0700 |
|---|---|---|
| committer | Bao D. Nguyen <nguyenb@codeaurora.org> | 2017-06-06 12:19:21 -0700 |
| commit | 04147f52cce7768e45c2fa16e96f93c34b787168 (patch) | |
| tree | 626028a89cd8f66001bbe86c8d1be19abcaebdc3 | |
| parent | 2bfc0eda7e6d832f7b8b2c9cdbed6dd24cdb69d9 (diff) | |
scsi: ufs: Avoid dead lock during error recovery
The UFS error handler work may be entered from the clock scaling context
which may have acquired the lock used to synchronize between clock scaling
and shutdown. Part of the error handler work is to send management
requests during which the same synchronization lock is acquired again.
This condition leads to a dead lock. To avoid this dead lock,
skip acquiring the synchronization lock when sending management
requests as part of the error handler.
Change-Id: I38179528868aaeb4a788a83ca8f9c458afea862a
Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
| -rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index a90c51a113d2..b8dc7e834cf3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -3285,8 +3285,10 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, /* * May get invoked from shutdown and IOCTL contexts. * In shutdown context, it comes in with lock acquired. + * In error recovery context, it may come with lock acquired. */ - if (!ufshcd_is_shutdown_ongoing(hba)) + + if (!ufshcd_is_shutdown_ongoing(hba) && !ufshcd_eh_in_progress(hba)) down_read(&hba->lock); /* @@ -3320,7 +3322,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, out_put_tag: ufshcd_put_dev_cmd_tag(hba, tag); wake_up(&hba->dev_cmd.tag_wq); - if (!ufshcd_is_shutdown_ongoing(hba)) + if (!ufshcd_is_shutdown_ongoing(hba) && !ufshcd_eh_in_progress(hba)) up_read(&hba->lock); return err; } |
