diff options
author | peter <peter@FreeBSD.org> | 1998-06-01 10:01:31 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-06-01 10:01:31 +0000 |
commit | aca365c43ea635f7c64e0fddd6234658ee37755f (patch) | |
tree | f7cc96146b5de248a1c0621d89af4b72ec6200f4 /sys/nfs | |
parent | daec9421536dea043301b78b1811faf425e5595c (diff) | |
download | FreeBSD-src-aca365c43ea635f7c64e0fddd6234658ee37755f.zip FreeBSD-src-aca365c43ea635f7c64e0fddd6234658ee37755f.tar.gz |
Preset the maximum file size before we get to nfs_fsinfo(), based on
an (over?) conservative assumption about what the client can store in it's
buffer cache using a signed 32-bit 512-byte block number index. Otherwise
it's possible for some file access when maxfilesize = 0 (eg: /usr is nfs
mounted and doing an execve())
Pointed out by: bde
XXX It might make sense to do a preemptive nfs_fsinfo() call at mount time.
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 801a45c..74c3ee7 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95 - * $Id: nfs_vfsops.c,v 1.68 1998/05/31 19:49:31 peter Exp $ + * $Id: nfs_vfsops.c,v 1.69 1998/05/31 20:08:56 peter Exp $ */ #include <sys/param.h> @@ -371,8 +371,6 @@ 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; @@ -851,12 +849,20 @@ mountnfs(argp, mp, nam, pth, hst, vpp) */ 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. - */ + /* + * V2 can only handle 32 bit filesizes. A 4GB-1 limit may be too + * high, depending on whether we end up with negative offsets in + * the client or server somewhere. 2GB-1 may be safer. + * + * For V3, nfs_fsinfo will adjust this as necessary. Assume maximum + * that we can handle until we find out otherwise. + * XXX Our "safe" limit on the client is what we can store in our + * buffer cache using signed(!) block numbers. + */ + if ((argp->flags & NFSMNT_NFSV3) == 0) { nmp->nm_maxfilesize = 0xffffffffLL; + else + nmp->nm_maxfilesize = (u_int64_t)0x80000000 * DEV_BSIZE - 1; nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; |