On 5/8/24 9:05 PM, Ming Lei wrote: > On Wed, May 08, 2024 at 08:55:09PM -0600, Jens Axboe wrote: >> On 5/8/24 8:34 PM, Ming Lei wrote: >>> Add IORING_OP_NOP_FAIL so that it is easy to inject failure from >>> userspace. >>> >>> Like IORING_OP_NOP, the main use case is test, and it is very helpful >>> for covering failure handling code in io_uring core change. >> >> Rather than use a new opcode for this, why don't we just add it to >> the existing NOP? I know we don't check for flags in currently, so >> you would not know if it worked, but we could add that and just >> backport that one-liner as well. > > Yeah, it is just for avoiding to break existed tests which may not build > over liburing. Don't think that's a huge risk, if someone is using the raw interface and just not clearing, they would run into issues with mixed command usage anyway. And a pure nop test would be fine anyway, as everything starts out cleared. > I will switch to this way, looks one-line backporting can solve it. Exactly, thanks! >> And if we had such a flag, the fail res could be passed in as well. > > We can just pass the 'injected_fail_res' via sqe->len, meantime keep > 'nop_flags' for error injection and future extension. Precisely. -- Jens Axboe