From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>,
Hannes Reinecke <hare@suse.de>,
John Garry <john.garry@huawei.com>
Subject: [PATCH v2 1/3] scsi: Simplify scsi_forget_host()
Date: Thu, 30 Jun 2022 14:37:31 -0700 [thread overview]
Message-ID: <20220630213733.17689-2-bvanassche@acm.org> (raw)
In-Reply-To: <20220630213733.17689-1-bvanassche@acm.org>
scsi_forget_host() has only one caller, namely scsi_remove_host(). That
function may sleep. Additionally, scsi_forget_host() calls a function
that may sleep (__scsi_remove_device()). Simplify scsi_forget_host() by
removing support for saving and restoring the interrupt state.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.garry@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_scan.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 91ac901a6682..5c3bb4ceeac3 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1964,17 +1964,18 @@ EXPORT_SYMBOL(scsi_scan_host);
void scsi_forget_host(struct Scsi_Host *shost)
{
struct scsi_device *sdev;
- unsigned long flags;
+
+ might_sleep();
restart:
- spin_lock_irqsave(shost->host_lock, flags);
+ spin_lock_irq(shost->host_lock);
list_for_each_entry(sdev, &shost->__devices, siblings) {
if (sdev->sdev_state == SDEV_DEL)
continue;
- spin_unlock_irqrestore(shost->host_lock, flags);
+ spin_unlock_irq(shost->host_lock);
__scsi_remove_device(sdev);
goto restart;
}
- spin_unlock_irqrestore(shost->host_lock, flags);
+ spin_unlock_irq(shost->host_lock);
}
next prev parent reply other threads:[~2022-06-30 21:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 21:37 [PATCH v2 0/3] Call blk_mq_free_tag_set() earlier Bart Van Assche
2022-06-30 21:37 ` Bart Van Assche [this message]
2022-07-05 2:40 ` [PATCH v2 1/3] scsi: Simplify scsi_forget_host() Ming Lei
2022-06-30 21:37 ` [PATCH v2 2/3] scsi: Make scsi_forget_host() wait for request queue removal Bart Van Assche
2022-07-01 16:25 ` Mike Christie
2022-07-01 23:44 ` Bart Van Assche
2022-07-05 3:38 ` Ming Lei
2022-06-30 21:37 ` [PATCH v2 3/3] scsi: core: Call blk_mq_free_tag_set() earlier Bart Van Assche
2022-07-01 3:44 ` Ming Lei
2022-07-01 7:25 ` lizhijian
2022-07-01 7:45 ` Li, Zhijian
2022-07-01 14:07 ` Bart Van Assche
2022-07-01 14:37 ` Ming Lei
2022-07-01 23:58 ` Bart Van Assche
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=20220630213733.17689-2-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=john.garry@huawei.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.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