From: Pavel Begunkov <[email protected]>
To: Ben Noordhuis <[email protected]>, [email protected]
Subject: Re: Chaining accept+read
Date: Wed, 28 Sep 2022 11:00:51 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHQurc-0iK9zawpc_k_-wSUVMp_+v14K+t-EJEDXL0pYkzD80A@mail.gmail.com>
On 9/28/22 10:50, Ben Noordhuis wrote:
> I'm trying to chain accept+read but it's not working.
>
> My code looks like this:
>
> *sqe1 = (struct io_uring_sqe){
> .opcode = IORING_OP_ACCEPT,
> .flags = IOSQE_IO_LINK,
> .fd = listenfd,
> .file_index = 42, // or 42+1
> };
> *sqe2 = (struct io_uring_sqe){
> .opcode = IORING_OP_READ,
> .flags = IOSQE_FIXED_FILE,
> .addr = (u64) buf,
> .len = len,
> .fd = 42,
> };
> submit();
>
> Both ops fail immediately; accept with -ECANCELED, read with -EBADF,
> presumably because fixed fd 42 doesn't exist at the time of submission.
>
> Would it be possible to support this pattern in io_uring or are there
> reasons for why things are the way they are?
It should already be supported. And errors look a bit odd, I'd rather
expect -EBADF or some other for accept and -ECANCELED for the read.
Do you have a test program / reporoducer? Hopefully in C.
--
Pavel Begunkov
next prev parent reply other threads:[~2022-09-28 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 9:50 Chaining accept+read Ben Noordhuis
2022-09-28 10:00 ` Pavel Begunkov [this message]
2022-09-28 10:55 ` Ben Noordhuis
2022-09-28 11:59 ` Pavel Begunkov
2022-09-28 13:49 ` 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] \
/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