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:37:42
--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Sep 26, 2002 at 08:06:36PM +0200, Manuel Bouyer wrote:
> 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 :)

Well, it doens't work (couldn't wait till tomorow :).
If should be (off, vp->v_size), not (off, vp->v_size - off).
This one does work.

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

--CE+1k2dSO48ffgeK
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, procp);
 	aft_ret = VOP_GETATTR(vp, &aft, cred, procp);
 	vput(vp);
 	nfsm_reply(NFSX_V3WCCDATA + NFSX_V3WRITEVERF);

--CE+1k2dSO48ffgeK--