diff --git a/fs/iomap.c b/fs/iomap.c index caa45f73967cfc2ed64c3a6421877733bf658ca4..a9e40dafcc1ca4ffeb442792cb474a5b0975de36 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -1913,8 +1913,15 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, } pos += ret; - if (iov_iter_rw(iter) == READ && pos >= dio->i_size) + if (iov_iter_rw(iter) == READ && pos >= dio->i_size) { + /* + * We only report that we've read data up to i_size. + * Revert iter to a state corresponding to that as + * some callers (such as splice code) rely on it. + */ + iov_iter_revert(iter, pos - dio->i_size); break; + } } while ((count = iov_iter_count(iter)) > 0); blk_finish_plug(&plug);