提交 a6394883 编写于 作者: J Jens Axboe 提交者: Joseph Qi

io_uring: file switch work needs to get flushed on exit

to #26323588

commit e46a7950d362231a4d0b078af5f4c109b8e5ac9e upstream.

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: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 1dd60f09
...@@ -5076,11 +5076,14 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) ...@@ -5076,11 +5076,14 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
return -ENXIO; return -ENXIO;
/* protect against inflight atomic switch, which drops the ref */ /* protect against inflight atomic switch, which drops the ref */
flush_work(&data->ref_work);
percpu_ref_get(&data->refs); 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); percpu_ref_kill_and_confirm(&data->refs, io_file_ref_kill);
wait_for_completion(&data->done); wait_for_completion(&data->done);
percpu_ref_put(&data->refs); percpu_ref_put(&data->refs);
/* flush potential new switch */
flush_work(&data->ref_work);
percpu_ref_exit(&data->refs); percpu_ref_exit(&data->refs);
__io_sqe_files_unregister(ctx); __io_sqe_files_unregister(ctx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册