summaryrefslogtreecommitdiff
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2023-03-10 15:38:52 +0800
committerSong Liu <song@kernel.org>2023-04-13 22:20:24 -0700
commit9fdfe6d45be2fe1bd07678bfc453e6a627c08223 (patch)
tree240ede169516b66712062ed24f6b657363bbc67d /drivers/md/raid10.c
parent6efddf1e32e2a264694766ca485a4f5e04ee82a7 (diff)
md/raid10: don't BUG_ON() in raise_barrier()
If raise_barrier() is called the first time in raid10_sync_request(), which means the first non-normal io is handled, raise_barrier() should wait for all dispatched normal io to be done. This ensures that normal io won't starve. However, BUG_ON() if this is broken is too aggressive. This patch replace BUG_ON() with WARN and fall back to not force. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230310073855.1337560-4-yukuai1@huaweicloud.com
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 6b39e6c7ada3..f82a930f7be0 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -952,7 +952,9 @@ static void flush_pending_writes(struct r10conf *conf)
static void raise_barrier(struct r10conf *conf, int force)
{
write_seqlock_irq(&conf->resync_lock);
- BUG_ON(force && !conf->barrier);
+
+ if (WARN_ON_ONCE(force && !conf->barrier))
+ force = false;
/* Wait until no block IO is waiting (unless 'force') */
wait_event_barrier(conf, force || !conf->nr_waiting);