summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Ni <xni@redhat.com>2015-12-22 11:09:34 +0800
committerNeilBrown <neilb@suse.com>2015-12-22 15:16:08 +1100
commitf7cf9699dc0570ab4bce6d077ba51c329644cf7e (patch)
tree30e400c1bc7f67f7a06938be531dd9760b95d1f6
parent38c2e05b6a2851dd288009e85f2987bd05ce5835 (diff)
downloadmdadm-f7cf9699dc0570ab4bce6d077ba51c329644cf7e.tar.gz
Check and remove bitmap first when reshape to raid0
If reshape one raid device with bitmap to raid0, the reshape progress will start. But it'll fail and lose some components. So it should remove bitmap first. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: NeilBrown <neilb@suse.com>
-rwxr-xr-xGrow.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Grow.c b/Grow.c
index 6dfb9c9..89e4c34 100755
--- a/Grow.c
+++ b/Grow.c
@@ -1590,6 +1590,15 @@ 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 (ioctl(fd, SET_ARRAY_INFO, &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