summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_vfsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/nfsclient/nfs_vfsops.c')
-rw-r--r--sys/nfsclient/nfs_vfsops.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index e43c048..5c257fc 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -117,7 +117,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp,
struct nfs_args *argp, const char *hostname);
static int mountnfs(struct nfs_args *, struct mount *,
struct sockaddr *, char *, struct vnode **,
- struct ucred *cred, int);
+ struct ucred *cred, int, int);
static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *,
struct sockaddr_storage *, int *, off_t *,
struct timeval *);
@@ -559,8 +559,8 @@ nfs_mountdiskless(char *path,
int error;
nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK);
- if ((error = mountnfs(args, mp, nam, path, vpp,
- td->td_ucred, NFS_DEFAULT_NEGNAMETIMEO)) != 0) {
+ if ((error = mountnfs(args, mp, nam, path, vpp, td->td_ucred,
+ NFS_DEFAULT_NAMETIMEO, NFS_DEFAULT_NEGNAMETIMEO)) != 0) {
printf("nfs_mountroot: mount %s on /: %d\n", path, error);
return (error);
}
@@ -788,6 +788,7 @@ static const char *nfs_opts[] = { "from", "nfs_args",
"wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin",
"acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3",
"sec", "maxgroups", "principal", "negnametimeo", "nocto", "wcommitsize",
+ "nametimeo",
NULL };
/*
@@ -836,6 +837,7 @@ nfs_mount(struct mount *mp)
size_t len;
u_char nfh[NFSX_V3FHMAX];
char *opt;
+ int nametimeo = NFS_DEFAULT_NAMETIMEO;
int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO;
has_nfs_args_opt = 0;
@@ -1058,6 +1060,14 @@ nfs_mount(struct mount *mp)
}
args.flags |= NFSMNT_MAXGRPS;
}
+ if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) {
+ ret = sscanf(opt, "%d", &nametimeo);
+ if (ret != 1 || nametimeo < 0) {
+ vfs_mount_error(mp, "illegal nametimeo: %s", opt);
+ error = EINVAL;
+ goto out;
+ }
+ }
if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL)
== 0) {
ret = sscanf(opt, "%d", &negnametimeo);
@@ -1182,7 +1192,7 @@ nfs_mount(struct mount *mp)
goto out;
}
error = mountnfs(&args, mp, nam, args.hostname, &vp,
- curthread->td_ucred, negnametimeo);
+ curthread->td_ucred, nametimeo, negnametimeo);
out:
if (!error) {
MNT_ILOCK(mp);
@@ -1224,7 +1234,8 @@ nfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
*/
static int
mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
- char *hst, struct vnode **vpp, struct ucred *cred, int negnametimeo)
+ char *hst, struct vnode **vpp, struct ucred *cred, int nametimeo,
+ int negnametimeo)
{
struct nfsmount *nmp;
struct nfsnode *np;
@@ -1274,6 +1285,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
nmp->nm_numgrps = NFS_MAXGRPS;
nmp->nm_readahead = NFS_DEFRAHEAD;
nmp->nm_deadthresh = NFS_MAXDEADTHRESH;
+ nmp->nm_nametimeo = nametimeo;
nmp->nm_negnametimeo = negnametimeo;
nmp->nm_tprintf_delay = nfs_tprintf_delay;
if (nmp->nm_tprintf_delay < 0)
OpenPOWER on IntegriCloud