fs/pipe.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/pipe.c b/fs/pipe.c index 0ac197658a2d..e60565bb8125 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -228,14 +228,13 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to) __pipe_lock(pipe); /* - * We only wake up writers if the pipe was full when we started - * reading in order to avoid unnecessary wakeups. + * Epoll wants us to wake things up whether it was full or not. * * But when we do wake up writers, we do so using a sync wakeup * (WF_SYNC), because we want them to get going and generate more * data for us. */ - was_full = pipe_full(pipe->head, pipe->tail, pipe->max_usage); + was_full = true; for (;;) { unsigned int head = pipe->head; unsigned int tail = pipe->tail; @@ -429,8 +428,8 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) #endif /* - * Only wake up if the pipe started out empty, since - * otherwise there should be no readers waiting. + * Epoll nonsensically wants a wakeup wheher the pipe was + * already empty or not. * * If it wasn't empty we try to merge new data into * the last buffer. @@ -440,9 +439,9 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) * spanning multiple pages. */ head = pipe->head; - was_empty = pipe_empty(head, pipe->tail); + was_empty = true; chars = total_len & (PAGE_SIZE-1); - if (chars && !was_empty) { + if (chars && !pipe_empty(head, pipe->tail)) { unsigned int mask = pipe->ring_size - 1; struct pipe_buffer *buf = &pipe->bufs[(head - 1) & mask]; int offset = buf->offset + buf->len;