From: Michael Reed <mdr@sgi.com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Cc: James Bottomley <James.Bottomley@suse.de>,
Hannes Reinecke <hare@suse.de>, Jeremy Higdon <jeremy@sgi.com>,
James Smart <James.Smart@Emulex.Com>
Subject: PATCH [1/1]: sd_remove() hangs waiting on async_synchronize of unrelated threads
Date: Tue, 01 Dec 2009 15:45:31 -0600 [thread overview]
Message-ID: <4B158E7B.3040708@sgi.com> (raw)
Prevent delays and hangs due to sd_remove() waiting for the completion of
async threads executing sd_probe_async of disks on unrelated host adapters.
This patch executes every sd_probe_async in its own async domain allowing
sd_remove() to wait for just the completion of the async thread associated with
the scsi_disk being removed.
Found via fault insertion on a large fibre channel fabric.
Applies to 2.6.32-rc8.
Signed-off-by: Michael Reed <mdr@sgi.com>
--- linux-2.6.32-rc8/drivers/scsi/sd.h 2009-11-19 16:32:38.000000000 -0600
+++ linux-2.6.32-rc8-modified/drivers/scsi/sd.h 2009-12-01 15:25:33.686651715 -0600
@@ -60,6 +60,7 @@ struct scsi_disk {
unsigned RCD : 1; /* state of disk RCD bit, unused */
unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
unsigned first_scan : 1;
+ struct list_head async_domain; /* for sd_probe_async */
};
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
--- linux-2.6.32-rc8/drivers/scsi/sd.c 2009-11-19 16:32:38.000000000 -0600
+++ linux-2.6.32-rc8-modified/drivers/scsi/sd.c 2009-12-01 15:26:17.686653817 -0600
@@ -2171,7 +2171,8 @@ static int sd_probe(struct device *dev)
get_device(&sdp->sdev_gendev);
get_device(&sdkp->dev); /* prevent release before async_schedule */
- async_schedule(sd_probe_async, sdkp);
+ INIT_LIST_HEAD(&sdkp->async_domain);
+ async_schedule_domain(sd_probe_async, sdkp, &sdkp->async_domain);
return 0;
@@ -2202,8 +2203,9 @@ static int sd_remove(struct device *dev)
{
struct scsi_disk *sdkp;
- async_synchronize_full();
sdkp = dev_get_drvdata(dev);
+ async_synchronize_full_domain(&sdkp->async_domain);
+
blk_queue_prep_rq(sdkp->device->request_queue, scsi_prep_fn);
device_del(&sdkp->dev);
del_gendisk(sdkp->disk);
next reply other threads:[~2009-12-01 21:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-01 21:45 Michael Reed [this message]
2009-12-01 21:49 ` PATCH [1/1]: sd_remove() hangs waiting on async_synchronize of unrelated threads James Bottomley
2009-12-01 22:28 ` Michael Reed
2009-12-01 22:50 ` James Bottomley
2009-12-02 14:27 ` Michael Reed
2009-12-02 14:44 ` James Bottomley
2009-12-02 15:18 ` Michael Reed
2009-12-02 15:35 ` James Bottomley
2009-12-02 17:06 ` Michael Reed
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=4B158E7B.3040708@sgi.com \
--to=mdr@sgi.com \
--cc=James.Bottomley@suse.de \
--cc=James.Smart@Emulex.Com \
--cc=hare@suse.de \
--cc=jeremy@sgi.com \
--cc=linux-scsi@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.