mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
splice: reinstate SIGPIPE/EPIPE handling
commit52bce91165
upstream. Commit8924feff66
("splice: lift pipe_lock out of splice_to_pipe()") caused a regression when there were no more readers left on a pipe that was being spliced into: rather than the expected SIGPIPE and -EPIPE return value, the writer would end up waiting forever for space to free up (which obviously was not going to happen with no readers around). Fixes:8924feff66
("splice: lift pipe_lock out of splice_to_pipe()") Reported-and-tested-by: Andreas Schwab <schwab@linux-m68k.org> Debugged-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c1df5a6371
commit
b6cce9b8e8
1 changed files with 7 additions and 2 deletions
|
@ -1086,7 +1086,13 @@ EXPORT_SYMBOL(do_splice_direct);
|
|||
|
||||
static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags)
|
||||
{
|
||||
while (pipe->nrbufs == pipe->buffers) {
|
||||
for (;;) {
|
||||
if (unlikely(!pipe->readers)) {
|
||||
send_sig(SIGPIPE, current, 0);
|
||||
return -EPIPE;
|
||||
}
|
||||
if (pipe->nrbufs != pipe->buffers)
|
||||
return 0;
|
||||
if (flags & SPLICE_F_NONBLOCK)
|
||||
return -EAGAIN;
|
||||
if (signal_pending(current))
|
||||
|
@ -1095,7 +1101,6 @@ static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags)
|
|||
pipe_wait(pipe);
|
||||
pipe->waiting_writers--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,
|
||||
|
|
Loading…
Reference in a new issue