diff options
author | Peter Wemm <peter@FreeBSD.org> | 1998-05-30 16:33:58 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 1998-05-30 16:33:58 +0000 |
commit | 7c1c33a7dd16e123fb836b48b7318eca0026d75e (patch) | |
tree | 4f808c23626fbcbe2da4ab45af795e14b7e43829 /sys/nfsclient/nfs_vfsops.c | |
parent | 6edfc50c8e9d5097a2f5e82cc8a6d7b1de5f9bd3 (diff) | |
download | src-7c1c33a7dd16e123fb836b48b7318eca0026d75e.tar.gz src-7c1c33a7dd16e123fb836b48b7318eca0026d75e.zip |
When using NFSv3, use the remote server's idea of the maximum file size
rather than assuming 2^64. It may not like files that big. :-)
On the nfs server, calculate and report the max file size as the point
that the block numbers in the cache would turn negative.
(ie: 1099511627775 bytes (1TB)).
One of the things I'm worried about however, is that directory offsets
are really cookies on a NFSv3 server and can be rather large, especially
when/if the server generates the opaque directory cookies by using a local
filesystem offset in what comes out as the upper 32 bits of the 64 bit
cookie. (a server is free to do this, it could save byte swapping
depending on the native 64 bit byte order)
Obtained from: NetBSD
Notes
Notes:
svn path=/head/; revision=36473
Diffstat (limited to 'sys/nfsclient/nfs_vfsops.c')
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 729ccbac00b3..554b0ef9a9ba 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95 - * $Id: nfs_vfsops.c,v 1.62 1998/05/20 08:05:45 peter Exp $ + * $Id: nfs_vfsops.c,v 1.63 1998/05/24 14:41:56 peter Exp $ */ #include <sys/param.h> @@ -333,6 +333,7 @@ nfs_fsinfo(nmp, vp, cred, p) caddr_t bpos, dpos, cp2; int error = 0, retattr; struct mbuf *mreq, *mrep, *md, *mb, *mb2; + u_int64_t maxfsize; nfsstats.rpccnt[NFSPROC_FSINFO]++; nfsm_reqhead(vp, NFSPROC_FSINFO, NFSX_FH(1)); @@ -367,6 +368,11 @@ nfs_fsinfo(nmp, vp, cred, p) if (max < nmp->nm_readdirsize) { nmp->nm_readdirsize = max; } + /* XXX */ + nmp->nm_maxfilesize = (u_int64_t)0x80000000 * DEV_BSIZE - 1; + fxdr_hyper(&fsp->fs_maxfilesize, &maxfsize); + if (maxfsize > 0 && maxfsize < nmp->nm_maxfilesize) + nmp->nm_maxfilesize = maxfsize; nmp->nm_state |= NFSSTA_GOTFSINFO; } nfsm_reqdone; @@ -690,6 +696,13 @@ mountnfs(argp, mp, nam, pth, hst, vpp) * unsuspecting binaries). */ mp->mnt_maxsymlinklen = 1; + if ((argp->flags & NFSMNT_NFSV3) == 0) + /* + * V2 can only handle 32 bit filesizes. For v3, nfs_fsinfo + * will fill this in. + */ + nmp->nm_maxfilesize = 0xffffffffLL; + nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; nmp->nm_wsize = NFS_WSIZE; |