From: Yu Kuai yukuai3@huawei.com
mainline inclusion from mainline-v6.1-rc1 commit 4f350284a7306b3dff676caeafd3faf1b5c068d5 category: bugfix bugzilla: 188015, https://gitee.com/openeuler/kernel/issues/I63WZE
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=...
--------------------------------
'conf->barrier' is protected by 'conf->resync_lock', reading 'conf->barrier' without holding the lock is wrong.
Signed-off-by: Yu Kuai yukuai3@huawei.com Reviewed-by: Logan Gunthorpe logang@deltatee.com Acked-by: Guoqing Jiang guoqing.jiang@linux.dev Signed-off-by: Song Liu song@kernel.org Signed-off-by: Li Nan linan122@huawei.com --- drivers/md/raid10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 222d9ed76b4b..f1ff63c0444c 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -941,8 +941,8 @@ static void flush_pending_writes(struct r10conf *conf)
static void raise_barrier(struct r10conf *conf, int force) { - BUG_ON(force && !conf->barrier); spin_lock_irq(&conf->resync_lock); + BUG_ON(force && !conf->barrier);
/* Wait until no block IO is waiting (unless 'force') */ wait_event_lock_irq(conf->wait_barrier, force || !conf->nr_waiting,