Re: [PATCH 2/2] io_uring: don't hold uring_lock when calling io_run_task_work*

Pavel Begunkov
2021-02-04T11:38:56Z

On 03/02/2021 14:57, Hao Xu wrote:
> This is caused by calling io_run_task_work_sig() to do work under
> uring_lock while the caller io_sqe_files_unregister() already held
> uring_lock.
> we need to check if uring_lock is held by us when doing unlock around
> io_run_task_work_sig() since there are code paths down to that place
> without uring_lock held.

btw, better to prepare it for-5.12, seems it won't apply

> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index efb6d02fea6f..b093977713ee 100644
[...]
> - if (ret < 0) {
> - percpu_ref_resurrect(&data->refs);
> - reinit_completion(&data->done);
> - io_sqe_files_set_node(data, backup_node);
> - return ret;
> - }
> + if (ret < 0)
> + break;
> } while (1);

while (ret >= 0) ?

--
Pavel Begunkov