Skip to content

Commit 3b58e9f

Browse files
committed
Merge tag 'io_uring-5.17-2022-01-28' of git://git.kernel.dk/linux-block
Pull io_uring fixes from Jens Axboe: "Just two small fixes this time: - Fix a bug that can lead to node registration taking 1 second, when it should finish much quicker (Dylan) - Remove an unused argument from a function (Usama)" * tag 'io_uring-5.17-2022-01-28' of git://git.kernel.dk/linux-block: io_uring: remove unused argument from io_rsrc_node_alloc io_uring: fix bug in slow unregistering of nodes
2 parents d66c1e7 + f6133fb commit 3b58e9f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fs/io_uring.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7822,10 +7822,15 @@ static __cold void io_rsrc_node_ref_zero(struct percpu_ref *ref)
78227822
struct io_ring_ctx *ctx = node->rsrc_data->ctx;
78237823
unsigned long flags;
78247824
bool first_add = false;
7825+
unsigned long delay = HZ;
78257826

78267827
spin_lock_irqsave(&ctx->rsrc_ref_lock, flags);
78277828
node->done = true;
78287829

7830+
/* if we are mid-quiesce then do not delay */
7831+
if (node->rsrc_data->quiesce)
7832+
delay = 0;
7833+
78297834
while (!list_empty(&ctx->rsrc_ref_list)) {
78307835
node = list_first_entry(&ctx->rsrc_ref_list,
78317836
struct io_rsrc_node, node);
@@ -7838,10 +7843,10 @@ static __cold void io_rsrc_node_ref_zero(struct percpu_ref *ref)
78387843
spin_unlock_irqrestore(&ctx->rsrc_ref_lock, flags);
78397844

78407845
if (first_add)
7841-
mod_delayed_work(system_wq, &ctx->rsrc_put_work, HZ);
7846+
mod_delayed_work(system_wq, &ctx->rsrc_put_work, delay);
78427847
}
78437848

7844-
static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx)
7849+
static struct io_rsrc_node *io_rsrc_node_alloc(void)
78457850
{
78467851
struct io_rsrc_node *ref_node;
78477852

@@ -7892,7 +7897,7 @@ static int io_rsrc_node_switch_start(struct io_ring_ctx *ctx)
78927897
{
78937898
if (ctx->rsrc_backup_node)
78947899
return 0;
7895-
ctx->rsrc_backup_node = io_rsrc_node_alloc(ctx);
7900+
ctx->rsrc_backup_node = io_rsrc_node_alloc();
78967901
return ctx->rsrc_backup_node ? 0 : -ENOMEM;
78977902
}
78987903

0 commit comments

Comments
 (0)