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>
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;