From: NeilBrown <neilb@suse.de>
Subject: Allow re-adding to a failed RAID10 array
Patch-mainline: not for a while I expect
References: bnc#750995

This patch is still under-development.

This allows a drive to be successfully recovered if there is no
in-sync device to read the data from from, providing that the
device was recently in-sync itself.
This isn't guaranteed to only allow data into the array that
genuinely was valid, but it allows user-space to re-integrate
a device that it has reason to believe was valid recently enough.


Signed-off-by: Neil Brown <neilb@suse.de>

---
 drivers/md/raid10.c |    8 ++++++++

--- linux-3.0-SLE11-SP2.orig/drivers/md/raid10.c
+++ linux-3.0-SLE11-SP2/drivers/md/raid10.c
@@ -2236,6 +2236,14 @@ static sector_t sync_request(mddev_t *md
 				if (rb2)
 					atomic_dec(&rb2->remaining);
 				r10_bio = rb2;
+				if (!conf->fullsync)
+					/* This device is a re-add, so it
+					 * might have fairly recent data -
+					 * better to keep it than discard
+					 * the whole array.
+					 */
+					continue;
+
 				if (!test_and_set_bit(MD_RECOVERY_INTR,
 						      &mddev->recovery))
 					printk(KERN_INFO "md/raid10:%s: insufficient "
