diff --git a/fs/pipe.c b/fs/pipe.c index ea77cf5b519f..0c864618054d 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -445,20 +445,20 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) #endif /* - * Epoll nonsensically wants a wakeup whether the pipe - * was already empty or not. + * Only wake up if the pipe started out empty, since + * otherwise there should be no readers waiting. * * If it wasn't empty we try to merge new data into * the last buffer. * * That naturally merges small writes, but it also - * page-aligns the rest of the writes for large writes + * page-aligs the rest of the writes for large writes * spanning multiple pages. */ head = pipe->head; - was_empty = true; + was_empty = pipe_empty(head, pipe->tail); chars = total_len & (PAGE_SIZE-1); - if (chars && !pipe_empty(head, pipe->tail)) { + if (chars && !was_empty) { unsigned int mask = pipe->ring_size - 1; struct pipe_buffer *buf = &pipe->bufs[(head - 1) & mask]; int offset = buf->offset + buf->len;