From: Hao Xu <howeyxu@xxxxxxxxxxx> From: Hao Xu <howeyxu@xxxxxxxxxxx> When users want to cancel a request, look into the exec work list of fixed worker as well. It's not sane to ignore it. Signed-off-by: Hao Xu <howeyxu@xxxxxxxxxxx> --- fs/io-wq.c | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/fs/io-wq.c b/fs/io-wq.c index c6e4179a9961..5345a5f57e4f 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -1287,32 +1287,26 @@ static bool io_acct_cancel_pending_work(struct io_wqe *wqe, return false; } -static void io_wqe_cancel_pending_work(struct io_wqe *wqe, - struct io_cb_cancel_data *match) -{ +static void io_wqe_cancel_pending_work_fixed(struct io_wqe *wqe, + struct io_cb_cancel_data *match, + bool exec) { int i, j; struct io_wqe_acct *acct, *iw_acct; -retry_public: - for (i = 0; i < IO_WQ_ACCT_NR; i++) { - acct = io_get_acct(wqe, i == 0, false); - if (io_acct_cancel_pending_work(wqe, acct, match)) { - if (match->cancel_all) - goto retry_public; - return; - } - } - -retry_private: +retry: for (i = 0; i < IO_WQ_ACCT_NR; i++) { acct = io_get_acct(wqe, i == 0, true); raw_spin_lock(&acct->lock); for (j = 0; j < acct->nr_fixed; j++) { - iw_acct = &acct->fixed_workers[j]->acct; + if (exec) + iw_acct = &acct->fixed_workers[j]->acct; + else + iw_acct = &acct->fixed_workers[j]->exec_acct; + if (io_acct_cancel_pending_work(wqe, iw_acct, match)) { if (match->cancel_all) { raw_spin_unlock(&acct->lock); - goto retry_private; + goto retry; } break; } @@ -1321,6 +1315,26 @@ static void io_wqe_cancel_pending_work(struct io_wqe *wqe, } } +static void io_wqe_cancel_pending_work(struct io_wqe *wqe, + struct io_cb_cancel_data *match) +{ + int i; + struct io_wqe_acct *acct; + +retry: + for (i = 0; i < IO_WQ_ACCT_NR; i++) { + acct = io_get_acct(wqe, i == 0, false); + if (io_acct_cancel_pending_work(wqe, acct, match)) { + if (match->cancel_all) + goto retry; + return; + } + } + + io_wqe_cancel_pending_work_fixed(wqe, match, false); + io_wqe_cancel_pending_work_fixed(wqe, match, true); +} + static void io_wqe_cancel_running_work(struct io_wqe *wqe, struct io_cb_cancel_data *match) { -- 2.25.1