--- vfs_mount.c 2010-03-17 15:30:45.000000000 +0100 +++ vfs_mount.c 2010-03-17 14:49:52.000000000 +0100 @@ -1798,6 +1806,8 @@ int error; char patt[32]; char errmsg[255]; + char nbtry; + int rootmounttrymax; vfsname = NULL; path = NULL; @@ -1805,6 +1815,8 @@ ma = NULL; error = EINVAL; bzero(errmsg, sizeof(errmsg)); + nbtry = 0; + rootmounttrymax = 3; if (mountfrom == NULL) return (error); /* don't complain */ @@ -1827,7 +1839,18 @@ 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); + + TUNABLE_INT_FETCH("vfs.root.mounttrymax", &rootmounttrymax); + while (1) { + 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) { /*