Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282931
b: refs/heads/master
c: 43717c7
h: refs/heads/master
i:
  282929: 92b8b70
  282927: d614fc1
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Jan 5, 2012
1 parent 8574b87 commit 5dc43eb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 68c97153fb7f2877f98aa6c29546381d9cad2fed
refs/heads/master: 43717c7daebf10b43f12e68512484b3095bb1ba5
35 changes: 31 additions & 4 deletions trunk/init/do_mounts.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,42 @@ void __init mount_block_root(char *name, int flags)
}

#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

Expand Down

0 comments on commit 5dc43eb

Please sign in to comment.