aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-09-19 14:01:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-09-19 14:01:38 -0400
commit4b92c17e1dc10b6fec44241228c695ef93b504ea (patch)
tree297120a780951c0f92cf2608f7ca5aaa1bab4f8c
parentc5c473e29c641380aef4a9d1f9c39de49219980f (diff)
parent6dafab6b1383e912cd252fa809570b484eb6e0dc (diff)
Merge tag 'md-3.6-fixes' of git://neil.brown.name/md
Pull md fixes from NeilBrown: "3 fixes for md in 3.6. One reverts a recent patch which turns out to not be such a good idea. Other two fix minor bugs with the new (since 3.3) 'replacement' code and have been tagged for -stable." * tag 'md-3.6-fixes' of git://neil.brown.name/md: md: make sure metadata is updated when spares are activated or removed. md/raid5: fix calculate of 'degraded' when a replacement becomes active. Revert "md/raid5: For odirect-write performance, do not set STRIPE_PREREAD_ACTIVE."
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/raid5.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 3f6203a4c7e..308e87b417e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7619,6 +7619,8 @@ static int remove_and_add_spares(struct mddev *mddev)
7619 } 7619 }
7620 } 7620 }
7621 } 7621 }
7622 if (removed)
7623 set_bit(MD_CHANGE_DEVS, &mddev->flags);
7622 return spares; 7624 return spares;
7623} 7625}
7624 7626
@@ -7632,9 +7634,11 @@ static void reap_sync_thread(struct mddev *mddev)
7632 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { 7634 !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
7633 /* success...*/ 7635 /* success...*/
7634 /* activate any spares */ 7636 /* activate any spares */
7635 if (mddev->pers->spare_active(mddev)) 7637 if (mddev->pers->spare_active(mddev)) {
7636 sysfs_notify(&mddev->kobj, NULL, 7638 sysfs_notify(&mddev->kobj, NULL,
7637 "degraded"); 7639 "degraded");
7640 set_bit(MD_CHANGE_DEVS, &mddev->flags);
7641 }
7638 } 7642 }
7639 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && 7643 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
7640 mddev->pers->finish_reshape) 7644 mddev->pers->finish_reshape)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index adda94df5eb..7031b865b3a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -393,6 +393,8 @@ static int calc_degraded(struct r5conf *conf)
393 degraded = 0; 393 degraded = 0;
394 for (i = 0; i < conf->previous_raid_disks; i++) { 394 for (i = 0; i < conf->previous_raid_disks; i++) {
395 struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); 395 struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev);
396 if (rdev && test_bit(Faulty, &rdev->flags))
397 rdev = rcu_dereference(conf->disks[i].replacement);
396 if (!rdev || test_bit(Faulty, &rdev->flags)) 398 if (!rdev || test_bit(Faulty, &rdev->flags))
397 degraded++; 399 degraded++;
398 else if (test_bit(In_sync, &rdev->flags)) 400 else if (test_bit(In_sync, &rdev->flags))
@@ -417,6 +419,8 @@ static int calc_degraded(struct r5conf *conf)
417 degraded2 = 0; 419 degraded2 = 0;
418 for (i = 0; i < conf->raid_disks; i++) { 420 for (i = 0; i < conf->raid_disks; i++) {
419 struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); 421 struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev);
422 if (rdev && test_bit(Faulty, &rdev->flags))
423 rdev = rcu_dereference(conf->disks[i].replacement);
420 if (!rdev || test_bit(Faulty, &rdev->flags)) 424 if (!rdev || test_bit(Faulty, &rdev->flags))
421 degraded2++; 425 degraded2++;
422 else if (test_bit(In_sync, &rdev->flags)) 426 else if (test_bit(In_sync, &rdev->flags))
@@ -4192,7 +4196,7 @@ static void make_request(struct mddev *mddev, struct bio * bi)
4192 finish_wait(&conf->wait_for_overlap, &w); 4196 finish_wait(&conf->wait_for_overlap, &w);
4193 set_bit(STRIPE_HANDLE, &sh->state); 4197 set_bit(STRIPE_HANDLE, &sh->state);
4194 clear_bit(STRIPE_DELAYED, &sh->state); 4198 clear_bit(STRIPE_DELAYED, &sh->state);
4195 if ((bi->bi_rw & REQ_NOIDLE) && 4199 if ((bi->bi_rw & REQ_SYNC) &&
4196 !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) 4200 !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
4197 atomic_inc(&conf->preread_active_stripes); 4201 atomic_inc(&conf->preread_active_stripes);
4198 release_stripe_plug(mddev, sh); 4202 release_stripe_plug(mddev, sh);