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

Yu Kuai posted 1 patch 1 month, 4 weeks ago
drivers/md/raid10.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] md/raid10: 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 RAID10 reshape attempts that would shrink
the llbitmap chunk size.

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

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 4901ebe45c87..ad19257c79fb 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4260,6 +4260,10 @@ static int raid10_check_reshape(struct mddev *mddev)
 
 	if (conf->geo.far_copies != 1 && !conf->geo.far_offset)
 		return -EINVAL;
+	if (mddev->bitmap_id == ID_LLBITMAP &&
+	    mddev->new_chunk_sectors &&
+	    mddev->new_chunk_sectors < mddev->chunk_sectors)
+		return -EOPNOTSUPP;
 
 	if (setup_geo(&geo, mddev, geo_start) != conf->copies)
 		/* mustn't change number of copies */
-- 
2.51.0