diff options
author | NeilBrown <neilb@suse.de> | 2006-12-10 05:20:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:57:21 -0500 |
commit | 1757128438d41670ded8bc3bc735325cc07dc8f9 (patch) | |
tree | e85679cbe949e337616ac53ab3b3fd1a3fa14a63 /drivers | |
parent | c2b00852fbae4f8c45c2651530ded3bd01bde814 (diff) |
[PATCH] md: assorted md and raid1 one-liners
Fix few bugs that meant that:
- superblocks weren't alway written at exactly the right time (this
could show up if the array was not written to - writting to the array
causes lots of superblock updates and so hides these errors).
- restarting device recovery after a clean shutdown (version-1 metadata
only) didn't work as intended (or at all).
1/ Ensure superblock is updated when a new device is added.
2/ Remove an inappropriate test on MD_RECOVERY_SYNC in md_do_sync.
The body of this if takes one of two branches depending on whether
MD_RECOVERY_SYNC is set, so testing it in the clause of the if
is wrong.
3/ Flag superblock for updating after a resync/recovery finishes.
4/ If we find the neeed to restart a recovery in the middle (version-1
metadata only) make sure a full recovery (not just as guided by
bitmaps) does get done.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/md.c | 3 | ||||
-rw-r--r-- | drivers/md/raid1.c | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 763ecab34813..21e2a7b08841 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3724,6 +3724,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
3724 | if (err) | 3724 | if (err) |
3725 | export_rdev(rdev); | 3725 | export_rdev(rdev); |
3726 | 3726 | ||
3727 | md_update_sb(mddev, 1); | ||
3727 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3728 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
3728 | md_wakeup_thread(mddev->thread); | 3729 | md_wakeup_thread(mddev->thread); |
3729 | return err; | 3730 | return err; |
@@ -5275,7 +5276,6 @@ void md_do_sync(mddev_t *mddev) | |||
5275 | mddev->pers->sync_request(mddev, max_sectors, &skipped, 1); | 5276 | mddev->pers->sync_request(mddev, max_sectors, &skipped, 1); |
5276 | 5277 | ||
5277 | if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && | 5278 | if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && |
5278 | test_bit(MD_RECOVERY_SYNC, &mddev->recovery) && | ||
5279 | !test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && | 5279 | !test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && |
5280 | mddev->curr_resync > 2) { | 5280 | mddev->curr_resync > 2) { |
5281 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { | 5281 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { |
@@ -5299,6 +5299,7 @@ void md_do_sync(mddev_t *mddev) | |||
5299 | rdev->recovery_offset = mddev->curr_resync; | 5299 | rdev->recovery_offset = mddev->curr_resync; |
5300 | } | 5300 | } |
5301 | } | 5301 | } |
5302 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | ||
5302 | 5303 | ||
5303 | skip: | 5304 | skip: |
5304 | mddev->curr_resync = 0; | 5305 | mddev->curr_resync = 0; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 656fae912fe3..b3c5e12f081d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1951,6 +1951,7 @@ static int run(mddev_t *mddev) | |||
1951 | !test_bit(In_sync, &disk->rdev->flags)) { | 1951 | !test_bit(In_sync, &disk->rdev->flags)) { |
1952 | disk->head_position = 0; | 1952 | disk->head_position = 0; |
1953 | mddev->degraded++; | 1953 | mddev->degraded++; |
1954 | conf->fullsync = 1; | ||
1954 | } | 1955 | } |
1955 | } | 1956 | } |
1956 | if (mddev->degraded == conf->raid_disks) { | 1957 | if (mddev->degraded == conf->raid_disks) { |