summaryrefslogtreecommitdiffstats
path: root/Create.c
diff options
context:
space:
mode:
authorNigel Croxon <ncroxon@redhat.com>2021-08-23 14:48:35 +0200
committerJes Sorensen <jsorensen@fb.com>2021-10-08 17:47:55 +0200
commita042210648ed83a34d987871911a776b5b09cdc5 (patch)
treebc90108b0ff2c6522bc486861e9db7f8ee3d8c37 /Create.c
parentFix buffer size warning for strcpy (diff)
downloadmdadm-a042210648ed83a34d987871911a776b5b09cdc5.tar.xz
mdadm-a042210648ed83a34d987871911a776b5b09cdc5.zip
disallow create or grow clustered bitmap with writemostly set
Do not support creating an MD array on a clustered system (--bitmap=clustered) and disks with the write mostly (--write-mostly) flag set. Or do not grow an MD array on a non-clustered bitmap to a clustered bitmap with disks having the write mostly flag set. The actual results is the MD array is created successfully. But the expected results should be a failure with an error message stating: Can not set --write-mostly with a clustered bitmap. and disks marked write-mostly are not supported with clustered bitmap. V2: Added the device name in the error message during creation: mdadm -CR /dev/md0 -l1 --raid-devices=2 /dev/sda --write-mostly /dev/sdb --bitmap=clustered mdadm: Can not set /dev/sdb --write-mostly with a clustered bitmap. Added the array name in the error message when growing: mdadm --grow /dev/md0 --bitmap=clustered mdadm: /dev/md0 disks marked write-mostly are not supported with clustered bitmap Signed-off-by: Nigel Croxon <ncroxon@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Create.c')
-rw-r--r--Create.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Create.c b/Create.c
index 2c0b17e9..0ff1922d 100644
--- a/Create.c
+++ b/Create.c
@@ -899,8 +899,13 @@ int Create(struct supertype *st, char *mddev,
else
inf->disk.state = 0;
- if (dv->writemostly == FlagSet)
- inf->disk.state |= (1<<MD_DISK_WRITEMOSTLY);
+ if (dv->writemostly == FlagSet) {
+ if (major_num == BITMAP_MAJOR_CLUSTERED) {
+ pr_err("Can not set %s --write-mostly with a clustered bitmap\n",dv->devname);
+ goto abort_locked;
+ } else
+ inf->disk.state |= (1<<MD_DISK_WRITEMOSTLY);
+ }
if (dv->failfast == FlagSet)
inf->disk.state |= (1<<MD_DISK_FAILFAST);