Commit ca432005 authored by Andrea Arcangeli's avatar Andrea Arcangeli Committed by Linus Torvalds

[PATCH] Make the new merged pipe writes check for SIGPIPE

The new pipe buffer merging doesn't check for the "no readers" case, so
with small writes that coalesce, we may not get a timely SIGPIPE/EPIPE
notification to the writer.
Signed-off-by: default avatarAndrea Arcangeli <andrea@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a4f7f170
...@@ -235,6 +235,12 @@ pipe_writev(struct file *filp, const struct iovec *_iov, ...@@ -235,6 +235,12 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
down(PIPE_SEM(*inode)); down(PIPE_SEM(*inode));
info = inode->i_pipe; info = inode->i_pipe;
if (!PIPE_READERS(*inode)) {
send_sig(SIGPIPE, current, 0);
ret = -EPIPE;
goto out;
}
/* We try to merge small writes */ /* We try to merge small writes */
if (info->nrbufs && total_len < PAGE_SIZE) { if (info->nrbufs && total_len < PAGE_SIZE) {
int lastbuf = (info->curbuf + info->nrbufs - 1) & (PIPE_BUFFERS-1); int lastbuf = (info->curbuf + info->nrbufs - 1) & (PIPE_BUFFERS-1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment