summaryrefslogtreecommitdiffstats
path: root/sys/nfs/nfs_serv.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-05-30 16:33:58 +0000
committerpeter <peter@FreeBSD.org>1998-05-30 16:33:58 +0000
commitaa33f209931229b1ec794891bd3a69a8eff05835 (patch)
tree5c600b7c603c70dd7c1f21b9426387f4c7902f04 /sys/nfs/nfs_serv.c
parent0d948cca0487b241fec6cc5211d55dc5ffabb72c (diff)
downloadFreeBSD-src-aa33f209931229b1ec794891bd3a69a8eff05835.zip
FreeBSD-src-aa33f209931229b1ec794891bd3a69a8eff05835.tar.gz
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
Diffstat (limited to 'sys/nfs/nfs_serv.c')
-rw-r--r--sys/nfs/nfs_serv.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index bfae28d..4b08bc6 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
- * $Id: nfs_serv.c,v 1.60 1998/05/07 04:58:51 msmith Exp $
+ * $Id: nfs_serv.c,v 1.61 1998/05/20 09:05:48 peter Exp $
*/
/*
@@ -3256,19 +3256,26 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq)
struct vattr at;
nfsfh_t nfh;
fhandle_t *fhp;
- u_quad_t frev;
+ u_quad_t frev, maxfsize;
+ struct statfs sb;
#ifndef nolint
cache = 0;
#endif
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
- if (error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
- &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE)) {
+ error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
+ &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
+ if (error) {
nfsm_reply(NFSX_UNSIGNED);
nfsm_srvpostop_attr(getret, &at);
return (0);
}
+
+ /* XXX Try to make a guess on the max file size. */
+ VFS_STATFS(vp->v_mount, &sb, procp);
+ maxfsize = (u_quad_t)0x80000000 * sb.f_bsize - 1;
+
getret = VOP_GETATTR(vp, &at, cred, procp);
vput(vp);
nfsm_reply(NFSX_V3POSTOPATTR + NFSX_V3FSINFO);
@@ -3291,8 +3298,7 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq)
sip->fs_wtpref = txdr_unsigned(pref);
sip->fs_wtmult = txdr_unsigned(NFS_FABLKSIZE);
sip->fs_dtpref = txdr_unsigned(pref);
- sip->fs_maxfilesize.nfsuquad[0] = 0xffffffff;
- sip->fs_maxfilesize.nfsuquad[1] = 0xffffffff;
+ txdr_hyper(&maxfsize, &sip->fs_maxfilesize);
sip->fs_timedelta.nfsv3_sec = 0;
sip->fs_timedelta.nfsv3_nsec = txdr_unsigned(1);
sip->fs_properties = txdr_unsigned(NFSV3FSINFO_LINK |
OpenPOWER on IntegriCloud