diff options
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 650991bddd8e..f33a729960ca 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1972,7 +1972,8 @@ static int run(mddev_t *mddev) | |||
1972 | !test_bit(In_sync, &disk->rdev->flags)) { | 1972 | !test_bit(In_sync, &disk->rdev->flags)) { |
1973 | disk->head_position = 0; | 1973 | disk->head_position = 0; |
1974 | mddev->degraded++; | 1974 | mddev->degraded++; |
1975 | conf->fullsync = 1; | 1975 | if (disk->rdev) |
1976 | conf->fullsync = 1; | ||
1976 | } | 1977 | } |
1977 | } | 1978 | } |
1978 | if (mddev->degraded == conf->raid_disks) { | 1979 | if (mddev->degraded == conf->raid_disks) { |
@@ -2153,11 +2154,25 @@ static int raid1_reshape(mddev_t *mddev) | |||
2153 | oldpool = conf->r1bio_pool; | 2154 | oldpool = conf->r1bio_pool; |
2154 | conf->r1bio_pool = newpool; | 2155 | conf->r1bio_pool = newpool; |
2155 | 2156 | ||
2156 | for (d=d2=0; d < conf->raid_disks; d++) | 2157 | for (d = d2 = 0; d < conf->raid_disks; d++) { |
2157 | if (conf->mirrors[d].rdev) { | 2158 | mdk_rdev_t *rdev = conf->mirrors[d].rdev; |
2158 | conf->mirrors[d].rdev->raid_disk = d2; | 2159 | if (rdev && rdev->raid_disk != d2) { |
2159 | 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)); | ||
2160 | } | 2172 | } |
2173 | if (rdev) | ||
2174 | newmirrors[d2++].rdev = rdev; | ||
2175 | } | ||
2161 | kfree(conf->mirrors); | 2176 | kfree(conf->mirrors); |
2162 | conf->mirrors = newmirrors; | 2177 | conf->mirrors = newmirrors; |
2163 | kfree(conf->poolinfo); | 2178 | kfree(conf->poolinfo); |