]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
io_uring: fix bug in slow unregistering of nodes
authorDylan Yudaken <dylany@fb.com>
Fri, 21 Jan 2022 12:38:56 +0000 (04:38 -0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 3 Feb 2022 09:28:53 +0000 (10:28 +0100)
commit817ab1d1542eb8698bab36dc6ad2d8f073b0d148
tree6a39ac31e26faa6f45d90a6a00cceeb4fc178ec7
parent634a917731a69415217d6921f0a8eea6551c1a37
io_uring: fix bug in slow unregistering of nodes

BugLink: https://bugs.launchpad.net/bugs/1959879
[ Upstream commit b36a2050040b2d839bdc044007cdd57101d7f881 ]

In some cases io_rsrc_ref_quiesce will call io_rsrc_node_switch_start,
and then immediately flush the delayed work queue &ctx->rsrc_put_work.

However the percpu_ref_put does not immediately destroy the node, it
will be called asynchronously via RCU. That ends up with
io_rsrc_node_ref_zero only being called after rsrc_put_work has been
flushed, and so the process ends up sleeping for 1 second unnecessarily.

This patch executes the put code immediately if we are busy
quiescing.

Fixes: 4a38aed2a0a7 ("io_uring: batch reap of dead file registrations")
Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220121123856.3557884-1-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/io_uring.c