aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorKalimochoAz <calimochoazucarado@gmail.com>2012-02-11 12:38:44 +0100
committerKalimochoAz <calimochoazucarado@gmail.com>2012-02-11 12:38:44 +0100
commit5d763f2baa4ae928684b60171f26165ffa742691 (patch)
treea2fa57ce8b7371422742bff11ca4e24723f2e26b /init
parent3e0951a2a1399cf402ac783910cf272655b3f78a (diff)
parentbcac798f6c44e21a6bdb2c5f8b056b364e246a35 (diff)
downloadkernel_samsung_crespo-5d763f2baa4ae928684b60171f26165ffa742691.zip
kernel_samsung_crespo-5d763f2baa4ae928684b60171f26165ffa742691.tar.gz
kernel_samsung_crespo-5d763f2baa4ae928684b60171f26165ffa742691.tar.bz2
Merge branch 'linux-3.0.update' into cm.ics.new
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c
index c0851a8..ef6478f 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -360,15 +360,42 @@ out:
}
#ifdef CONFIG_ROOT_NFS
+
+#define NFSROOT_TIMEOUT_MIN 5
+#define NFSROOT_TIMEOUT_MAX 30
+#define NFSROOT_RETRY_MAX 5
+
static int __init mount_nfs_root(void)
{
char *root_dev, *root_data;
+ unsigned int timeout;
+ int try, err;
- if (nfs_root_data(&root_dev, &root_data) != 0)
- return 0;
- if (do_mount_root(root_dev, "nfs", root_mountflags, root_data) != 0)
+ err = nfs_root_data(&root_dev, &root_data);
+ if (err != 0)
return 0;
- return 1;
+
+ /*
+ * The server or network may not be ready, so try several
+ * times. Stop after a few tries in case the client wants
+ * to fall back to other boot methods.
+ */
+ timeout = NFSROOT_TIMEOUT_MIN;
+ for (try = 1; ; try++) {
+ err = do_mount_root(root_dev, "nfs",
+ root_mountflags, root_data);
+ if (err == 0)
+ return 1;
+ if (try > NFSROOT_RETRY_MAX)
+ break;
+
+ /* Wait, in case the server refused us immediately */
+ ssleep(timeout);
+ timeout <<= 1;
+ if (timeout > NFSROOT_TIMEOUT_MAX)
+ timeout = NFSROOT_TIMEOUT_MAX;
+ }
+ return 0;
}
#endif