--- x/fs/pipe.c +++ y/fs/pipe.c @@ -276,6 +276,7 @@ pipe_read(struct kiocb *iocb, struct iov unsigned int tail = pipe->tail; unsigned int mask = pipe->ring_size - 1; + wake_writer = pipe_full(head, tail, pipe->max_usage); #ifdef CONFIG_WATCH_QUEUE if (pipe->note_loss) { struct watch_notification n; @@ -339,7 +340,6 @@ pipe_read(struct kiocb *iocb, struct iov } if (!buf->len) { - wake_writer |= pipe_full(head, tail, pipe->max_usage); tail = pipe_update_tail(pipe, buf, tail); } total_len -= chars; @@ -377,8 +377,7 @@ pipe_read(struct kiocb *iocb, struct iov * _very_ unlikely case that the pipe was full, but we got * no data. */ - if (unlikely(wake_writer)) - wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM); + wake_up_interruptible_sync_poll(&pipe->wr_wait, EPOLLOUT | EPOLLWRNORM); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); /* @@ -390,7 +389,6 @@ pipe_read(struct kiocb *iocb, struct iov if (wait_event_interruptible_exclusive(pipe->rd_wait, pipe_readable(pipe)) < 0) return -ERESTARTSYS; - wake_writer = false; wake_next_reader = true; mutex_lock(&pipe->mutex); }