diff options
author | Heming Zhao <heming.zhao@suse.com> | 2023-02-23 15:39:39 +0100 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2023-02-23 19:23:26 +0100 |
commit | d07e561810a2e33b667a8a9476edaff42eb119b9 (patch) | |
tree | abe74458156206a4adf2950b1cbcad241a72e80e | |
parent | Revert "mdadm/systemd: remove KillMode=none from service file" (diff) | |
download | mdadm-d07e561810a2e33b667a8a9476edaff42eb119b9.tar.xz mdadm-d07e561810a2e33b667a8a9476edaff42eb119b9.zip |
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 <heming.zhao@suse.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
-rw-r--r-- | Grow.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -429,7 +429,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); free(mdi); |