[tip: timers/core] io-uring/rw: Use accessor for hrtimer_sleeper ->task field

From: tip-bot2 for Paul E. McKenney

Date: Tue Sep 29 2026 - 15:06:56 EST


The following commit has been merged into the timers/core branch of tip:

Commit-ID: 851c30277918e1f1aad12394235d87c00afec464
Gitweb: https://git.kernel.org/tip/851c30277918e1f1aad12394235d87c00afec464
Author: Paul E. McKenney <paulmck@xxxxxxxxxx>
AuthorDate: Fri, 18 Sep 2026 17:14:20 -07:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Tue, 29 Sep 2026 21:02:51 +02:00

io-uring/rw: Use accessor for hrtimer_sleeper ->task field

The hrtimer_sleeper structure's ->task field is used as a flag to indicate
that the associated hrtimer has expired. This means that the hrtimer
handler can be storing to this field while other code is loading from it
to check for expiry. Note that additional races appear for hrtimers that
can be restarted, which could be argued to be a user error. However, that
is no reason to let the compiler introduce additional confusion, and to
this end, the hrtimer_sleeper_task_get() was introduced, use of which also
has the benefit of avoiding open-code access to hrtimer_sleeper innards.

Therefore, apply this accessor to the io_hybrid_iopoll_delay() function.

KCSAN located this issue.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20260919001428.3133388-4-paulmck@xxxxxxxxxx
---
io_uring/rw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/rw.c b/io_uring/rw.c
index 432820f..d9b1e09 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -1295,7 +1295,7 @@ static u64 io_hybrid_iopoll_delay(struct io_ring_ctx *ctx, struct io_kiocb *req)
set_current_state(TASK_INTERRUPTIBLE);
hrtimer_sleeper_start_expires(&timer, mode);

- if (timer.task)
+ if (hrtimer_sleeper_task_get(&timer))
io_schedule();

hrtimer_cancel(&timer.timer);