diff options
-rw-r--r-- | drivers/md/raid1.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ea2a58d28871..f33a729960ca 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2154,11 +2154,25 @@ static int raid1_reshape(mddev_t *mddev) | |||
2154 | oldpool = conf->r1bio_pool; | 2154 | oldpool = conf->r1bio_pool; |
2155 | conf->r1bio_pool = newpool; | 2155 | conf->r1bio_pool = newpool; |
2156 | 2156 | ||
2157 | for (d=d2=0; d < conf->raid_disks; d++) | 2157 | for (d = d2 = 0; d < conf->raid_disks; d++) { |
2158 | if (conf->mirrors[d].rdev) { | 2158 | mdk_rdev_t *rdev = conf->mirrors[d].rdev; |
2159 | conf->mirrors[d].rdev->raid_disk = d2; | 2159 | if (rdev && rdev->raid_disk != d2) { |
2160 | newmirrors[d2++].rdev = conf->mirrors[d].rdev; | 2160 | char nm[20]; |
2161 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
2162 | sysfs_remove_link(&mddev->kobj, nm); | ||
2163 | rdev->raid_disk = d2; | ||
2164 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
2165 | sysfs_remove_link(&mddev->kobj, nm); | ||
2166 | if (sysfs_create_link(&mddev->kobj, | ||
2167 | &rdev->kobj, nm)) | ||
2168 | printk(KERN_WARNING | ||
2169 | "md/raid1: cannot register " | ||
2170 | "%s for %s\n", | ||
2171 | nm, mdname(mddev)); | ||
2161 | } | 2172 | } |
2173 | if (rdev) | ||
2174 | newmirrors[d2++].rdev = rdev; | ||
2175 | } | ||
2162 | kfree(conf->mirrors); | 2176 | kfree(conf->mirrors); |
2163 | conf->mirrors = newmirrors; | 2177 | conf->mirrors = newmirrors; |
2164 | kfree(conf->poolinfo); | 2178 | kfree(conf->poolinfo); |