]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: fix --grow with --add for linear
authorYu Kuai <yukuai3@huawei.com>
Fri, 27 Dec 2024 06:07:02 +0000 (14:07 +0800)
committerNigel Croxon <109605997+ncroxon@users.noreply.github.com>
Tue, 28 Jan 2025 14:26:38 +0000 (09:26 -0500)
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 <yukuai3@huawei.com>
Signed-off-by: Mariusz Tkaczyk <mtkaczyk@kernel.org>
mdadm.c

diff --git a/mdadm.c b/mdadm.c
index a72058b44925912b124be32598fe0d7f7c95a4e0..6200cd0e7f9b50b879f180b89f2adf5efa3372f9 100644 (file)
--- 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;