@@ -541,6 +541,7 @@ enum {
541
541
REQ_F_POLLED_BIT ,
542
542
REQ_F_BUFFER_SELECTED_BIT ,
543
543
REQ_F_NO_FILE_TABLE_BIT ,
544
+ REQ_F_QUEUE_TIMEOUT_BIT ,
544
545
545
546
/* not a real bit, just to check we're not overflowing the space */
546
547
__REQ_F_LAST_BIT ,
@@ -596,6 +597,8 @@ enum {
596
597
REQ_F_BUFFER_SELECTED = BIT (REQ_F_BUFFER_SELECTED_BIT ),
597
598
/* doesn't need file table for this request */
598
599
REQ_F_NO_FILE_TABLE = BIT (REQ_F_NO_FILE_TABLE_BIT ),
600
+ /* needs to queue linked timeout */
601
+ REQ_F_QUEUE_TIMEOUT = BIT (REQ_F_QUEUE_TIMEOUT_BIT ),
599
602
};
600
603
601
604
struct async_poll {
@@ -1580,16 +1583,6 @@ static void io_free_req(struct io_kiocb *req)
1580
1583
io_queue_async_work (nxt );
1581
1584
}
1582
1585
1583
- static void io_link_work_cb (struct io_wq_work * * workptr )
1584
- {
1585
- struct io_kiocb * req = container_of (* workptr , struct io_kiocb , work );
1586
- struct io_kiocb * link ;
1587
-
1588
- link = list_first_entry (& req -> link_list , struct io_kiocb , link_list );
1589
- io_queue_linked_timeout (link );
1590
- io_wq_submit_work (workptr );
1591
- }
1592
-
1593
1586
static void io_wq_assign_next (struct io_wq_work * * workptr , struct io_kiocb * nxt )
1594
1587
{
1595
1588
struct io_kiocb * link ;
@@ -1601,7 +1594,7 @@ static void io_wq_assign_next(struct io_wq_work **workptr, struct io_kiocb *nxt)
1601
1594
* workptr = & nxt -> work ;
1602
1595
link = io_prep_linked_timeout (nxt );
1603
1596
if (link )
1604
- nxt -> work . func = io_link_work_cb ;
1597
+ nxt -> flags |= REQ_F_QUEUE_TIMEOUT ;
1605
1598
}
1606
1599
1607
1600
/*
@@ -5291,12 +5284,26 @@ static int io_issue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
5291
5284
return 0 ;
5292
5285
}
5293
5286
5287
+ static void io_arm_async_linked_timeout (struct io_kiocb * req )
5288
+ {
5289
+ struct io_kiocb * link ;
5290
+
5291
+ /* link head's timeout is queued in io_queue_async_work() */
5292
+ if (!(req -> flags & REQ_F_QUEUE_TIMEOUT ))
5293
+ return ;
5294
+
5295
+ link = list_first_entry (& req -> link_list , struct io_kiocb , link_list );
5296
+ io_queue_linked_timeout (link );
5297
+ }
5298
+
5294
5299
static void io_wq_submit_work (struct io_wq_work * * workptr )
5295
5300
{
5296
5301
struct io_wq_work * work = * workptr ;
5297
5302
struct io_kiocb * req = container_of (work , struct io_kiocb , work );
5298
5303
int ret = 0 ;
5299
5304
5305
+ io_arm_async_linked_timeout (req );
5306
+
5300
5307
/* if NO_CANCEL is set, we must still run the work */
5301
5308
if ((work -> flags & (IO_WQ_WORK_CANCEL |IO_WQ_WORK_NO_CANCEL )) ==
5302
5309
IO_WQ_WORK_CANCEL ) {
0 commit comments