Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6cc2a1b authored by Sujit Reddy Thumma's avatar Sujit Reddy Thumma
Browse files

scsi: ufs: Avoid resuming while handling errors during suspend



If there are any scsi command errors while executing host suspend,
the scsi error handling routine would wait for host to be resumed
and handle the errors. If the host suspend initiates a blocking scsi
command which would also wait for error handling to be completed,
it causes a deadlock. Fix this by skipping "wait till resume" in
error handling while there are pending commands during host suspend.

Change-Id: I41def4b21bbe7808869c6b92f7f12939ba6ecf29
Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
parent 76ccdc74
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -4519,6 +4519,13 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
	if (!sdp || !scsi_device_online(sdp))
		return -ENODEV;

	/*
	 * If scsi commands fail, the scsi mid-layer schedules scsi error-
	 * handling, which would wait for host to be resumed. Since we know
	 * we are functional while we are here, skip host resume in error
	 * handling context.
	 */
	hba->host->eh_noresume = 1;
	if (pwr_mode != UFS_ACTIVE_PWR_MODE) {
		ret = ufshcd_send_request_sense(hba, sdp);
		if (ret)
@@ -4547,6 +4554,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
	if (!ret)
		hba->curr_dev_pwr_mode = pwr_mode;
out:
	hba->host->eh_noresume = 0;
	return ret;
}