From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 16 11:30:08 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 2F298106566B for ; Fri, 16 Jul 2010 11:30:08 +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 056E48FC0C for ; Fri, 16 Jul 2010 11:30:08 +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 o6GBU7iX054627 for ; Fri, 16 Jul 2010 11:30:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o6GBU7Rr054622; Fri, 16 Jul 2010 11:30:07 GMT (envelope-from gnats) Date: Fri, 16 Jul 2010 11:30:07 GMT Message-Id: <201007161130.o6GBU7Rr054622@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Daniel Hartmeier Cc: Subject: Re: kern/144824: [boot] [patch] boot problem on USB (root partition mounting) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Hartmeier List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2010 11:30:08 -0000 The following reply was made to PR kern/144824; it has been noted by GNATS. From: Daniel Hartmeier To: bug-followup@FreeBSD.org Cc: gblanc@linagora.com Subject: Re: kern/144824: [boot] [patch] boot problem on USB (root partition mounting) Date: Fri, 16 Jul 2010 12:56:05 +0200 You have to move the ma initialization inside the retry loop, because kernel_mount() frees it, otherwise I get a kernel panic. With that changed, the patch solves the issue with an Intel S5000PAL board booting from USB, where da0 attaches slightly too late. Possibly related to the RMM2 (remote management module), which attaches multiple (virtual) CD-ROM drives to USB, which produce CAM/SCSI status errors. Daniel --- vfs_mount.c 30 Jan 2010 12:11:21 -0000 1.312.2.3 +++ vfs_mount.c 16 Jul 2010 10:38:46 -0000 @@ -1798,6 +1798,8 @@ int error; char patt[32]; char errmsg[255]; + char nbtry; + int rootmounttrymax; vfsname = NULL; path = NULL; @@ -1805,6 +1807,8 @@ ma = NULL; error = EINVAL; bzero(errmsg, sizeof(errmsg)); + nbtry = 0; + rootmounttrymax = 3; if (mountfrom == NULL) return (error); /* don't complain */ @@ -1821,13 +1825,23 @@ if (path[0] == '\0') strcpy(path, ROOTNAME); - ma = mount_arg(ma, "fstype", vfsname, -1); - ma = mount_arg(ma, "fspath", "/", -1); - ma = mount_arg(ma, "from", path, -1); - ma = mount_arg(ma, "errmsg", errmsg, sizeof(errmsg)); - ma = mount_arg(ma, "ro", NULL, 0); - ma = parse_mountroot_options(ma, options); - error = kernel_mount(ma, MNT_ROOTFS); + while (1) { + ma = NULL; + ma = mount_arg(ma, "fstype", vfsname, -1); + ma = mount_arg(ma, "fspath", "/", -1); + ma = mount_arg(ma, "from", path, -1); + ma = mount_arg(ma, "errmsg", errmsg, sizeof(errmsg)); + ma = mount_arg(ma, "ro", NULL, 0); + ma = parse_mountroot_options(ma, options); + error = kernel_mount(ma, MNT_ROOTFS); + if (nbtry < rootmounttrymax && error != 0) { + printf("Mount failed, retrying mount root from %s\n", + mountfrom); + tsleep(&rootmounttrymax, PZERO | PDROP, "mount", hz); + nbtry++; + } else + break; + } if (error == 0) { /*