From: Matthew Wilcox <matthew-Ztpu424NOJ8@public.gmane.org>
To: Pekka J Enberg <penberg-bbCR+/B0CizivPeTLB3BmA@public.gmane.org>
Cc: Stefan Richter
<stefanr-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB@public.gmane.org>,
Alan Stern
<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dsd-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org,
mdharm-usb-JGfshJpz5UybPZpvUQj5UqxOck334EZe@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
vegardno-6miFZF/5cTBuMpJDpNschA@public.gmane.org,
James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org,
linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
Subject: Re: [RFC/PATCH] usb-storage: wait for device scanning before mounting root
Date: Thu, 19 Jun 2008 12:23:10 -0600 [thread overview]
Message-ID: <20080619182310.GA30833@parisc-linux.org> (raw)
In-Reply-To: <20080425091122.GA14990-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
This discussion seemed to die off ... did anything ever come of it?
On Fri, Apr 25, 2008 at 03:11:23AM -0600, Matthew Wilcox wrote:
> On Fri, Apr 25, 2008 at 11:15:36AM +0300, Pekka J Enberg wrote:
> > On Fri, 25 Apr 2008, Stefan Richter wrote:
> > > Besides, can't you use the generic async scan facility of the SCSI stack for
> > > your purpose? If not, can it be extended to make it usable?
> >
> > So you mean drivers/scsi/scsi_scan.c, right? We probably can and
> > should so I'll take a look.
>
> The problem is that USB has one scsi_host per device (rather than, say,
> having one scsi_host and adding new devices to it as they're found on
> the USB bus).
>
> I'm certainly open to ideas of hooking into the mechanism -- it's just a
> list of completions after all. Something like this:
>
> void *scsi_insert_into_scan_list(void)
> {
> return scsi_prep_async_scan(NULL);
> }
>
> void scsi_scan_completed(void *cookie)
> {
> struct async_scan_data *data = cookie;
> wait_for_completion(&data->prev_finished);
> spin_lock(&async_scan_lock);
> list_del(&data->list);
> if (!list_empty(&scanning_hosts)) {
> struct async_scan_data *next = list_entry(scanning_hosts.next,
> struct async_scan_data, list);
> complete(&next->prev_finished);
> }
> spin_unlock(&async_scan_lock);
>
> kfree(data);
> }
>
> Perhaps refactor a little -- everything inside the async_scan_lock would
> be common to scsi_scan_completed() and scsi_finish_async_scan().
>
> with appropriate checks for shost being NULL in scsi_prep_async_scan:
>
> +++ b/drivers/scsi/scsi_scan.c
> @@ -1698,7 +1698,7 @@ static struct async_scan_data *scsi_prep_async_scan(struct
> if (strncmp(scsi_scan_type, "sync", 4) == 0)
> return NULL;
>
> - if (shost->async_scan) {
> + if (shost && shost->async_scan) {
> printk("%s called twice for host %d", __FUNCTION__,
> shost->host_no);
> dump_stack();
> @@ -1708,16 +1708,19 @@ static struct async_scan_data *scsi_prep_async_scan(stru
> data = kmalloc(sizeof(*data), GFP_KERNEL);
> if (!data)
> goto err;
> - data->shost = scsi_host_get(shost);
> - if (!data->shost)
> - goto err;
> init_completion(&data->prev_finished);
>
> - mutex_lock(&shost->scan_mutex);
> - spin_lock_irqsave(shost->host_lock, flags);
> - shost->async_scan = 1;
> - spin_unlock_irqrestore(shost->host_lock, flags);
> - mutex_unlock(&shost->scan_mutex);
> + if (shost) {
> + data->shost = scsi_host_get(shost);
> + if (!data->shost)
> + goto err;
> +
> + mutex_lock(&shost->scan_mutex);
> + spin_lock_irqsave(shost->host_lock, flags);
> + shost->async_scan = 1;
> + spin_unlock_irqrestore(shost->host_lock, flags);
> + mutex_unlock(&shost->scan_mutex);
> + }
>
> spin_lock(&async_scan_lock);
> if (list_empty(&scanning_hosts))
>
> Would that work for you?
>
> --
> Intel are signing my paycheques ... these opinions are still mine
> "Bill, look, we understand that you're interested in selling us this
> operating system, but compare it to ours. We can't possibly take such
> a retrograde step."
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-06-19 18:23 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44L0.0804241704220.14840-100000@iolanthe.rowland.org>
2008-04-24 21:25 ` [RFC/PATCH] usb-storage: wait for device scanning before mounting root Pekka J Enberg
2008-04-24 22:56 ` Greg KH
[not found] ` <20080424225604.GA18737-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-04-24 23:30 ` Matthew Dharm
2008-04-25 6:30 ` Pekka J Enberg
2008-04-25 7:04 ` Matthew Dharm
[not found] ` <20080425070439.GA18915-JGfshJpz5UybPZpvUQj5UqxOck334EZe@public.gmane.org>
2008-04-25 8:19 ` Pekka J Enberg
2008-04-25 15:35 ` Matthew Dharm
[not found] ` <Pine.LNX.4.64.0804251116000.758-E5M5q+8Jmr6WKadcF5yKzn5wuOn9r4cE@public.gmane.org>
2008-04-25 16:05 ` Greg KH
2008-04-25 6:09 ` Pekka J Enberg
2008-04-25 7:53 ` Stefan Richter
2008-04-25 8:15 ` Pekka J Enberg
2008-04-25 9:11 ` Matthew Wilcox
[not found] ` <20080425091122.GA14990-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2008-06-19 18:23 ` Matthew Wilcox [this message]
2008-06-19 18:39 ` Stefan Richter
2008-06-19 18:43 ` Stefan Richter
[not found] ` <485AA7EA.6080105-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB@public.gmane.org>
2008-06-19 18:54 ` Matthew Wilcox
[not found] ` <20080619185419.GN4392-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2008-06-19 19:52 ` Matthew Dharm
2008-06-19 20:49 ` Matthew Wilcox
[not found] ` <20080619204954.GQ4392@parisc-linux.org>
[not found] ` <20080619204954.GQ4392-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2008-06-19 21:19 ` Stefan Richter
2008-06-19 19:54 ` Stefan Richter
2008-06-19 20:22 ` Matthew Wilcox
[not found] ` <20080619202226.GP4392-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2008-06-19 20:34 ` Stefan Richter
[not found] ` <20080619182310.GA30833-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2008-06-19 21:39 ` Alan Stern
2008-06-19 23:13 ` David Brownell
2008-06-20 9:53 ` Gabor Gombas
[not found] ` <20080620095311.GK15159-WfxVeM0IB4OcrO3FVCo2em/Xy1I+TMuj@public.gmane.org>
2008-06-20 14:14 ` Matthew Dharm
[not found] ` <Pine.LNX.4.44L0.0806191735570.2229-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-06-20 15:15 ` Vegard Nossum
2008-06-20 15:31 ` Matthew Wilcox
2008-06-20 15:42 ` Alan Stern
2008-06-20 16:37 ` Stefan Richter
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=20080619182310.GA30833@parisc-linux.org \
--to=matthew-ztpu424noj8@public.gmane.org \
--cc=James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org \
--cc=dsd-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org \
--cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mdharm-usb-JGfshJpz5UybPZpvUQj5UqxOck334EZe@public.gmane.org \
--cc=penberg-bbCR+/B0CizivPeTLB3BmA@public.gmane.org \
--cc=stefanr-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
--cc=vegardno-6miFZF/5cTBuMpJDpNschA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).