Subject: NFS fixes from Gene Stark
To: None <dsndata!sun-lamp.cs.berkeley.edu!current-users>
From: Randy Terbush <sierra!randy@hoss.unl.edu>
List: current-users
Date: 11/28/1993 12:43:00
Are these getting to the NetBSD-current developers?  If so, I won't do
this again....

   From: newsserv!stark!gene@cs.sunysb.edu (Gene Stark)
   Newsgroups: comp.os.386bsd.bugs
   Date: 27 Nov 93 17:56:14
   Organization: Gene Stark's home system
   Distribution: world
   NNTP-Posting-Host: stark.uucp

   I sent the following bug report to "FreeBSD-bugfiler@freefall.cdrom.com",
   but am posting it here in case anyone wants it fast.

                                                           - Gene Stark

   ------------------------------------------------------
   Subject: strip -x 386bsd hangs over NFS
   Index: sys/nfs/nfs_bio.c FreeBSD-1.0.2

   Description:
           Running "strip -x 386bsd" (the last step in building a kernel)
           over NFS hangs in uninterruptible sleep.

   Repeat-By:
           Copy an unstripped kernel to an NFS-mounted directory and
           run "strip -x" on it.

   Fix:
           Apply the patch below to /sys/nfs/nfs_bio.c.  The problem is
           that vnode_pager_io sets up a uio structure with a null
           process pointer, and then nfs_write uses that pointer to
           check whether the file size resource limit is exceeded.
           If so, nfs_write returns EFBIG, which is ultimately voided
           by the call to vm_pager_put in vm_object_page_clean.
           The process thus hangs forever waiting for pageout to complete.
           The code for nfs_write was evidently cribbed from ufs_write
           in ufs_vnops.c.  The check for vp->v_type == VREG is actually
           already done earlier in nfs_write, but why not be a little
           defensive?  The problem evidently does not exist in isofs
           (no writing), or pcfs (done correctly).

   *** /sys/nfs/nfs_bio.c	Wed Oct  6 07:06:20 1993
   --- nfs_bio.c	Wed Nov 24 20:00:56 1993
   ***************
   *** 244,250 ****
            * Maybe this should be above the vnode op call, but so long as
            * file servers have no limits, i don't think it matters
            */
   ! 	if (uio->uio_offset + uio->uio_resid >
                 p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
                   psignal(p, SIGXFSZ);
                   return (EFBIG);
   --- 244,251 ----
            * Maybe this should be above the vnode op call, but so long as
            * file servers have no limits, i don't think it matters
            */
   ! 	if (vp->v_type == VREG && p &&
   ! 	    uio->uio_offset + uio->uio_resid >
                 p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
                   psignal(p, SIGXFSZ);
                   return (EFBIG);


   --

------------------------------------------------------------------------------