From: Chuck Lever Date: Mon, 12 Nov 2007 17:16:58 +0000 (-0500) Subject: NFS: Ensure we return zero if applications attempt to write zero bytes X-Git-Tag: v2.6.24-rc4~92^2~1 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9148c6b80d802dbc2a7530b29915a80432e50c7;p=linux-2.6 NFS: Ensure we return zero if applications attempt to write zero bytes A zero byte count direct write request should be a successful no-op, not an error. Signed-off-by: Chuck Lever Signed-off-by: Chuck Lever Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 88d5d1c7f9..4d726e9db2 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -890,6 +890,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov, retval = generic_write_checks(file, &pos, &count, 0); if (retval) goto out; + if (!count) + goto out; /* return 0 */ retval = -EINVAL; if ((ssize_t) count < 0)