Re: [PATCH RFC 2/9] aio: Use accessor for hrtimer_sleeper ->task field

From: Christian Brauner

Date: Fri Jul 31 2026 - 08:58:47 EST


On 2026-07-30 17:40 -0700, Paul E. McKenney wrote:
> 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.
>
> KCSAN located this issue.
>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Cc: Benjamin LaHaise <bcrl@xxxxxxxxx>
> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
> Cc: Christian Brauner <brauner@xxxxxxxxxx>
> Cc: Jan Kara <jack@xxxxxxx>
> Cc: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
> Cc: Frederic Weisbecker <frederic@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxx>
> Cc: <linux-aio@xxxxxxxxx>
> Cc: <linux-fsdevel@xxxxxxxxxxxxxxx>
> ---

Reviewed-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>