summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Radtke <jakub.radtke@intel.com>2021-01-15 00:47:01 -0500
committerJes Sorensen <jsorensen@fb.com>2021-03-09 17:18:06 -0500
commitbdbe7f8199361a170d16f6d114fa61cd7e72599f (patch)
tree522e2445fed54d72633b2b29248004bf2ff07914
parent848d71c91dc249098bdbbf319e25d319eb1d8e23 (diff)
downloadmdadm-bdbe7f8199361a170d16f6d114fa61cd7e72599f.tar.gz
Grow: Block reshape when external metadata and write-intent bitmap
Current kernel sysfs interface for the bitmap is limited. It allows the applying of the bitmap on non-active volumes only. The reshape operation for a volume with a bitmap should be blocked. Signed-off-by: Jakub Radtke <jakub.radtke@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r--Grow.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/Grow.c b/Grow.c
index cec83886..11209299 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1850,15 +1850,14 @@ int Grow_reshape(char *devname, int fd,
pr_err("Cannot increase raid-disks on this array beyond %d\n", st->max_devs);
return 1;
}
- if (s->level == 0 &&
- (array.state & (1<<MD_SB_BITMAP_PRESENT)) &&
- !(array.state & (1<<MD_SB_CLUSTERED))) {
- array.state &= ~(1<<MD_SB_BITMAP_PRESENT);
- if (md_set_array_info(fd, &array)!= 0) {
- pr_err("failed to remove internal bitmap.\n");
- return 1;
- }
- }
+ if (s->level == 0 && (array.state & (1 << MD_SB_BITMAP_PRESENT)) &&
+ !(array.state & (1 << MD_SB_CLUSTERED)) && !st->ss->external) {
+ array.state &= ~(1 << MD_SB_BITMAP_PRESENT);
+ if (md_set_array_info(fd, &array) != 0) {
+ pr_err("failed to remove internal bitmap.\n");
+ return 1;
+ }
+ }
/* in the external case we need to check that the requested reshape is
* supported, and perform an initial check that the container holds the
@@ -1922,6 +1921,13 @@ int Grow_reshape(char *devname, int fd,
free(subarray);
return 1;
}
+ if (content->consistency_policy ==
+ CONSISTENCY_POLICY_BITMAP) {
+ pr_err("Operation not supported when write-intent bitmap is enabled\n");
+ sysfs_free(cc);
+ free(subarray);
+ return 1;
+ }
}
sysfs_free(cc);
}