md/raid10: annotate lockless access to array_freeze_pending

conf->array_freeze_pending is updated under conf->resync_lock in
freeze_array(), but read locklessly in allow_barrier(). Annotate these
accesses with READ_ONCE()/WRITE_ONCE() to document the intentional lockless
access and to prevent load/store tearing or fusing by the compiler. No
functional change.

Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Link: https://patch.msgid.link/20260817033340.418119-2-wozizhi@huawei.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
This commit is contained in:
Zizhi Wo 2026-08-17 11:33:39 +08:00 committed by Yu Kuai
parent 85bffad4d2
commit 68c51a7b1b

View File

@ -1037,7 +1037,7 @@ static void wait_barrier(struct r10conf *conf)
static void allow_barrier(struct r10conf *conf)
{
if ((atomic_dec_and_test(&conf->nr_pending)) ||
(conf->array_freeze_pending))
READ_ONCE(conf->array_freeze_pending))
wake_up_barrier(conf);
}
@ -1056,12 +1056,12 @@ static void freeze_array(struct r10conf *conf, int extra)
* we continue.
*/
write_seqlock_irq(&conf->resync_lock);
conf->array_freeze_pending++;
WRITE_ONCE(conf->array_freeze_pending, conf->array_freeze_pending + 1);
WRITE_ONCE(conf->barrier, conf->barrier + 1);
conf->nr_waiting++;
wait_event_barrier_cmd(conf, atomic_read(&conf->nr_pending) ==
conf->nr_queued + extra, flush_pending_writes(conf));
conf->array_freeze_pending--;
WRITE_ONCE(conf->array_freeze_pending, conf->array_freeze_pending - 1);
write_sequnlock_irq(&conf->resync_lock);
}