From f33775afcf70a3e5ed5de353bec383ef9f7840e1 Mon Sep 17 00:00:00 2001 From: John Dyson Date: Mon, 1 May 1995 23:20:24 +0000 Subject: [PATCH] Limit filesize to the amount that the VM system can currently handle (2GB). If this limit is not imposed, then filesystem corruption will ensue when files larger than 2GB are created. This is temporary, and the underlying limitation will be removed later. --- sys/ufs/ffs/ffs_vfsops.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index b1a20d6fe43c..d13af91ffba6 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 - * $Id: ffs_vfsops.c,v 1.16 1995/04/09 06:03:37 davidg Exp $ + * $Id: ffs_vfsops.c,v 1.17 1995/04/11 04:23:47 davidg Exp $ */ #include @@ -67,6 +67,7 @@ int ffs_sbupdate __P((struct ufsmount *, int)); int ffs_reload __P((struct mount *,struct ucred *,struct proc *)); int ffs_oldfscompat __P((struct fs *)); +void ffs_vmlimits __P((struct fs *)); struct vfsops ufs_vfsops = { ffs_mount, @@ -296,6 +297,7 @@ ffs_reload(mountp, cred, p) bp->b_flags |= B_INVAL; brelse(bp); ffs_oldfscompat(fs); + ffs_vmlimits(fs); /* * Step 3: re-read summary information from disk. */ @@ -458,6 +460,7 @@ ffs_mountfs(devvp, mp, p) ump->um_quotas[i] = NULLVP; devvp->v_specflags |= SI_MOUNTEDON; ffs_oldfscompat(fs); + ffs_vmlimits(fs); if (ronly == 0) ffs_sbupdate(ump, MNT_WAIT); return (0); @@ -505,6 +508,18 @@ ffs_oldfscompat(fs) return (0); } +/* + * Sanity check for VM file size limits -- temporary until + * VM system can support > 32bit offsets + */ +void +ffs_vmlimits(fs) + struct fs *fs; +{ + if( fs->fs_maxfilesize > (((u_quad_t) 1 << 31) - 1)) + fs->fs_maxfilesize = ((u_quad_t) 1 << 31) - 1; +} + /* * unmount system call */