From owner-freebsd-hackers Fri Oct 20 9:18:16 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 35D0237B4D7 for ; Fri, 20 Oct 2000 09:18:12 -0700 (PDT) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 20 Oct 2000 17:18:11 +0100 (BST) Date: Fri, 20 Oct 2000 17:18:10 +0100 From: David Malone To: Vadim Belman Cc: freebsd-hackers@freebsd.org Subject: Re: NFS/VM deadlock report and help request Message-ID: <20001020171810.A28345@walton.maths.tcd.ie> References: <20001020145043.B73760@lflat.vas.mobilix.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001020145043.B73760@lflat.vas.mobilix.dk>; from voland@lflat.org on Fri, Oct 20, 2000 at 02:50:43PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Oct 20, 2000 at 02:50:43PM +0200, Vadim Belman wrote: > The kernel config I supply as an attachment. Kernel-mode stack > trace for the thttpd process looks like this: I think we've seen a similar problem and have a work around for it. You could try the following patch, though it might take more fiddling to get it right. (The patch is by Ian Dowse, Matt Dillon had a quick look at it and said it looked OK, we've been testing it for a bit here). David. Index: nfs/nfs.h =================================================================== RCS file: /FreeBSD/FreeBSD-CVS/src/sys/nfs/nfs.h,v retrieving revision 1.53 diff -u -r1.53 nfs.h --- nfs/nfs.h 2000/01/13 20:18:25 1.53 +++ nfs/nfs.h 2000/10/20 16:13:49 @@ -616,7 +616,7 @@ struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, - struct vattr *)); + struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, caddr_t *, struct vnode **, struct proc *, int, int)); Index: nfs/nfs_subs.c =================================================================== RCS file: /FreeBSD/FreeBSD-CVS/src/sys/nfs/nfs_subs.c,v retrieving revision 1.90 diff -u -r1.90 nfs_subs.c --- nfs/nfs_subs.c 2000/02/13 03:32:06 1.90 +++ nfs/nfs_subs.c 2000/10/20 16:13:49 @@ -1203,11 +1203,12 @@ * copy the attributes to *vaper */ int -nfs_loadattrcache(vpp, mdp, dposp, vaper) +nfs_loadattrcache(vpp, mdp, dposp, vaper, dontshrink) struct vnode **vpp; struct mbuf **mdp; caddr_t *dposp; struct vattr *vaper; + int dontshrink; { register struct vnode *vp = *vpp; register struct vattr *vap; @@ -1322,9 +1323,18 @@ vap->va_gen = fxdr_unsigned(u_int32_t,fp->fa2_ctime.nfsv2_usec); vap->va_filerev = 0; } + np->n_attrstamp = time_second; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { - if (np->n_flag & NMODIFIED) { + if (dontshrink && vap->va_size < np->n_size) { + /* + * We've been told not to shrink the file; + * zero np->n_attrstamp to indicate that + * the attributes are stale. + */ + vap->va_size = np->n_size; + np->n_attrstamp = 0; + } else if (np->n_flag & NMODIFIED) { if (vap->va_size < np->n_size) vap->va_size = np->n_size; else @@ -1337,7 +1347,6 @@ np->n_size = vap->va_size; } } - np->n_attrstamp = time_second; if (vaper != NULL) { bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); if (np->n_flag & NCHG) { Index: nfs/nfsm_subs.h =================================================================== RCS file: /FreeBSD/FreeBSD-CVS/src/sys/nfs/nfsm_subs.h,v retrieving revision 1.27 diff -u -r1.27 nfsm_subs.h --- nfs/nfsm_subs.h 1999/08/28 00:50:02 1.27 +++ nfs/nfsm_subs.h 2000/10/20 16:13:49 @@ -212,7 +212,7 @@ #define nfsm_loadattr(v, a) \ do { \ struct vnode *ttvp = (v); \ - if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) != 0) { \ + if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a), 0)) != 0) { \ error = t1; \ m_freem(mrep); \ goto nfsmout; \ @@ -226,7 +226,7 @@ nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ if (((f) = fxdr_unsigned(int, *tl)) != 0) { \ if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ - (struct vattr *)0)) != 0) { \ + (struct vattr *)0, 1)) != 0) { \ error = t1; \ (f) = 0; \ m_freem(mrep); \ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message