diff options
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index c3b4772cfaea..3f5234fe3593 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -811,9 +811,12 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
811 | { | 811 | { |
812 | conf_t *conf = mddev->private; | 812 | conf_t *conf = mddev->private; |
813 | int found = 0; | 813 | int found = 0; |
814 | int mirror; | 814 | int mirror = 0; |
815 | mirror_info_t *p; | 815 | mirror_info_t *p; |
816 | 816 | ||
817 | if (rdev->saved_raid_disk >= 0 && | ||
818 | conf->mirrors[rdev->saved_raid_disk].rdev == NULL) | ||
819 | mirror = rdev->saved_raid_disk; | ||
817 | for (mirror=0; mirror < mddev->raid_disks; mirror++) | 820 | for (mirror=0; mirror < mddev->raid_disks; mirror++) |
818 | if ( !(p=conf->mirrors+mirror)->rdev) { | 821 | if ( !(p=conf->mirrors+mirror)->rdev) { |
819 | 822 | ||
@@ -830,6 +833,8 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
830 | p->head_position = 0; | 833 | p->head_position = 0; |
831 | rdev->raid_disk = mirror; | 834 | rdev->raid_disk = mirror; |
832 | found = 1; | 835 | found = 1; |
836 | if (rdev->saved_raid_disk != mirror) | ||
837 | conf->fullsync = 1; | ||
833 | p->rdev = rdev; | 838 | p->rdev = rdev; |
834 | break; | 839 | break; |
835 | } | 840 | } |