]> git.hungrycats.org Git - linux/commitdiff
__generic_file_write_iter(): fix handling of sync error after DIO
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 8 Aug 2014 16:39:16 +0000 (12:39 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Sep 2014 16:22:15 +0000 (09:22 -0700)
commit 60bb45297f7551833346c5cebc6d483ea17ea5f2 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: Anton Altaparmakov <aia21@cam.ac.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/filemap.c

index 900edfaf6df5735a1979c866cd288c46c81e50ca..8163e0439493d8bafd67af86071d57fbd2624595 100644 (file)
@@ -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
                 * will return -EFOO even if some bytes were written.
                 */
-               if (unlikely(status < 0) && !written) {
+               if (unlikely(status < 0)) {
                        err = status;
                        goto out;
                }