]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
md: assorted md and raid1 one-liners
authorNeil Brown <neilb@suse.de>
Wed, 22 Aug 2007 23:38:42 +0000 (01:38 +0200)
committerAdrian Bunk <bunk@stusta.de>
Wed, 22 Aug 2007 23:38:42 +0000 (01:38 +0200)
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: Adrian Bunk <bunk@kernel.org>
drivers/md/md.c
drivers/md/raid1.c

index 207e25667f410c0107cdfee9777a1566f32c924f..319b86fe25953ef107ec0bc19827eb1207050788 100644 (file)
@@ -3160,6 +3160,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
                if (err)
                        export_rdev(rdev);
 
+               md_update_sb(mddev);
                set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
                md_wakeup_thread(mddev->thread);
                return err;
@@ -4679,7 +4680,6 @@ static void md_do_sync(mddev_t *mddev)
        mddev->pers->sync_request(mddev, max_sectors, &skipped, 1);
 
        if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) &&
-           mddev->curr_resync > 2 &&
            mddev->curr_resync >= mddev->recovery_cp) {
                if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
                        printk(KERN_INFO 
index b8889200718b8507bb79f6352d3ca2432eded260..20dd22d3898f56226227a06ac7c0b203377a7905 100644 (file)
@@ -1898,6 +1898,7 @@ static int run(mddev_t *mddev)
                if (!disk->rdev) {
                        disk->head_position = 0;
                        mddev->degraded++;
+                       conf->fullsync = 1;
                }
        }