On 2/14/23 5:42 PM, Josh Triplett wrote: > Add a new flag IORING_REGISTER_USE_REGISTERED_RING (set via the high bit > of the opcode) to treat the fd as a registered index rather than a file > descriptor. > > This makes it possible for a library to open an io_uring, register the > ring fd, close the ring fd, and subsequently use the ring entirely via > registered index. This looks pretty straight forward to me, only real question I had was whether using the top bit of the register opcode for this is the best choice. But I can't think of better ways to do it, and the space is definitely big enough to do that, so looks fine to me. One more comment below: > + if (use_registered_ring) { > + /* > + * Ring fd has been registered via IORING_REGISTER_RING_FDS, we > + * need only dereference our task private array to find it. > + */ > + struct io_uring_task *tctx = current->io_uring; I need to double check if it's guaranteed we always have current->io_uring assigned here. If the ring is registered we certainly will have it, but what if someone calls io_uring_register(2) without having a ring setup upfront? IOW, I think we need a NULL check here and failing the request at that point. -- Jens Axboe