Skip to content

Commit

Permalink
NFS: Ensure we return zero if applications attempt to write zero bytes
Browse files Browse the repository at this point in the history
A zero byte count direct write request should be a successful no-op, not an
error.

Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Nov 26, 2007
1 parent c216fd7 commit b9148c6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b9148c6

Please sign in to comment.