From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: acelan.kao@canonical.com,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: core: Avoid doing rescan on suspended device
Date: Wed, 19 Apr 2023 13:41:12 +0800 [thread overview]
Message-ID: <20230419054112.269734-1-kai.heng.feng@canonical.com> (raw)
During system resume, if an EH is schduled after ATA host is resumed
(i.e. ATA_PFLAG_PM_PENDING cleared), but before the disk device is
resumed, the device_lock hold by scsi_rescan_device() is never released
so the dpm_resume() of the disk is blocked forerver.
That's because scsi_attach_vpd() is expecting the disk device is in
operational state, as it doesn't work on suspended device.
To avoid such deadlock, avoid doing rescan if the disk is still
suspended so the resume process of the disk device can proceed.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
drivers/scsi/scsi_scan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index d217be323cc6..36680cb1535b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1621,6 +1621,9 @@ void scsi_rescan_device(struct device *dev)
{
struct scsi_device *sdev = to_scsi_device(dev);
+ if (dev->power.is_prepared)
+ return;
+
device_lock(dev);
scsi_attach_vpd(sdev);
--
2.34.1
next reply other threads:[~2023-04-19 5:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 5:41 Kai-Heng Feng [this message]
2023-04-20 17:43 ` Benjamin Block
2023-04-24 3:30 ` Kai-Heng Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230419054112.269734-1-kai.heng.feng@canonical.com \
--to=kai.heng.feng@canonical.com \
--cc=acelan.kao@canonical.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®