提交 4aa92083 编写于 作者: P Pavel Begunkov 提交者: Xiaoguang Wang

io-wq: close cancel gap for hashed linked work

to #28170604

commit f2cf11492b8b30d89b2fbf525c9ea5e8c4ccc842 upstream

After io_assign_current_work() of a linked work, it can be decided to
offloaded to another thread so doing io_wqe_enqueue(). However, until
next io_assign_current_work() it can be cancelled, that isn't handled.

Don't assign it, if it's not going to be executed.

Fixes: 60cf46ae6054 ("io-wq: hash dependent work")
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 8b3e2b70
......@@ -486,7 +486,7 @@ static void io_worker_handle_work(struct io_worker *worker)
struct io_wq *wq = wqe->wq;
do {
struct io_wq_work *work;
struct io_wq_work *work, *assign_work;
unsigned int hash;
get_next:
/*
......@@ -523,10 +523,14 @@ static void io_worker_handle_work(struct io_worker *worker)
hash = io_get_work_hash(work);
work->func(&work);
work = (old_work == work) ? NULL : work;
io_assign_current_work(worker, work);
assign_work = work;
if (work && io_wq_is_hashed(work))
assign_work = NULL;
io_assign_current_work(worker, assign_work);
wq->free_work(old_work);
if (work && io_wq_is_hashed(work)) {
if (work && !assign_work) {
io_wqe_enqueue(wqe, work);
work = NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册