mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 04:04:06 +00:00
io_uring: fix CQ waiting timeout handling
commit12521a5d5c
upstream. Jiffy to ktime CQ waiting conversion broke how we treat timeouts, in particular we rearm it anew every time we get into io_cqring_wait_schedule() without adjusting the timeout. Waiting for 2 CQEs and getting a task_work in the middle may double the timeout value, or even worse in some cases task may wait indefinitely. Cc: stable@vger.kernel.org Fixes:228339662b
("io_uring: don't convert to jiffies for waiting on timeouts") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/f7bffddd71b08f28a877d44d37ac953ddb01590d.1672915663.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bc474484a9
commit
c7249e14ee
1 changed files with 3 additions and 3 deletions
|
@ -7598,7 +7598,7 @@ static int io_run_task_work_sig(void)
|
|||
/* when returns >0, the caller should retry */
|
||||
static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
|
||||
struct io_wait_queue *iowq,
|
||||
ktime_t timeout)
|
||||
ktime_t *timeout)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -7610,7 +7610,7 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
|
|||
if (test_bit(0, &ctx->check_cq_overflow))
|
||||
return 1;
|
||||
|
||||
if (!schedule_hrtimeout(&timeout, HRTIMER_MODE_ABS))
|
||||
if (!schedule_hrtimeout(timeout, HRTIMER_MODE_ABS))
|
||||
return -ETIME;
|
||||
return 1;
|
||||
}
|
||||
|
@ -7673,7 +7673,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
|
|||
}
|
||||
prepare_to_wait_exclusive(&ctx->cq_wait, &iowq.wq,
|
||||
TASK_INTERRUPTIBLE);
|
||||
ret = io_cqring_wait_schedule(ctx, &iowq, timeout);
|
||||
ret = io_cqring_wait_schedule(ctx, &iowq, &timeout);
|
||||
finish_wait(&ctx->cq_wait, &iowq.wq);
|
||||
cond_resched();
|
||||
} while (ret > 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue