diff options
author | aalexandrovich <88376726+aalexandrovich@users.noreply.github.com> | 2021-08-23 16:44:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-23 16:44:22 +0300 |
commit | 11e4e66efd440216032f53ee7e5ca08cd263a292 (patch) | |
tree | 630237ec37435734f29cc4ea2c91a75813d61053 /fs/pipe.c | |
parent | 96b18047a7172037ff4206720f4e889670030b41 (diff) | |
parent | e22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93 (diff) |
Merge branch 'torvalds:master' into master
Diffstat (limited to 'fs/pipe.c')
-rw-r--r-- | fs/pipe.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/pipe.c b/fs/pipe.c index 8e6ef62aeb1c..678dee2a8228 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -444,9 +444,6 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) #endif /* - * Epoll nonsensically wants a wakeup whether the pipe - * was already empty or not. - * * If it wasn't empty we try to merge new data into * the last buffer. * @@ -455,9 +452,9 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) * 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; @@ -590,8 +587,11 @@ out: * This is particularly important for small writes, because of * how (for example) the GNU make jobserver uses small writes to * wake up pending jobs + * + * Epoll nonsensically wants a wakeup whether the pipe + * was already empty or not. */ - if (was_empty) { + if (was_empty || pipe->poll_usage) { wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); } @@ -654,6 +654,9 @@ pipe_poll(struct file *filp, poll_table *wait) struct pipe_inode_info *pipe = filp->private_data; unsigned int head, tail; + /* Epoll has some historical nasty semantics, this enables them */ + pipe->poll_usage = 1; + /* * Reading pipe state only -- no need for acquiring the semaphore. * |