aboutsummaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-01-17 11:15:34 -0700
committerJens Axboe <axboe@kernel.dk>2020-01-20 17:04:07 -0700
commite46a7950d362231a4d0b078af5f4c109b8e5ac9e (patch)
tree5485e29e2b5ea91d059267e8e2d4a84185207d05 /fs/io_uring.c
parentio_uring: hide uring_fd in ctx (diff)
downloadlinux-dev-e46a7950d362231a4d0b078af5f4c109b8e5ac9e.tar.xz
linux-dev-e46a7950d362231a4d0b078af5f4c109b8e5ac9e.zip
io_uring: file switch work needs to get flushed on exit
We currently flush early, but if we have something in progress and a new switch is scheduled, we need to ensure to flush after our teardown as well. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r--fs/io_uring.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 46cc1bc48062..a0a58c181eaf 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5089,11 +5089,14 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
return -ENXIO;
/* protect against inflight atomic switch, which drops the ref */
- flush_work(&data->ref_work);
percpu_ref_get(&data->refs);
+ /* wait for existing switches */
+ flush_work(&data->ref_work);
percpu_ref_kill_and_confirm(&data->refs, io_file_ref_kill);
wait_for_completion(&data->done);
percpu_ref_put(&data->refs);
+ /* flush potential new switch */
+ flush_work(&data->ref_work);
percpu_ref_exit(&data->refs);
__io_sqe_files_unregister(ctx);