diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 21:51:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 21:51:55 -0500 |
commit | c086ae4ed94f9a1d283318e006813268c2dbf9fc (patch) | |
tree | dbabbb09ddafcb818f32af038831419702574917 /drivers/md | |
parent | 7b67e751479d50b7f84d1a3cc5216eed5e534b66 (diff) | |
parent | 307729c8bc5b5a41361af8af95906eee7552acb1 (diff) |
Merge tag 'md-3.3-fixes' of git://neil.brown.name/md
Two bugfixes for md.
One is a recently introduced regression that affects an unusual
configuration with a guaranteed BUG_ON. Has been tagged for -stable.
The other is minor missing functionality.
* tag 'md-3.3-fixes' of git://neil.brown.name/md:
md/raid1: perform bad-block tests for WriteMostly devices too.
md: notify the 'degraded' sysfs attribute on failure.
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 6 | ||||
-rw-r--r-- | drivers/md/raid1.c | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index ca8527fe77eb..da52acb60f52 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7382,6 +7382,7 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
7382 | { | 7382 | { |
7383 | struct md_rdev *rdev; | 7383 | struct md_rdev *rdev; |
7384 | int spares = 0; | 7384 | int spares = 0; |
7385 | int removed = 0; | ||
7385 | 7386 | ||
7386 | mddev->curr_resync_completed = 0; | 7387 | mddev->curr_resync_completed = 0; |
7387 | 7388 | ||
@@ -7395,8 +7396,13 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
7395 | mddev, rdev) == 0) { | 7396 | mddev, rdev) == 0) { |
7396 | sysfs_unlink_rdev(mddev, rdev); | 7397 | sysfs_unlink_rdev(mddev, rdev); |
7397 | rdev->raid_disk = -1; | 7398 | rdev->raid_disk = -1; |
7399 | removed++; | ||
7398 | } | 7400 | } |
7399 | } | 7401 | } |
7402 | if (removed) | ||
7403 | sysfs_notify(&mddev->kobj, NULL, | ||
7404 | "degraded"); | ||
7405 | |||
7400 | 7406 | ||
7401 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 7407 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
7402 | if (rdev->raid_disk >= 0 && | 7408 | if (rdev->raid_disk >= 0 && |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index cc24f0cb7ee3..a368db2431a5 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -531,8 +531,17 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
531 | if (test_bit(WriteMostly, &rdev->flags)) { | 531 | if (test_bit(WriteMostly, &rdev->flags)) { |
532 | /* Don't balance among write-mostly, just | 532 | /* Don't balance among write-mostly, just |
533 | * use the first as a last resort */ | 533 | * use the first as a last resort */ |
534 | if (best_disk < 0) | 534 | if (best_disk < 0) { |
535 | if (is_badblock(rdev, this_sector, sectors, | ||
536 | &first_bad, &bad_sectors)) { | ||
537 | if (first_bad < this_sector) | ||
538 | /* Cannot use this */ | ||
539 | continue; | ||
540 | best_good_sectors = first_bad - this_sector; | ||
541 | } else | ||
542 | best_good_sectors = sectors; | ||
535 | best_disk = disk; | 543 | best_disk = disk; |
544 | } | ||
536 | continue; | 545 | continue; |
537 | } | 546 | } |
538 | /* This is a reasonable device to use. It might | 547 | /* This is a reasonable device to use. It might |