diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2011-04-17 14:10:12 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2011-04-17 14:10:12 +0000 |
commit | 2599955582c659accd7a26bb402ceeb685910940 (patch) | |
tree | b9fdcc667e3171bd8f5a50182fac76f67f9ab7e0 | |
parent | 83df5db1b3cba766699cdc83cba686ad470e736b (diff) | |
download | FreeBSD-src-2599955582c659accd7a26bb402ceeb685910940.zip FreeBSD-src-2599955582c659accd7a26bb402ceeb685910940.tar.gz |
Change some defaults in the experimental NFS client to be the
same as the regular NFS client for NFSv3. The main one is making
use of a reserved port# the default. Also, set the retry limit
for TCP the same and fix the code so that it doesn't disable
readdirplus for NFSv4.
MFC after: 2 weeks
-rw-r--r-- | sys/fs/nfs/nfs.h | 1 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clvfsops.c | 24 |
2 files changed, 21 insertions, 4 deletions
diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 8cdeb8e..0bf0f74 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -56,6 +56,7 @@ #define NFSV4_UPCALLRETRY 4 /* Number of retries before failure */ #define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */ #define NFS_RETRANS 10 /* Num of retrans for soft mounts */ +#define NFS_RETRANS_TCP 2 /* Num of retrans for TCP soft mounts */ #define NFS_MAXGRPS 16 /* Max. size of groups list */ #define NFS_TRYLATERDEL 15 /* Maximum delay timeout (sec) */ #ifndef NFS_REMOVETIMEO diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index f9c5d9e..a37dd51 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include <sys/buf.h> #include <sys/clock.h> #include <sys/jail.h> +#include <sys/limits.h> #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mbuf.h> @@ -558,14 +559,29 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, if (argp->sotype == SOCK_STREAM) { nmp->nm_flag &= ~NFSMNT_NOCONN; nmp->nm_timeo = NFS_MAXTIMEO; + if ((argp->flags & NFSMNT_NFSV4) != 0) + nmp->nm_retry = INT_MAX; + else + nmp->nm_retry = NFS_RETRANS_TCP; } - /* Also clear RDIRPLUS if not NFSv3, it crashes some servers */ - if ((argp->flags & NFSMNT_NFSV3) == 0) + /* Also clear RDIRPLUS if NFSv2, it crashes some servers */ + if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0) { + argp->flags &= ~NFSMNT_RDIRPLUS; nmp->nm_flag &= ~NFSMNT_RDIRPLUS; + } + + /* Clear NFSMNT_RESVPORT for NFSv4, since it is not required. */ + if ((argp->flags & NFSMNT_NFSV4) != 0) { + argp->flags &= ~NFSMNT_RESVPORT; + nmp->nm_flag &= ~NFSMNT_RESVPORT; + } + /* Re-bind if rsrvd port requested and wasn't on one */ + adjsock = !(nmp->nm_flag & NFSMNT_RESVPORT) + && (argp->flags & NFSMNT_RESVPORT); /* Also re-bind if we're switching to/from a connected UDP socket */ - adjsock = ((nmp->nm_flag & NFSMNT_NOCONN) != + adjsock |= ((nmp->nm_flag & NFSMNT_NOCONN) != (argp->flags & NFSMNT_NOCONN)); /* Update flags atomically. Don't change the lock bits. */ @@ -710,7 +726,7 @@ nfs_mount(struct mount *mp) .proto = 0, .fh = NULL, .fhsize = 0, - .flags = 0, + .flags = NFSMNT_RESVPORT, .wsize = NFS_WSIZE, .rsize = NFS_RSIZE, .readdirsize = NFS_READDIRSIZE, |