Introduce a mapping from ctx to all tctx, and using that removes file notes, i.e. taking a io_uring file note previously stored in task->io_uring->xa. It's needed because we don't free io_uring ctx until all submitters die/exec, and it became worse after killing ->flush(). There are rough corner in a form of not behaving nicely, I'll address in follow-up patches. The torture is as simple as below. It will get OOM in no time. Also, I plan to use it to fix recently broken cancellations. while (1) { assert(!io_uring_queue_init(8, &ring, 0)); io_uring_queue_exit(&ring); } v2: rebase (resolve conflicts) drop taken 2 patches v3: use jiffies in 6/6 (Jens) Pavel Begunkov (6): io_uring: make del_task_file more forgiving io_uring: introduce ctx to tctx back map io_uring: do ctx initiated file note removal io_uring: don't take task ring-file notes io_uring: index io_uring->xa by ctx not file io_uring: warn when ring exit takes too long fs/io_uring.c | 131 +++++++++++++++++++++++++++++++-------- include/linux/io_uring.h | 2 +- 2 files changed, 106 insertions(+), 27 deletions(-) -- 2.24.0