From owner-freebsd-bugs@FreeBSD.ORG Fri Mar 12 14:30:03 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9D241065673 for ; Fri, 12 Mar 2010 14:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 86DF18FC1D for ; Fri, 12 Mar 2010 14:30:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o2CEU3CF087139 for ; Fri, 12 Mar 2010 14:30:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o2CEU3j9087134; Fri, 12 Mar 2010 14:30:03 GMT (envelope-from gnats) Resent-Date: Fri, 12 Mar 2010 14:30:03 GMT Resent-Message-Id: <201003121430.o2CEU3j9087134@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Torsten Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8A101065670 for ; Fri, 12 Mar 2010 14:27:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id A75718FC13 for ; Fri, 12 Mar 2010 14:27:54 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o2CERrr9066392 for ; Fri, 12 Mar 2010 14:27:54 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o2CERrap066391; Fri, 12 Mar 2010 14:27:53 GMT (envelope-from nobody) Message-Id: <201003121427.o2CERrap066391@www.freebsd.org> Date: Fri, 12 Mar 2010 14:27:53 GMT From: Torsten To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/144695: race condition in mounting a root-fs on an external usb-disk X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 14:30:03 -0000 >Number: 144695 >Category: misc >Synopsis: race condition in mounting a root-fs on an external usb-disk >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 12 14:30:03 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Torsten >Release: freebsd 8.0 release >Organization: n/a >Environment: >Description: 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. >How-To-Repeat: >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: --- vfs_mount.c.orig 2010-03-12 13:02:33.000000000 +0100 +++ vfs_mount.c 2010-03-12 13:56:04.000000000 +0100 @@ -1648,6 +1648,12 @@ options = NULL; + static int mountroot_wait_delay = 5000; + TUNABLE_INT_FETCH("hw.mountroot_wait_delay", &mountroot_wait_delay); + int mysec = mountroot_wait_delay / hz; + printf("Waiting %d seconds for devices to settle.\n", mysec); + pause("Waiting for devices to settle", mountroot_wait_delay); + root_mount_prepare(); mount_zone = uma_zcreate("Mountpoints", sizeof(struct mount), @@ -2492,3 +2498,4 @@ error = kernel_mount(ma, flags); return (error); } + >Release-Note: >Audit-Trail: >Unformatted: