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.
This commit is contained in:
bouyer 2002-09-26 20:38:04 +00:00
parent e40e3c96cf
commit 7005ca7253
1 changed files with 6 additions and 3 deletions

View File

@ -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 @@ nfsrv_commit(nfsd, slp, procp, mrq)
return (0);
}
for_ret = VOP_GETATTR(vp, &bfor, cred, 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);