]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
md: fix bug with re-adding of partially recovered device.
authorNeilBrown <neilb@suse.de>
Thu, 9 Dec 2010 05:36:28 +0000 (16:36 +1100)
committerWilly Tarreau <w@1wt.eu>
Wed, 9 Feb 2011 21:15:36 +0000 (22:15 +0100)
commit69b74dfe7cc2022a2f2e0cf920f0c24e72c0d387
treec84dd5c64f787e31b8f0d025eb7f7afc0ef98f83
parent685c0cc45ed6d9a6289dee976eb6b9db4f05c5fe
md: fix bug with re-adding of partially recovered device.

commit 1a855a0606653d2d82506281e2c686bacb4b2f45 upstream.

With v0.90 metadata, a hot-spare does not become a full member of the
array until recovery is complete.  So if we re-add such a device to
the array, we know that all of it is as up-to-date as the event count
would suggest, and so it a bitmap-based recovery is possible.

However with v1.x metadata, the hot-spare immediately becomes a full
member of the array, but it record how much of the device has been
recovered.  If the array is stopped and re-assembled recovery starts
from this point.

When such a device is hot-added to an array we currently lose the 'how
much is recovered' information and incorrectly included it as a full
in-sync member (after bitmap-based fixup).
This is wrong and unsafe and could corrupt data.

So be more careful about setting saved_raid_disk - which is what
guides the re-adding of devices back into an array.
The new code matches the code in slot_store which does a similar
thing, which is encouraging.

This is suitable for any -stable kernel.

Reported-by: "Dailey, Nate" <Nate.Dailey@stratus.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/md/md.c