From: Yu Kuai Date: Fri, 27 Dec 2024 06:07:02 +0000 (+0800) Subject: mdadm: fix --grow with --add for linear X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c09ae8417dc9e11da1d5bf2867c6498050c6ddb9;p=thirdparty%2Fmdadm.git mdadm: fix --grow with --add for linear For the case mdadm --grow with --add, the s.btype should not be initialized yet, hence BitmapUnknown should be checked instead of BitmapNone. Noted that this behaviour should only support by md-linear, which is removed from kernel, howerver, it turns out md-linear is used widely in home NAS and we're planning to reintroduce it soon. Fixes: 581ba1341017 ("mdadm: remove bitmap file support") Signed-off-by: Yu Kuai Signed-off-by: Mariusz Tkaczyk --- diff --git a/mdadm.c b/mdadm.c index a72058b4..6200cd0e 100644 --- a/mdadm.c +++ b/mdadm.c @@ -1619,7 +1619,7 @@ int main(int argc, char *argv[]) if (devs_found > 1 && s.raiddisks == 0 && s.level == UnSet) { /* must be '-a'. */ if (s.size > 0 || s.chunk || - s.layout_str || s.btype != BitmapNone) { + s.layout_str || s.btype != BitmapUnknown) { pr_err("--add cannot be used with other geometry changes in --grow mode\n"); rv = 1; break;