diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-11-26 20:05:42 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-11-26 20:05:42 -0500 |
commit | 8e54cadab447dae779f80f79c87cbeaea9594f60 (patch) | |
tree | f4b4b68d40369757544c9000349bbb0ec5de38e7 /fs | |
parent | 3ad0e83cf86bcaeb6ca3c37060a3ce866b25fb42 (diff) |
fix default_file_splice_read()
Botched calculation of number of pages. As the result,
we were dropping pieces when doing splice to pipe from
e.g. 9p.
Reported-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/splice.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/splice.c b/fs/splice.c index dcaf185a5731..5a7750bd2eea 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -408,7 +408,8 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos, | |||
408 | if (res <= 0) | 408 | if (res <= 0) |
409 | return -ENOMEM; | 409 | return -ENOMEM; |
410 | 410 | ||
411 | nr_pages = res / PAGE_SIZE; | 411 | BUG_ON(dummy); |
412 | nr_pages = DIV_ROUND_UP(res, PAGE_SIZE); | ||
412 | 413 | ||
413 | vec = __vec; | 414 | vec = __vec; |
414 | if (nr_pages > PIPE_DEF_BUFFERS) { | 415 | if (nr_pages > PIPE_DEF_BUFFERS) { |