Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/nfs nfsrv_commit(): Properly handle the case cnt == 0, w...



details:   https://anonhg.NetBSD.org/src/rev/99a406d1a984
branches:  trunk
changeset: 537097:99a406d1a984
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Sep 26 20:38:04 2002 +0000

description:
nfsrv_commit(): Properly handle the case cnt == 0, which means "flush to
end of file". Calling VOP_FSYNC with start == end triggers a DIAGNOSTIC
check. Noticed with NFSv3 Linux clients. OK'd by fvdl.

diffstat:

 sys/nfs/nfs_serv.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 1b45d0c2cfc2 -r 99a406d1a984 sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c        Thu Sep 26 20:37:42 2002 +0000
+++ b/sys/nfs/nfs_serv.c        Thu Sep 26 20:38:04 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_serv.c,v 1.62 2001/11/10 10:59:09 lukem Exp $      */
+/*     $NetBSD: nfs_serv.c,v 1.63 2002/09/26 20:38:04 bouyer Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.62 2001/11/10 10:59:09 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.63 2002/09/26 20:38:04 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -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);



Home | Main Index | Thread Index | Old Index