[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dbe3e867-7e47-e306-038e-2e578845c5ba@acm.org>
Date: Wed, 23 Jun 2021 14:30:24 -0700
From: Bart Van Assche <bvanassche@....org>
To: Can Guo <cang@...eaurora.org>, asutoshd@...eaurora.org,
nguyenb@...eaurora.org, hongwus@...eaurora.org,
ziqichen@...eaurora.org, linux-scsi@...r.kernel.org,
kernel-team@...roid.com
Cc: Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Stanley Chu <stanley.chu@...iatek.com>,
Bean Huo <beanhuo@...ron.com>,
Jaegeuk Kim <jaegeuk@...nel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 07/10] scsi: ufs: Simplify error handling preparation
On 6/23/21 12:35 AM, Can Guo wrote:
> -static void ufshcd_err_handling_prepare(struct ufs_hba *hba)
> +static int ufshcd_err_handling_prepare(struct ufs_hba *hba)
> {
> /*
> * It is not safe to perform error handling while suspend or resume is
> * in progress. Hence the lock_system_sleep() call.
> */
> lock_system_sleep();
> + /*
> + * Exclusively call pm_runtime_get_sync(hba->dev) once, in case
> + * following ufshcd_rpm_get_sync() fails.
> + */
> + pm_runtime_get_sync(hba->dev);
> + if (pm_runtime_suspended(hba->dev) || hba->is_sys_suspended) {
> + pm_runtime_put(hba->dev);
> + unlock_system_sleep();
> + return -EINVAL;
> + }
There is code present in ufshcd_queuecommand() that may trigger data
corruption to prevent that the above pm_runtime_get_sync() call triggers
a deadlock. I think we need a better solution.
Thanks,
Bart.
Powered by blists - more mailing lists