On 11/20/2019 5:03 PM, Bob Liu wrote: > I see, thanks. > As for me, it may better return -EINVAL in advance so as to skip a lot unnecessary code for those reqs. > Hah, I removed similar check just yesterday (see [PATCH 3/4] "io_uring: remove redundant check"). We don't care about performance of invalid requests, and this one in hot-path. The fewer edge cases, the better. Also, for the example below, I'd want to fail INVALID_REQ and cancel valid ones, but not exit after processing invalid, or even worse processing the rest without it. INVALID_REQ -> VALID_REQ -> VALID_REQ. > @@ -3176,6 +3176,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, > > if (!io_get_sqring(ctx, &req->submit)) { > } > ... > + if (unlikely(req_is_invalid(req))) > + return -EINVAL; > -- Pavel Begunkov