From owner-freebsd-current Tue Jan 4 10:38:48 2000 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 89A4314F35 for ; Tue, 4 Jan 2000 10:38:45 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id KAA37128; Tue, 4 Jan 2000 10:38:45 -0800 (PST) (envelope-from dillon) Date: Tue, 4 Jan 2000 10:38:45 -0800 (PST) From: Matthew Dillon Message-Id: <200001041838.KAA37128@apollo.backplane.com> To: freebsd-current@FreeBSD.ORG Subject: Re: NFS Race References: <20000104123804.23965@ns.int.ftf.net> <200001041655.IAA23681@apollo.backplane.com> <20000104120247.A49618@snickers.org> <387233BE.9733079A@dead-end.net> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :Me too ;) : :I got almost 300 of these messages during a "make release" with the :chroot dir NFS mounted. Otherwise I had no problems with such over :NFS created files though. : :Daniel I think I've tracked it down. When the client close()'s an NFS filehandle it calls nfs_flush() without specifying that a commit should be done, then clears the NMODIFIED bit in np->n_flags. It is not legal to clear NMODIFIED if no commit is done. Clearing NMODIFIED prematurely causes NFS to believe that there are no dirty buffers to destroy when a new file is created with O_TRUNC or ftruncate(). This will not lead to any problems if all you are doing is appending, it will lead to problems if you seek/write around after truncating the file. I think the correct solution is simply to not clear NMODIFIED on the last close. Please try this patch to -current -Matt Matthew Dillon Index: nfs_vnops.c =================================================================== RCS file: /FreeBSD/FreeBSD-CVS/src/sys/nfs/nfs_vnops.c,v retrieving revision 1.149 diff -u -r1.149 nfs_vnops.c --- nfs_vnops.c 1999/12/15 23:02:19 1.149 +++ nfs_vnops.c 2000/01/04 18:26:50 @@ -561,10 +561,15 @@ if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) == 0 && (np->n_flag & NMODIFIED)) { if (NFS_ISV3(vp)) { + /* + * Note: Since we haven't committed the buffers we cannot + * clear the NMODIFIED np->n_flag + */ error = nfs_flush(vp, ap->a_cred, MNT_WAIT, ap->a_p, 0); - np->n_flag &= ~NMODIFIED; - } else + /* np->n_flag &= ~NMODIFIED; */ + } else { error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1); + } np->n_attrstamp = 0; } if (np->n_flag & NWRITEERR) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message