diff options
author | Pavel Begunkov <[email protected]> | 2021-01-25 11:42:20 +0000 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2021-02-01 10:02:43 -0700 |
commit | ecfc8492820732be652146280912554ced62c32b (patch) | |
tree | dcce34147e2a673c4937ade543294fdca13b7001 | |
parent | 0bead8cd39b9c9c7c4e902018ccf129107ac50ef (diff) |
io_uring: ensure only sqo_task has file notes
For SQPOLL io_uring we want to have only one file note held by
sqo_task. Add a warning to make sure it holds. It's deep in
io_uring_add_task_file() out of hot path, so shouldn't hurt.
Signed-off-by: Pavel Begunkov <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
-rw-r--r-- | fs/io_uring.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index b05d37431c12..68bf2c8c23a9 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -9099,6 +9099,10 @@ static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file) fput(file); return ret; } + + /* one and only SQPOLL file note, held by sqo_task */ + WARN_ON_ONCE((ctx->flags & IORING_SETUP_SQPOLL) && + current != ctx->sqo_task); } tctx->last = file; } |