From c4862c0787f1c02c94139756f9a9cabe19457ddb Mon Sep 17 00:00:00 2001 From: rmacklem Date: Sun, 8 Jan 2012 23:05:36 +0000 Subject: [PATCH 63/65] MFC: r228560 Patch the new NFS server in a manner analagous to r228520 for the old NFS server, so that it correctly handles a count == 0 argument for Commit. git-svn-id: http://svn.freebsd.org/base/stable/9@229827 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f (cherry picked from commit d12110574b5fda3060bd75cc38263ffb305102c3) Signed-off-by: Xin Li --- sys/fs/nfsserver/nfs_nfsdport.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index a9a10f4..f570b11 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -1254,7 +1254,13 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred, { int error = 0; - if (cnt > MAX_COMMIT_COUNT) { + /* + * RFC 1813 3.3.21: if count is 0, a flush from offset to the end of + * file is done. At this time VOP_FSYNC does not accept offset and + * byte count parameters so call VOP_FSYNC the whole file for now. + * The same is true for NFSv4: RFC 3530 Sec. 14.2.3. + */ + if (cnt == 0 || cnt > MAX_COMMIT_COUNT) { /* * Give up and do the whole thing */ -- 1.7.8.3