summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2022-09-16 14:34:27 +0300
committerSong Liu <song@kernel.org>2022-09-22 10:05:05 +0300
commit4f350284a7306b3dff676caeafd3faf1b5c068d5 (patch)
tree5e6c2eda45cf543be75d07740d54b8c2df4c855a /drivers/md
parent0c0be98bbe67662a7d2bf8381106bfca0e31ed72 (diff)
downloadlinux-4f350284a7306b3dff676caeafd3faf1b5c068d5.tar.xz
md/raid10: fix improper BUG_ON() in raise_barrier()
'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>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid10.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 461c8a79fb99..2970a73d9f5c 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -936,8 +936,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,