io_uring: allow non-fixed files with SQPOLL
authorJens Axboe <axboe@kernel.dk>
Wed, 2 Sep 2020 02:02:49 +0000 (20:02 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 5 Sep 2020 22:07:35 +0000 (16:07 -0600)
commite54c92fb496b554ee545e79394e96f2fba43049e
treed385e4ce329f592bd8c1766ec2567aac4ca57bd5
parent74acf5b47e3bf515688d6eb86b17bde459cdcb29
io_uring: allow non-fixed files with SQPOLL

The restriction of needing fixed files for SQPOLL is problematic, and
prevents/inhibits several valid uses cases.

There's no real good reason for us not to allow it, except we need to
have the sqpoll thread inherit current->files from the task that setup
the ring. We can't easily do that, since we'd introduce a circular
reference by holding on to our own file table.

If we wait for the sqpoll thread to exit when the ring fd is closed,
then we can safely reference the task files_struct without holding
a reference to it. And once we inherit that in the SQPOLL thread, we
can support non-fixed files for SQPOLL.

This feature is exposed as IORING_FEAT_SQPOLL_NONFIXED.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
include/uapi/linux/io_uring.h