Skip to content

Commit b9148c6

Browse files
chuckleverTrond Myklebust
authored andcommitted
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 <cel@netapp.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent c216fd7 commit b9148c6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/nfs/direct.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
890890
retval = generic_write_checks(file, &pos, &count, 0);
891891
if (retval)
892892
goto out;
893+
if (!count)
894+
goto out; /* return 0 */
893895

894896
retval = -EINVAL;
895897
if ((ssize_t) count < 0)

0 commit comments

Comments
 (0)