Commit 3fecf9a2 authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman

__generic_file_write_iter(): fix handling of sync error after DIO

commit 60bb4529 upstream.

If DIO results in short write and sync write fails, we want to bugger off
whether the DIO part has written anything or not; the logics on the return
will take care of the right return value.
Reported-by: default avatarAnton Altaparmakov <aia21@cam.ac.uk>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4156d121
...@@ -2584,7 +2584,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) ...@@ -2584,7 +2584,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
* that this differs from normal direct-io semantics, which * that this differs from normal direct-io semantics, which
* will return -EFOO even if some bytes were written. * will return -EFOO even if some bytes were written.
*/ */
if (unlikely(status < 0) && !written) { if (unlikely(status < 0)) {
err = status; err = status;
goto out; goto out;
} }
......
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