[PATCH] md/raid5: reject llbitmap chunk shrink during reshape

Yu Kuai posted 1 patch 1 month, 4 weeks ago
drivers/md/raid5.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] md/raid5: reject llbitmap chunk shrink during reshape
Posted by Yu Kuai 1 month, 4 weeks ago
llbitmap reshape keeps one live bitmap and only supports growing the
tracked chunk geometry. Reject RAID5 reshape attempts that would shrink
the llbitmap chunk size.

Signed-off-by: Yu Kuai <yukuai@fnnas.com>
---
 drivers/md/raid5.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 0c58c175bad9..178283aa91a4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8459,6 +8459,9 @@ static int check_reshape(struct mddev *mddev)
 	if (!check_stripe_cache(mddev))
 		return -ENOSPC;
 
+	if (mddev->bitmap_id == ID_LLBITMAP &&
+	    mddev->new_chunk_sectors < mddev->chunk_sectors)
+		return -EOPNOTSUPP;
 	if (mddev->new_chunk_sectors > mddev->chunk_sectors ||
 	    mddev->delta_disks > 0)
 		if (resize_chunks(conf,
-- 
2.51.0