Pipe reads or writes need to enable nonblocking attempts, if either O_NONBLOCK is set on the file, or IOCB_NOWAIT is set in the iocb being passed in. The latter isn't currently true, ensure we check for both before waiting on data or space. Fixes: afed6271f5b0 ("pipe: set FMODE_NOWAIT on pipes") Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- With the pipe nonblock rework, these two hunsk from one of the other patches was inadvertently dropped. We obviously need to check both, or files without O_NONBLOCK but IOCB_NOWAIT set in the iocb will still block on space/data when writing/reading to/from a pipe. I can just include this in the io_uring changes as it directly impacts io_uring (breaking a few test cases), or you guys can queue it up on the VFS side. Would be great to get this in -rc2 as it's stalling the regression testing with the vanilla kernels. diff --git a/fs/pipe.c b/fs/pipe.c index ceb17d2dfa19..c88611c612ba 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -342,7 +342,7 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to) break; if (ret) break; - if (filp->f_flags & O_NONBLOCK) { + if (filp->f_flags & O_NONBLOCK || iocb->ki_flags & IOCB_NOWAIT) { ret = -EAGAIN; break; } @@ -547,7 +547,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) continue; /* Wait for buffer space to become available. */ - if (filp->f_flags & O_NONBLOCK) { + if (filp->f_flags & O_NONBLOCK || iocb->ki_flags & IOCB_NOWAIT) { if (!ret) ret = -EAGAIN; break; -- Jens Axboe