summaryrefslogtreecommitdiffstats
path: root/sysfs.c
diff options
context:
space:
mode:
authorAdam Kwolek <adam.kwolek@intel.com>2011-04-18 02:31:15 +0200
committerNeilBrown <neilb@suse.de>2011-04-18 02:31:15 +0200
commita5062b1cb6ad51ebaa1f8b60e1cfe5408dbf17d7 (patch)
treee59ff8e0d435feb0fab46a83fa291f621aa84dc3 /sysfs.c
parentFIX: Fiddle raid_disks number when restarting reshape (diff)
downloadmdadm-a5062b1cb6ad51ebaa1f8b60e1cfe5408dbf17d7.tar.xz
mdadm-a5062b1cb6ad51ebaa1f8b60e1cfe5408dbf17d7.zip
FIX: Set proper raid disks during migration
During migration raid_disks field contains new disks number now. It should be set old disks number first and then new disks number to allow md to calculate e.g. delta_disks parameter. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r--sysfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysfs.c b/sysfs.c
index b806e145..f1c66692 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -531,6 +531,7 @@ int sysfs_set_array(struct mdinfo *info, int vers)
{
int rv = 0;
char ver[100];
+ int raid_disks = info->array.raid_disks;
ver[0] = 0;
if (info->array.major_version == -1 &&
@@ -549,7 +550,9 @@ int sysfs_set_array(struct mdinfo *info, int vers)
return 0; /* FIXME */
rv |= sysfs_set_str(info, NULL, "level",
map_num(pers, info->array.level));
- rv |= sysfs_set_num(info, NULL, "raid_disks", info->array.raid_disks);
+ if (info->reshape_active && info->delta_disks != UnSet)
+ raid_disks -= info->delta_disks;
+ rv |= sysfs_set_num(info, NULL, "raid_disks", raid_disks);
rv |= sysfs_set_num(info, NULL, "chunk_size", info->array.chunk_size);
rv |= sysfs_set_num(info, NULL, "layout", info->array.layout);
rv |= sysfs_set_num(info, NULL, "component_size", info->component_size/2);
@@ -576,7 +579,7 @@ int sysfs_set_array(struct mdinfo *info, int vers)
rv |= sysfs_set_num(info, NULL, "chunk_size", info->new_chunk);
rv |= sysfs_set_num(info, NULL, "layout", info->new_layout);
rv |= sysfs_set_num(info, NULL, "raid_disks",
- info->array.raid_disks + info->delta_disks);
+ info->array.raid_disks);
/* We don't set 'new_level' here. That can only happen
* once the reshape completes.
*/