From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: Alan Stern <stern@rowland.harvard.edu>,
linux-kernel@vger.kernel.org, dsd@gentoo.org,
mdharm-usb@one-eyed-alien.net, linux-usb@vger.kernel.org,
vegardno@ifi.uio.no, James.Bottomley@HansenPartnership.com,
linux-scsi@vger.kernel.org, Greg KH <greg@kroah.com>,
Matthew Wilcox <matthew@wil.cx>
Subject: Re: [RFC/PATCH] usb-storage: wait for device scanning before mounting root
Date: Fri, 25 Apr 2008 09:53:01 +0200 [thread overview]
Message-ID: <48118DDD.8010507@s5r6.in-berlin.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0804250022160.1209@sbz-30.cs.Helsinki.FI>
(Adding Cc: Matthew Wilcox)
Pekka J Enberg wrote:
> Add a new kernel config option CONFIG_LATE_ROOT_MOUNT that makes the kernel
> wait until background scanning of USB mass storage devices is complete before
> attempting to mount the root filesystem.
>
> The config option is an alternative to the root_delay= kernel parameter
> solution people currently use to boot from USB mass storage devices.
[...]
> drivers/scsi/scsi_scan.c | 2 ++
> drivers/usb/storage/usb.c | 3 +++
> include/linux/init.h | 12 ++++++++++++
> init/Kconfig | 5 +++++
> init/do_mounts.c | 32 ++++++++++++++++++++++++++++++++
> 5 files changed, 54 insertions(+)
>
> Index: linux-2.6/drivers/usb/storage/usb.c
> ===================================================================
> --- linux-2.6.orig/drivers/usb/storage/usb.c
> +++ linux-2.6/drivers/usb/storage/usb.c
> @@ -928,6 +928,7 @@ static int usb_stor_scan_thread(void * _
> /* Should we unbind if no devices were detected? */
> }
>
> + complete_root_scan();
> complete_and_exit(&us->scanning_done, 0);
> }
>
> @@ -1007,12 +1008,14 @@ static int storage_probe(struct usb_inte
> goto BadDevice;
> }
>
> + begin_root_scan();
> /* Start up the thread for delayed SCSI-device scanning */
> th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan");
> if (IS_ERR(th)) {
> printk(KERN_WARNING USB_STORAGE
> "Unable to start the device-scanning thread\n");
> quiesce_and_remove_host(us);
> + complete_root_scan();
> result = PTR_ERR(th);
> goto BadDevice;
> }
[...]
> Index: linux-2.6/drivers/scsi/scsi_scan.c
> ===================================================================
> --- linux-2.6.orig/drivers/scsi/scsi_scan.c
> +++ linux-2.6/drivers/scsi/scsi_scan.c
> @@ -1802,6 +1802,7 @@ static int do_scan_async(void *_data)
> struct async_scan_data *data = _data;
> do_scsi_scan_host(data->shost);
> scsi_finish_async_scan(data);
> + complete_root_scan();
> return 0;
> }
>
> @@ -1823,6 +1824,7 @@ void scsi_scan_host(struct Scsi_Host *sh
> return;
> }
>
> + begin_root_scan();
> p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
> if (unlikely(IS_ERR(p)))
> do_scan_async(data);
Looks like you want complete_root_scan() after IS_ERR(p). Are there any
other thread exit paths which don't call complete_root_scan() yet?
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?
--
Stefan Richter
-=====-==--- -=-- ==--=
http://arcgraph.de/sr/
next prev parent reply other threads:[~2008-04-25 7:53 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-24 20:21 Pekka J Enberg
2008-04-24 21:08 ` Alan Stern
2008-04-24 21:25 ` Pekka J Enberg
2008-04-24 22:56 ` Greg KH
2008-04-24 23:30 ` Matthew Dharm
2008-04-25 6:30 ` Pekka J Enberg
2008-04-25 7:04 ` Matthew Dharm
2008-04-25 8:19 ` Pekka J Enberg
2008-04-25 15:35 ` Matthew Dharm
2008-04-25 16:05 ` Greg KH
2008-04-25 6:09 ` Pekka J Enberg
2008-04-25 7:53 ` Stefan Richter [this message]
2008-04-25 8:15 ` Pekka J Enberg
2008-04-25 9:11 ` Matthew Wilcox
2008-06-19 18:23 ` Matthew Wilcox
2008-06-19 18:39 ` Stefan Richter
2008-06-19 18:43 ` Stefan Richter
2008-06-19 18:54 ` Matthew Wilcox
2008-06-19 19:52 ` Matthew Dharm
2008-06-19 20:49 ` Matthew Wilcox
2008-06-19 21:19 ` Stefan Richter
2008-06-19 19:54 ` Stefan Richter
2008-06-19 20:22 ` Matthew Wilcox
2008-06-19 20:34 ` Stefan Richter
2008-06-19 21:39 ` Alan Stern
2008-06-19 23:13 ` David Brownell
2008-06-20 9:53 ` Gabor Gombas
2008-06-20 14:14 ` Matthew Dharm
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=48118DDD.8010507@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dsd@gentoo.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=mdharm-usb@one-eyed-alien.net \
--cc=penberg@cs.helsinki.fi \
--cc=stern@rowland.harvard.edu \
--cc=vegardno@ifi.uio.no \
/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®