Bug 144695

Summary: [vfs] [patch] race condition in mounting a root-fs on an external usb-disk
Product: Base System Reporter: Torsten <tkalix>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Torsten 2010-03-12 14:30:03 UTC
Hello!

I have installed FreeBSD 8 on my external usb-harddisk without any problems. Just I cannot boot into it, but I always receive a mountroot-prompt. 
Reading the news / archives I found a problem in the mountroot taking place too early -- before all of the usb-probe and device-setup is fully done.
There was (?) no really solution available, so I have made a small change that caused everything to work -- but one may see this more a work-around than rather a real fix.
The main idea is to put in an un-conditional wait at the beginning of vfs_mountroot. And, of course make this configurable. The acutal change is just a few lines that should not harm anything else. 
For my system I have started with the default of 5000ms, but I needed to go to 15000ms to mount my root-fs safely.
Please find attached the source-diff.

Fix: FreeBSD unixrest 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Fri Mar 12 14:02:27 CET 2010     root@unixrest:/usr/src/sys/i386/compile/BXGENERIC  i386


Patch attached with submission follows:
Comment 1 Garrett Cooper 2010-03-12 22:18:44 UTC
1. This was misfiled (should be under kern).
2. This is a well-known issue (devices in general not being available
by the time mount of mountroot is attempted) that isn't trivial to
resolve.
3. mav@ has a more scalable solution offered here that's been
committed into CURRENT in the past couple months:
http://www.mail-archive.com/freebsd-stable@freebsd.org/msg107696.html
. Look for kern.cam.boot_delay.

HTH,
-Garrett
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:04 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:37:02 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>