aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index e16f473bcf46..f12fc288f25d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -416,10 +416,10 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio)
416 /* Choose the first operation device, for consistancy */ 416 /* Choose the first operation device, for consistancy */
417 new_disk = 0; 417 new_disk = 0;
418 418
419 for (rdev = conf->mirrors[new_disk].rdev; 419 for (rdev = rcu_dereference(conf->mirrors[new_disk].rdev);
420 !rdev || !rdev->in_sync 420 !rdev || !rdev->in_sync
421 || test_bit(WriteMostly, &rdev->flags); 421 || test_bit(WriteMostly, &rdev->flags);
422 rdev = conf->mirrors[++new_disk].rdev) { 422 rdev = rcu_dereference(conf->mirrors[++new_disk].rdev)) {
423 423
424 if (rdev && rdev->in_sync) 424 if (rdev && rdev->in_sync)
425 wonly_disk = new_disk; 425 wonly_disk = new_disk;
@@ -434,10 +434,10 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio)
434 434
435 435
436 /* make sure the disk is operational */ 436 /* make sure the disk is operational */
437 for (rdev = conf->mirrors[new_disk].rdev; 437 for (rdev = rcu_dereference(conf->mirrors[new_disk].rdev);
438 !rdev || !rdev->in_sync || 438 !rdev || !rdev->in_sync ||
439 test_bit(WriteMostly, &rdev->flags); 439 test_bit(WriteMostly, &rdev->flags);
440 rdev = conf->mirrors[new_disk].rdev) { 440 rdev = rcu_dereference(conf->mirrors[new_disk].rdev)) {
441 441
442 if (rdev && rdev->in_sync) 442 if (rdev && rdev->in_sync)
443 wonly_disk = new_disk; 443 wonly_disk = new_disk;
@@ -474,7 +474,7 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio)
474 disk = conf->raid_disks; 474 disk = conf->raid_disks;
475 disk--; 475 disk--;
476 476
477 rdev = conf->mirrors[disk].rdev; 477 rdev = rcu_dereference(conf->mirrors[disk].rdev);
478 478
479 if (!rdev || 479 if (!rdev ||
480 !rdev->in_sync || 480 !rdev->in_sync ||
@@ -496,7 +496,7 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio)
496 496
497 497
498 if (new_disk >= 0) { 498 if (new_disk >= 0) {
499 rdev = conf->mirrors[new_disk].rdev; 499 rdev = rcu_dereference(conf->mirrors[new_disk].rdev);
500 if (!rdev) 500 if (!rdev)
501 goto retry; 501 goto retry;
502 atomic_inc(&rdev->nr_pending); 502 atomic_inc(&rdev->nr_pending);
@@ -522,7 +522,7 @@ static void unplug_slaves(mddev_t *mddev)
522 522
523 rcu_read_lock(); 523 rcu_read_lock();
524 for (i=0; i<mddev->raid_disks; i++) { 524 for (i=0; i<mddev->raid_disks; i++) {
525 mdk_rdev_t *rdev = conf->mirrors[i].rdev; 525 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
526 if (rdev && !rdev->faulty && atomic_read(&rdev->nr_pending)) { 526 if (rdev && !rdev->faulty && atomic_read(&rdev->nr_pending)) {
527 request_queue_t *r_queue = bdev_get_queue(rdev->bdev); 527 request_queue_t *r_queue = bdev_get_queue(rdev->bdev);
528 528
@@ -556,7 +556,7 @@ static int raid1_issue_flush(request_queue_t *q, struct gendisk *disk,
556 556
557 rcu_read_lock(); 557 rcu_read_lock();
558 for (i=0; i<mddev->raid_disks && ret == 0; i++) { 558 for (i=0; i<mddev->raid_disks && ret == 0; i++) {
559 mdk_rdev_t *rdev = conf->mirrors[i].rdev; 559 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
560 if (rdev && !rdev->faulty) { 560 if (rdev && !rdev->faulty) {
561 struct block_device *bdev = rdev->bdev; 561 struct block_device *bdev = rdev->bdev;
562 request_queue_t *r_queue = bdev_get_queue(bdev); 562 request_queue_t *r_queue = bdev_get_queue(bdev);
@@ -728,7 +728,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
728#endif 728#endif
729 rcu_read_lock(); 729 rcu_read_lock();
730 for (i = 0; i < disks; i++) { 730 for (i = 0; i < disks; i++) {
731 if ((rdev=conf->mirrors[i].rdev) != NULL && 731 if ((rdev=rcu_dereference(conf->mirrors[i].rdev)) != NULL &&
732 !rdev->faulty) { 732 !rdev->faulty) {
733 atomic_inc(&rdev->nr_pending); 733 atomic_inc(&rdev->nr_pending);
734 if (rdev->faulty) { 734 if (rdev->faulty) {
@@ -954,7 +954,7 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
954 found = 1; 954 found = 1;
955 if (rdev->saved_raid_disk != mirror) 955 if (rdev->saved_raid_disk != mirror)
956 conf->fullsync = 1; 956 conf->fullsync = 1;
957 p->rdev = rdev; 957 rcu_assign_pointer(p->rdev, rdev);
958 break; 958 break;
959 } 959 }
960 960