md: allow a partially recovered device to be hot-added to an array.
authorNeilBrown <neilb@suse.de>
Tue, 14 Jan 2014 04:55:14 +0000 (15:55 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 14 Jan 2014 05:44:21 +0000 (16:44 +1100)
When adding a new device into an array it is normally important to
clear any stale data from ->recovery_offset else the new device may
not be recovered properly.

However when re-adding a device which is known to be nearly in-sync,
this is not needed and can be detrimental.  The (bitmap-based)
resync will still happen, and further recovery is only needed from
where-ever it was already up to.

So if save_raid_disk is set, signifying a re-add, don't clear
->recovery_offset.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index 539f08885e7fb2d85de65d25e558d4ba2678e30c..757e388308a8695da98a37d44127f1adb7f2159b 100644 (file)
@@ -7736,7 +7736,8 @@ static int remove_and_add_spares(struct mddev *mddev,
                       !test_bit(Bitmap_sync, &rdev->flags)))
                        continue;
 
-               rdev->recovery_offset = 0;
+               if (rdev->saved_raid_disk < 0)
+                       rdev->recovery_offset = 0;
                if (mddev->pers->
                    hot_add_disk(mddev, rdev) == 0) {
                        if (sysfs_link_rdev(mddev, rdev))