Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1663399 > unrolled thread
| Started by | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| First post | 2017-06-12 12:20 +0200 |
| Last post | 2017-06-12 12:20 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH] sendfile: Do not update file offset of non-lseek()able objects. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-12 12:20 +0200
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
|---|---|
| Date | 2017-06-12 12:20 +0200 |
| Subject | [PATCH] sendfile: Do not update file offset of non-lseek()able objects. |
| Message-ID | <tRuBY-R6-9@gated-at.bofh.it> |
I tried to sendfile() a file which is larger than 4GB to a pipe (which is the stdout of Apache's CGI program), and noticed that sendfile() fails with EFBIG after 2GB is copied to stdout pipe. This is because sendfile() is updating file offset of the file descriptor of the pipe. sendfile() should not update file offset if the file descriptor refers to an non-lseek()able object. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> --- fs/read_write.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/read_write.c b/fs/read_write.c index 47c1d44..17ea13c 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1459,7 +1459,8 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, add_wchar(current, retval); fsnotify_access(in.file); fsnotify_modify(out.file); - out.file->f_pos = out_pos; + if (out.file->f_op->llseek != no_llseek) + out.file->f_pos = out_pos; if (ppos) *ppos = pos; else -- 1.8.3.1
Back to top | Article view | linux.kernel
csiph-web