summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2016-05-10 08:44:44 +0000
committertrasz <trasz@FreeBSD.org>2016-05-10 08:44:44 +0000
commit8e6e54de641f300c70302f954c7853f0f46616a9 (patch)
tree5742fbabd683728c69b68d3d4c57d83930d6b1ad /etc/rc.d
parentafb02a35fa1b82fd030ce96419146aa528d5cd84 (diff)
downloadFreeBSD-src-8e6e54de641f300c70302f954c7853f0f46616a9.zip
FreeBSD-src-8e6e54de641f300c70302f954c7853f0f46616a9.tar.gz
Refactor the root mount hold code and add the wait to etc/rc.d/fsck.
This fixes mounting (non-root) USB drives on boot with fsck enabled (with non-zero 'Pass#' field in fstab(5)). Reported by: Graham Menhennitt <graham at menhennitt.com.au> Reviewed by: jilles@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6221
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/fsck18
-rwxr-xr-xetc/rc.d/mountcritlocal27
2 files changed, 17 insertions, 28 deletions
diff --git a/etc/rc.d/fsck b/etc/rc.d/fsck
index 23bbe2e..bd3122a 100755
--- a/etc/rc.d/fsck
+++ b/etc/rc.d/fsck
@@ -31,7 +31,21 @@ fsck_start()
fsck -p
fi
- case $? in
+ err=$?
+ if [ ${err} -eq 3 ]; then
+ echo "Warning! Some of the devices might not be" \
+ "available; retrying"
+ root_hold_wait
+ check_startmsgs && echo "Restarting file system checks:"
+ if checkyesno background_fsck; then
+ fsck -F -p
+ else
+ fsck -p
+ fi
+ err=$?
+ fi
+
+ case ${err} in
0)
;;
2)
@@ -68,7 +82,7 @@ fsck_start()
stop_boot
;;
*)
- echo "Unknown error; help!"
+ echo "Unknown error ${err}; help!"
stop_boot
;;
esac
diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal
index 798130d..f52c565 100755
--- a/etc/rc.d/mountcritlocal
+++ b/etc/rc.d/mountcritlocal
@@ -37,37 +37,12 @@ mountcritlocal_start()
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.
mount -a -t ${mount_excludes}
err=$?
if [ ${err} -ne 0 ]; then
- 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
+ root_hold_wait
mount -a -t ${mount_excludes}
err=$?
fi
OpenPOWER on IntegriCloud