From c9e4b46d4848f9992444119b92ecef5ff957e189 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Jan 2010 00:25:14 +0000 Subject: [PATCH] * Ugly hack: for CIFS mounts, retry the mount a few times (just as in pkgs/build-support/vm). This should make the NixOS regression tests more robust on heavily loaded systems, where they now frequently fail: server# mounting //10.0.2.4/qemu on /hostfs... server# [ 8.233991] Slow work thread pool: Starting up server# [ 8.234721] Slow work thread pool: Ready server# [ 23.271708] CIFS VFS: No response for cmd 114 mid 1 server# [ 23.272443] CIFS VFS: cifs_mount failed w/return code = -112 server# mount: Host is down server# [ 23.275188] Kernel panic - not syncing: Attempted to kill init! Maybe there is a configurable timeout somewhere, which would be much nicer... svn path=/nixos/trunk/; revision=19248 --- modules/system/boot/stage-1-init.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index e0d7869f910..19478f7c400 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -200,8 +200,17 @@ mountFS() { checkFS "$device" mkdir -p "/mnt-root$mountPoint" || true - - mount -t "$fsType" -o "$options" "$device" /mnt-root$mountPoint || fail + + # For CIFS mounts, retry a few times before giving up. + local n=0 + while true; do + if mount -t "$fsType" -o "$options" "$device" /mnt-root$mountPoint; then + break + fi + if [ "$fsType" != cifs -o "$n" -ge 10 ]; then fail; break; fi + echo "retrying..." + n=$((n + 1)) + done }