splice: remove detritus from generic_file_splice_read()
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 10 Nov 2016 23:32:13 +0000 (18:32 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 10 Nov 2016 23:32:13 +0000 (18:32 -0500)
i_size check is a leftover from the horrors that used to play with
the page cache in that function.  With the switch to ->read_iter(),
it's neither needed nor correct - for gfs2 it ends up being buggy,
since i_size is not guaranteed to be correct until later (inside
->read_iter()).

Spotted-by: Abhi Das <adas@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/splice.c

index 153d4f3bd441febd7004b1862cd218afc0ee6252..dcaf185a5731130ab67bd7076a9be26dd4f0d7f0 100644 (file)
@@ -299,13 +299,8 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
 {
        struct iov_iter to;
        struct kiocb kiocb;
-       loff_t isize;
        int idx, ret;
 
-       isize = i_size_read(in->f_mapping->host);
-       if (unlikely(*ppos >= isize))
-               return 0;
-
        iov_iter_pipe(&to, ITER_PIPE | READ, pipe, len);
        idx = to.idx;
        init_sync_kiocb(&kiocb, in);