From: Linus Torvalds Date: Mon, 10 Oct 2016 20:38:49 +0000 (-0700) Subject: Merge branch 'work.splice_read' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fed41f7d039bad02f94cad9059e4b14cd81d13f2;p=linux-beck.git Merge branch 'work.splice_read' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull splice fixups from Al Viro: "A couple of fixups for interaction of pipe-backed iov_iter with O_DIRECT reads + constification of a couple of primitives in uio.h missed by previous rounds. Kudos to davej - his fuzzing has caught those bugs" * 'work.splice_read' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: [btrfs] fix check_direct_IO() for non-iovec iterators constify iov_iter_count() and iter_is_iovec() fix ITER_PIPE interaction with direct_IO --- fed41f7d039bad02f94cad9059e4b14cd81d13f2 diff --cc mm/filemap.c index 2f7b7783bd6b,6b965efe215e..849f459ad078 --- a/mm/filemap.c +++ b/mm/filemap.c @@@ -1935,13 -1915,12 +1935,13 @@@ generic_file_read_iter(struct kiocb *io size = i_size_read(inode); retval = filemap_write_and_wait_range(mapping, iocb->ki_pos, iocb->ki_pos + count - 1); - if (!retval) { - struct iov_iter data = *iter; - retval = mapping->a_ops->direct_IO(iocb, &data); - } + if (retval < 0) + goto out; + file_accessed(file); + + retval = mapping->a_ops->direct_IO(iocb, &data); - if (retval > 0) { + if (retval >= 0) { iocb->ki_pos += retval; iov_iter_advance(iter, retval); }