All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>,
	io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH v2] io_uring/net: ensure async prep handlers always initialize ->done_io
Date: Fri, 15 Mar 2024 17:13:33 -0600	[thread overview]
Message-ID: <c6753d20-d5b1-4bba-ba83-5db5bd24a766@kernel.dk> (raw)
In-Reply-To: <0ec91000-43f8-477e-9b61-f0a2f531e7d5@gmail.com>

On 3/15/24 5:09 PM, Pavel Begunkov wrote:
> On 3/15/24 22:48, Jens Axboe wrote:
>> If we get a request with IOSQE_ASYNC set, then we first run the prep
>> async handlers. But if we then fail setting it up and want to post
>> a CQE with -EINVAL, we use ->done_io. This was previously guarded with
>> REQ_F_PARTIAL_IO, and the normal setup handlers do set it up before any
>> potential errors, but we need to cover the async setup too.
> 
> You can hit io_req_defer_failed() { opdef->fail(); }
> off of an early submission failure path where def->prep has
> not yet been called, I don't think the patch will fix the
> problem.
> 
> ->fail() handlers are fragile, maybe we should skip them
> if def->prep() wasn't called. Not even compile tested:

Yeah they are a mess honestly. Maybe we're better off just flagging it
like in your below patch, and avoid needing opcode handling for this.
Was going to suggest having a PREP_DONE flag, but it's better to have a
FAIL_EARLY and avoid needing to fiddle with it in the normal path.

-- 
Jens Axboe


      parent reply	other threads:[~2024-03-15 23:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 22:48 [PATCH v2] io_uring/net: ensure async prep handlers always initialize ->done_io Jens Axboe
2024-03-15 23:09 ` Pavel Begunkov
2024-03-15 23:13   ` Pavel Begunkov
2024-03-15 23:19     ` Pavel Begunkov
2024-03-15 23:25       ` Jens Axboe
2024-03-15 23:28         ` Pavel Begunkov
2024-03-15 23:53           ` Jens Axboe
2024-03-16 16:14           ` Jens Axboe
2024-03-16 16:28             ` Pavel Begunkov
2024-03-16 16:31               ` Jens Axboe
2024-03-16 16:32                 ` Pavel Begunkov
2024-03-16 16:34                   ` Pavel Begunkov
2024-03-16 16:36                   ` Jens Axboe
2024-03-16 16:36                     ` Pavel Begunkov
2024-03-16 16:40                       ` Pavel Begunkov
2024-03-16 16:42                       ` Jens Axboe
2024-03-16 16:46                         ` Pavel Begunkov
2024-03-16 16:51                           ` Jens Axboe
2024-03-16 16:57                             ` Pavel Begunkov
2024-03-16 17:01                               ` Jens Axboe
2024-03-16 17:42                                 ` Pavel Begunkov
2024-03-16 23:58                                   ` Jens Axboe
2024-03-17 20:45                                     ` Pavel Begunkov
2024-03-15 23:13   ` Jens Axboe [this message]

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 \
    --in-reply-to=c6753d20-d5b1-4bba-ba83-5db5bd24a766@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.