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