diff --git a/0032-Grow-fix-can-t-change-bitmap-type-from-none-to-clust.patch b/0032-Grow-fix-can-t-change-bitmap-type-from-none-to-clust.patch new file mode 100644 index 0000000000000000000000000000000000000000..5352d08da14307711d82a6e5003edeb513aad172 --- /dev/null +++ b/0032-Grow-fix-can-t-change-bitmap-type-from-none-to-clust.patch @@ -0,0 +1,44 @@ +From d07e561810a2e33b667a8a9476edaff42eb119b9 Mon Sep 17 00:00:00 2001 +From: Heming Zhao +Date: Thu, 23 Feb 2023 22:39:39 +0800 +Subject: [PATCH] Grow: fix can't change bitmap type from none to clustered. + +Commit a042210648ed ("disallow create or grow clustered bitmap with +writemostly set") introduced this bug. We should use 'true' logic not +'== 0' to deny setting up clustered array under WRITEMOSTLY condition. + +How to trigger + +``` +~/mdadm # ./mdadm -Ss && ./mdadm --zero-superblock /dev/sd{a,b} +~/mdadm # ./mdadm -C /dev/md0 -l mirror -b clustered -e 1.2 -n 2 \ +/dev/sda /dev/sdb --assume-clean +mdadm: array /dev/md0 started. +~/mdadm # ./mdadm --grow /dev/md0 --bitmap=none +~/mdadm # ./mdadm --grow /dev/md0 --bitmap=clustered +mdadm: /dev/md0 disks marked write-mostly are not supported with clustered bitmap +``` + +Signed-off-by: Heming Zhao +Acked-by: Coly Li +Signed-off-by: Jes Sorensen +--- + Grow.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Grow.c b/Grow.c +index 9c6fc95..efcdce8 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -430,7 +430,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) + dv = map_dev(disk.major, disk.minor, 1); + if (!dv) + continue; +- if (((disk.state & (1 << MD_DISK_WRITEMOSTLY)) == 0) && ++ if ((disk.state & (1 << MD_DISK_WRITEMOSTLY)) && + (strcmp(s->bitmap_file, "clustered") == 0)) { + pr_err("%s disks marked write-mostly are not supported with clustered bitmap\n",devname); + return 1; +-- +2.43.0 + diff --git a/mdadm.spec b/mdadm.spec index 6ead07ab0d239cb9628ef0a6cb4ea883c8ca2f02..252053db5899c9fe0c2a250b67ea57d08fb432b2 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,6 +1,6 @@ Name: mdadm Version: 4.2 -Release: 19 +Release: 20 Summary: The software RAID arrays user manage tools License: GPLv2+ URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ @@ -41,6 +41,7 @@ Patch28: 0028-mdadm-super1-fix-coverity-issue-CHECKED_RETURN.patch Patch39: 0029-mdadm-util.c-fix-coverity-issues.patch Patch30: 0030-mdadm-sysfs.c-fix-coverity-issues.patch Patch31: 0031-super1-Clear-extra-flags-when-initializing-metadata.patch +Patch32: 0032-Grow-fix-can-t-change-bitmap-type-from-none-to-clust.patch BuildRequires: systemd gcc binutils libudev-devel @@ -107,6 +108,9 @@ install -d -m 710 %{buildroot}/var/run/mdadm/ %{_mandir}/man*/* %changelog +* Sat Nov 8 2025 liuh - 4.2-20 +- Grow: fix can't change bitmap type from none to clustered. + * Tue Mar 18 2025 wuguanghao - 4.2-19 - super1 clear extra flags when initializing metadata