[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH initramfs-tools 10/10] local: Use max(30, rootdelay) as timeout for block device to appear



The rootdelay kernel parameter is specified as a fixed delay before
attempting to mount the root filesystem, not a timeout.  In the
initramfs it is processed by udev's init-top script.  This is being
used to workaround bug #678696, but as most users will set the
shortest value that seems to work, it is fragile.  Using the same
value as a timeout makes our fix for #678696 fragile too.

We shouldn't really use $ROOTDELAY here at all, but as some users may
have a good reason for wanting a longer timeout and may depend on the
current behaviour, make our current default timeout of 30 seconds a
minimum.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 scripts/local | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/local b/scripts/local
index 54eb674..f6424f0 100644
--- a/scripts/local
+++ b/scripts/local
@@ -64,8 +64,11 @@ local_device_setup()
 	if [ ! -e "$1" ] || ! $(get_fstype "$1" >/dev/null); then
 		log_begin_msg "Waiting for $2 file system"
 
-		# Default delay is 30s (approximately)
-		slumber=${ROOTDELAY:-30}
+		# Timeout is max(30, rootdelay) seconds (approximately)
+		slumber=30
+		if [ ${ROOTDELAY:-0} -gt $slumber ]; then
+			slumber=$ROOTDELAY
+		fi
 
 		while true; do
 			sleep 1

-- 
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: