Subject: Re: NFSv3 bug
To: Christos Zoulas <christos@zoulas.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 09/26/2002 20:06:36
--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Sep 26, 2002 at 08:02:13PM +0200, Manuel Bouyer wrote:
> On Thu, Sep 26, 2002 at 07:56:09PM +0200, Manuel Bouyer wrote:
> > Seeing Rick's message I checked XNFS specs. for commit, count == 0 means
> > to end of file.
> > 
> 
> OK, we could just flush the whole file in this case. VOP_FSYNC() with
> offset & count to 0 mean flush the whole file.

Hum, we have the size of the file in struct vnode, so if it's up to date
at this point, we could use that (off, vp->v_size - off). But I didn't
try this one. I'll do tomorow, unless someone can tell me it won't
work just by reading the code :)

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--

--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="diff.nfs1bis"

Index: nfs_serv.c
===================================================================
RCS file: /cvsroot/syssrc/sys/nfs/nfs_serv.c,v
retrieving revision 1.62
diff -u -r1.62 nfs_serv.c
--- nfs_serv.c	2001/11/10 10:59:09	1.62
+++ nfs_serv.c	2002/09/26 18:00:17
@@ -3010,7 +3010,10 @@
 		return (0);
 	}
 	for_ret = VOP_GETATTR(vp, &bfor, cred, procp);
-	error = VOP_FSYNC(vp, cred, FSYNC_WAIT, off, off + cnt, procp);
+	if (cnt > 0)
+		error = VOP_FSYNC(vp, cred, FSYNC_WAIT, off, off + cnt, procp);
+	else
+		error = VOP_FSYNC(vp, cred, FSYNC_WAIT, off, vp->v_size - off, procp);
 	aft_ret = VOP_GETATTR(vp, &aft, cred, procp);
 	vput(vp);
 	nfsm_reply(NFSX_V3WCCDATA + NFSX_V3WRITEVERF);

--U+BazGySraz5kW0T--