Since revision 1.40/1.41, the default behaviour for mount_nfs is

to give up after one attempt unless a background mount is requested.
Background mounts would retry 10000 times (at least 7 days) before
giving up.

For some situations such as diskless terminals, an NFS filesystem
may be critical to the boot process, so neither the "try once" nor
background mounts are appropiate. To cater for this situation,
unbreak the -R (retry count) parameter so that it also works in
the non-background case. Interpret a zero retry count as "retry
forever".

The defaults are now "try once" for non-background mounts and "retry
forever" for background mounts; both can be overridden via -R.
Add a description of this behaviour to the manpage.
This commit is contained in:
Ian Dowse 2001-07-19 21:11:48 +00:00
parent 19f2be11b0
commit e16873dad6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80006
2 changed files with 20 additions and 12 deletions

View File

@ -125,7 +125,14 @@ more secure.
but untrustworthy users and the network cables are in secure areas this does
help, but for normal desktop clients this does not apply.)
.It Fl R
Set the retry count for doing the mount to the specified value.
Set the mount retry count to the specified value.
A retry count of zero means to keep retrying forever.
By default,
.Nm
retries forever on background mounts (see the
.Fl b
option), and otherwise tries just once.
There is a 60 second delay between each attempt.
.It Fl T
Use TCP transport instead of UDP.
This is recommended for servers that are not on the same LAN cable as

View File

@ -178,10 +178,9 @@ struct nfhret {
long fhsize;
u_char nfh[NFSX_V3FHMAX];
};
#define DEF_RETRY 10000
#define BGRND 1
#define ISBGRND 2
int retrycnt = DEF_RETRY;
int retrycnt = -1;
int opflags = 0;
int nfsproto = IPPROTO_UDP;
int mnttcp_ok = 1;
@ -289,7 +288,6 @@ main(argc, argv)
((char *)ktick.kt.dat) - ((char *)&ktick) != 2 * NFSX_UNSIGNED)
fprintf(stderr, "Yikes! NFSKERB structs not packed!!\n");
#endif /* NFSKERB */
retrycnt = DEF_RETRY;
mntflags = 0;
altflags = 0;
@ -430,7 +428,7 @@ main(argc, argv)
break;
case 'R':
num = strtol(optarg, &p, 10);
if (*p || num <= 0)
if (*p || num < 0)
errx(1, "illegal -R value -- %s", optarg);
retrycnt = num;
break;
@ -487,6 +485,8 @@ main(argc, argv)
spec = *argv++;
name = *argv;
if (retrycnt == -1)
retrycnt = (opflags & BGRND) ? 0 : 1;
if (!getnfsargs(spec, nfsargsp))
exit(1);
@ -694,7 +694,7 @@ getnfsargs(spec, nfsargsp)
#endif /* NFSKERB */
ret = TRYRET_LOCALERR;
while (retrycnt > 0) {
for (;;) {
/*
* Try each entry returned by getaddrinfo(). Note the
* occurence of remote errors by setting `remoteerr'.
@ -712,14 +712,15 @@ getnfsargs(spec, nfsargsp)
if (ret == TRYRET_SUCCESS)
break;
/*
* Exit on failures if not BGRND mode, or if all errors
* were local.
*/
if ((opflags & BGRND) == 0 || !remoteerr)
/* Exit if all errors were local. */
if (!remoteerr)
exit(1);
if (--retrycnt <= 0)
/*
* If retrycnt == 0, we are to keep retrying forever.
* Otherwise decrement it, and exit if it hits zero.
*/
if (retrycnt != 0 && --retrycnt == 0)
exit(1);
if ((opflags & (BGRND | ISBGRND)) == BGRND) {