[10960] in Athena Bugs

home help back first fref pref prev next nref lref last post

compiling on Solaris over NFS

daemon@ATHENA.MIT.EDU (John Carr)
Sun Sep 12 18:47:29 1993

To: jawetzel@MIT.EDU
Cc: bugs@MIT.EDU, bug-sparc@MIT.EDU
Date: Sun, 12 Sep 1993 18:47:22 EDT
From: John Carr <jfc@MIT.EDU>


The Sun assembler implicitly depends on an implementation of the NFS
protocol that is slightly different than the one we use on RTs and VAXes.

The incompatibility: traditional ftruncate() will not make a file longer.
SVR4 and new NFS (SunOS 4 and newer) implement a fcntl call to make a file
longer.  But when this call is made to a VAX or RT server the size change
gets turned into a call to the kernel internal file truncate function, which
only makes files smaller.

This is the fix for the BSD NFS server, in case someone reading this wants
to build a fixed kernel.  I'm not sure if the bmap call is needed.

*** /source/bsd-4.3/common/sys/ufs/ufs_vnodeops.c	Wed Apr 15 11:07:51 1992
--- ufs_vnodeops.c	Sun Sep 12 17:46:51 1993
***************
*** 598,603 ****
--- 597,613 ----
  			goto out;
  		}
  		itrunc(ip, vap->va_size);
+ 		/* Newer versions of NFS require that setattr with a size
+ 		   larger than the current size extend the file.  */
+ 		if (vap->va_size > ip->i_size) {
+ 			ip->i_size = vap->va_size;
+ 			/* Force allocation of the new block.  */
+ #ifdef ibm032
+ 			bmap(ip, vap->va_size >> ip->i_fs->fs_bshift, B_READ, 0, 0);
+ #else
+ 			bmap(ip, vap->va_size / ip->i_fs->fs_bsize, B_READ, 0, 0);
+ #endif
+ 		}
  	}
  	/*
  	 * Change file access or modified times.

home help back first fref pref prev next nref lref last post