Re: [PATCH] fuse: use READ_ONCE in fuse_chan_num_background()

From: Miklos Szeredi

Date: Wed Jun 10 2026 - 09:30:11 EST


On Fri, 22 May 2026 at 10:38, Li Wang <liwang@xxxxxxxxxx> wrote:
>
> fuse_chan_num_background() is called without holding fch->bg_lock (for
> example from fuse_writepages() to compare against fc->congestion_threshold),
> while fch->num_background is updated under bg_lock in dev.c and dev_uring.c.
> This is the same locked-write/lockless-read pattern already used for
> max_background in fuse_chan_max_background().
>
> Use READ_ONCE() on the read side so that:
>
> - The compiler does not cache or coalesce loads of a value that may change
> concurrently on another CPU.
> - Prevent KCSAN from reporting an unexpected race.
>
> Signed-off-by: Li Wang <liwang@xxxxxxxxxx>

Applied, thanks.

Miklos