@@ -1502,10 +1502,10 @@ static void io_prep_async_link(struct io_kiocb *req)
1502
1502
if (req -> flags & REQ_F_LINK_TIMEOUT ) {
1503
1503
struct io_ring_ctx * ctx = req -> ctx ;
1504
1504
1505
- spin_lock (& ctx -> completion_lock );
1505
+ spin_lock_irq (& ctx -> timeout_lock );
1506
1506
io_for_each_link (cur , req )
1507
1507
io_prep_async_work (cur );
1508
- spin_unlock (& ctx -> completion_lock );
1508
+ spin_unlock_irq (& ctx -> timeout_lock );
1509
1509
} else {
1510
1510
io_for_each_link (cur , req )
1511
1511
io_prep_async_work (cur );
@@ -5699,6 +5699,7 @@ static __cold bool io_poll_remove_all(struct io_ring_ctx *ctx,
5699
5699
int posted = 0 , i ;
5700
5700
5701
5701
spin_lock (& ctx -> completion_lock );
5702
+ spin_lock_irq (& ctx -> timeout_lock );
5702
5703
for (i = 0 ; i < (1U << ctx -> cancel_hash_bits ); i ++ ) {
5703
5704
struct hlist_head * list ;
5704
5705
@@ -5708,6 +5709,7 @@ static __cold bool io_poll_remove_all(struct io_ring_ctx *ctx,
5708
5709
posted += io_poll_remove_one (req );
5709
5710
}
5710
5711
}
5712
+ spin_unlock_irq (& ctx -> timeout_lock );
5711
5713
spin_unlock (& ctx -> completion_lock );
5712
5714
5713
5715
if (posted )
@@ -9568,9 +9570,9 @@ static bool io_cancel_task_cb(struct io_wq_work *work, void *data)
9568
9570
struct io_ring_ctx * ctx = req -> ctx ;
9569
9571
9570
9572
/* protect against races with linked timeouts */
9571
- spin_lock (& ctx -> completion_lock );
9573
+ spin_lock_irq (& ctx -> timeout_lock );
9572
9574
ret = io_match_task (req , cancel -> task , cancel -> all );
9573
- spin_unlock (& ctx -> completion_lock );
9575
+ spin_unlock_irq (& ctx -> timeout_lock );
9574
9576
} else {
9575
9577
ret = io_match_task (req , cancel -> task , cancel -> all );
9576
9578
}
@@ -9585,12 +9587,14 @@ static __cold bool io_cancel_defer_files(struct io_ring_ctx *ctx,
9585
9587
LIST_HEAD (list );
9586
9588
9587
9589
spin_lock (& ctx -> completion_lock );
9590
+ spin_lock_irq (& ctx -> timeout_lock );
9588
9591
list_for_each_entry_reverse (de , & ctx -> defer_list , list ) {
9589
9592
if (io_match_task (de -> req , task , cancel_all )) {
9590
9593
list_cut_position (& list , & ctx -> defer_list , & de -> list );
9591
9594
break ;
9592
9595
}
9593
9596
}
9597
+ spin_unlock_irq (& ctx -> timeout_lock );
9594
9598
spin_unlock (& ctx -> completion_lock );
9595
9599
if (list_empty (& list ))
9596
9600
return false;
0 commit comments