aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2022-09-16 19:34:27 +0800
committerSong Liu <song@kernel.org>2022-09-22 00:05:05 -0700
commit4f350284a7306b3dff676caeafd3faf1b5c068d5 (patch)
tree5e6c2eda45cf543be75d07740d54b8c2df4c855a
parentmd/raid10: prevent unnecessary calls to wake_up() in fast path (diff)
downloadlinux-dev-4f350284a7306b3dff676caeafd3faf1b5c068d5.tar.xz
linux-dev-4f350284a7306b3dff676caeafd3faf1b5c068d5.zip
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>
-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,