From: Jens Axboe <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], Jens Axboe <[email protected]>
Subject: [PATCH 1/2] pipe: honor iocb IOCB_NOWAIT flag as well
Date: Tue, 7 Mar 2023 08:45:32 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
It's not enough to just check the file O_NONBLOCK flag, we should also
check if the iocb being passed in has been flagged as non-blocking as
well.
Signed-off-by: Jens Axboe <[email protected]>
---
fs/pipe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/pipe.c b/fs/pipe.c
index 42c7ff41c2db..58fee8816564 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;
--
2.39.2
next prev parent reply other threads:[~2023-03-07 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 15:45 [PATCHSET for-next 0/2] Make pipe honor IOCB_NOWAIT Jens Axboe
2023-03-07 15:45 ` Jens Axboe [this message]
2023-03-07 15:45 ` [PATCH 2/2] io_uring: assume read_iter/write_iter are safe for nonblocking Jens Axboe
2023-03-08 0:19 ` [PATCHSET for-next 0/2] Make pipe honor IOCB_NOWAIT Dave Chinner
2023-03-08 0:31 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox