diff options
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 2da9d3ba902d..229d7b204297 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -320,7 +320,6 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int | |||
320 | * this branch is our 'one mirror IO has finished' event handler: | 320 | * this branch is our 'one mirror IO has finished' event handler: |
321 | */ | 321 | */ |
322 | r1_bio->bios[mirror] = NULL; | 322 | r1_bio->bios[mirror] = NULL; |
323 | bio_put(bio); | ||
324 | if (!uptodate) { | 323 | if (!uptodate) { |
325 | md_error(r1_bio->mddev, conf->mirrors[mirror].rdev); | 324 | md_error(r1_bio->mddev, conf->mirrors[mirror].rdev); |
326 | /* an I/O failed, we can't clear the bitmap */ | 325 | /* an I/O failed, we can't clear the bitmap */ |
@@ -377,7 +376,6 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int | |||
377 | } | 376 | } |
378 | if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { | 377 | if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { |
379 | /* free extra copy of the data pages */ | 378 | /* free extra copy of the data pages */ |
380 | /* FIXME bio has been freed!!! */ | ||
381 | int i = bio->bi_vcnt; | 379 | int i = bio->bi_vcnt; |
382 | while (i--) | 380 | while (i--) |
383 | __free_page(bio->bi_io_vec[i].bv_page); | 381 | __free_page(bio->bi_io_vec[i].bv_page); |
@@ -391,6 +389,9 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int | |||
391 | raid_end_bio_io(r1_bio); | 389 | raid_end_bio_io(r1_bio); |
392 | } | 390 | } |
393 | 391 | ||
392 | if (r1_bio->bios[mirror]==NULL) | ||
393 | bio_put(bio); | ||
394 | |||
394 | rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); | 395 | rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); |
395 | return 0; | 396 | return 0; |
396 | } | 397 | } |
@@ -953,9 +954,6 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
953 | int mirror = 0; | 954 | int mirror = 0; |
954 | mirror_info_t *p; | 955 | mirror_info_t *p; |
955 | 956 | ||
956 | if (rdev->saved_raid_disk >= 0 && | ||
957 | conf->mirrors[rdev->saved_raid_disk].rdev == NULL) | ||
958 | mirror = rdev->saved_raid_disk; | ||
959 | for (mirror=0; mirror < mddev->raid_disks; mirror++) | 957 | for (mirror=0; mirror < mddev->raid_disks; mirror++) |
960 | if ( !(p=conf->mirrors+mirror)->rdev) { | 958 | if ( !(p=conf->mirrors+mirror)->rdev) { |
961 | 959 | ||
@@ -972,7 +970,10 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
972 | p->head_position = 0; | 970 | p->head_position = 0; |
973 | rdev->raid_disk = mirror; | 971 | rdev->raid_disk = mirror; |
974 | found = 1; | 972 | found = 1; |
975 | if (rdev->saved_raid_disk != mirror) | 973 | /* As all devices are equivalent, we don't need a full recovery |
974 | * if this was recently any drive of the array | ||
975 | */ | ||
976 | if (rdev->saved_raid_disk < 0) | ||
976 | conf->fullsync = 1; | 977 | conf->fullsync = 1; |
977 | rcu_assign_pointer(p->rdev, rdev); | 978 | rcu_assign_pointer(p->rdev, rdev); |
978 | break; | 979 | break; |