From owner-svn-src-head@freebsd.org Mon Dec 21 17:07:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E99EA4EC1D; Mon, 21 Dec 2015 17:07:41 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 080BA14E9; Mon, 21 Dec 2015 17:07:41 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 58C9FB8068; Mon, 21 Dec 2015 18:07:38 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 42C4328494; Mon, 21 Dec 2015 18:07:38 +0100 (CET) Date: Mon, 21 Dec 2015 18:07:38 +0100 From: Jilles Tjoelker To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r290197 - in head: etc/defaults etc/rc.d sys/kern Message-ID: <20151221170738.GA19579@stack.nl> References: <201510301552.t9UFqAtv073641@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201510301552.t9UFqAtv073641@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2015 17:07:41 -0000 On Fri, Oct 30, 2015 at 03:52:10PM +0000, Edward Tomasz Napierala wrote: > Author: trasz > Date: Fri Oct 30 15:52:10 2015 > New Revision: 290197 > URL: https://svnweb.freebsd.org/changeset/base/290197 > Log: > After r290196, the kernel won't wait for stuff like gmirror nodes > if they are not required for mounting rootfs. However, it's possible > that some setups try to mount them in mountcritlocal (ie from fstab). > Export the list of current root mount holds using a new sysctl, > vfs.root_mount_hold, and make mountcritlocal retry if "mount -a" fails > and the list is not empty. > MFC after: 1 month > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D3709 I like the faster startup, but the rc.d script clearly will not wait as intended. See below. > Modified: > head/etc/defaults/rc.conf > head/etc/rc.d/mountcritlocal > head/sys/kern/vfs_mountroot.c > [snip] > Modified: head/etc/rc.d/mountcritlocal > ============================================================================== > --- head/etc/rc.d/mountcritlocal Fri Oct 30 15:35:04 2015 (r290196) > +++ head/etc/rc.d/mountcritlocal Fri Oct 30 15:52:10 2015 (r290197) > @@ -15,7 +15,7 @@ stop_cmd=sync > > mountcritlocal_start() > { > - local err > + local err holders waited > > # Set up the list of network filesystem types for which mounting > # should be delayed until after network initialization. > @@ -35,8 +35,42 @@ mountcritlocal_start() > mount_excludes="${mount_excludes}${fstype}," > done > mount_excludes=${mount_excludes%,} > + > + # Originally, root mount hold had to be released before mounting the root > + # filesystem. This delayed the boot, so it was changed to only wait if > + # the root device isn't readily available. This can result in this script > + # executing before all the devices - such as graid(8) - are available. > + # Thus, should the mount fail, we will wait for the root mount hold release > + # and retry. These lines are a bit too long. > mount -a -t ${mount_excludes} > err=$? > + if [ $? -ne 0 ]; then The assignment will set $? to 0, so the new code will never be executed. "$err" should be tested instead of $?. > + echo > + echo 'Mounting /etc/fstab filesystems failed,' \ > + 'will retry after root mount hold release' > + > + waited=0 > + while [ ${waited} -lt ${root_hold_delay} ]; do > + holders="$(sysctl -n vfs.root_mount_hold)" > + if [ -z "${holders}" ]; then > + break; > + fi > + if [ ${waited} -eq 0 ]; then > + echo -n "Waiting ${root_hold_delay}s" \ > + "for the root mount holders: ${holders}" > + else > + echo -n . > + fi > + if [ ${waited} -eq ${root_hold_delay} ]; then > + break 2 > + fi > + sleep 1 > + waited=$(($waited + 1)) > + done > + mount -a -t ${mount_excludes} > + err=$? > + fi > + > check_startmsgs && echo '.' > > case ${err} in > @@ -44,7 +78,7 @@ mountcritlocal_start() > ;; > *) > echo 'Mounting /etc/fstab filesystems failed,' \ > - ' startup aborted' > + 'startup aborted' > stop_boot true > ;; > esac > [snip] -- Jilles Tjoelker