Commit b9148c6b authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

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: default avatarChuck Lever <cel@netapp.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c216fd70
...@@ -890,6 +890,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -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); retval = generic_write_checks(file, &pos, &count, 0);
if (retval) if (retval)
goto out; goto out;
if (!count)
goto out; /* return 0 */
retval = -EINVAL; retval = -EINVAL;
if ((ssize_t) count < 0) if ((ssize_t) count < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment