From: Yu Kuai Date: Fri, 16 Sep 2022 11:34:27 +0000 (+0800) Subject: md/raid10: fix improper BUG_ON() in raise_barrier() X-Git-Tag: for-6.1/passthrough-2022-10-03~19^2~34^2~2^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=4f350284a7306b3dff676caeafd3faf1b5c068d5;p=linux-block.git 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 Reviewed-by: Logan Gunthorpe Acked-by: Guoqing Jiang Signed-off-by: Song Liu --- 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,