Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-11-01 14:04:41 +1100
committerNeilBrown <neilb@suse.com>2018-11-01 14:05:47 +1100
commit5a4280cd2230ea0265839de0cc9ca2924a234078 (patch)
tree61a3b45cf8eff252891d717de0912d6b36e957b0
parent75eb38a04c70bcf43357536c8b868adc8eaf26c6 (diff)
md/raid10: fix that replacement cannot complete recovery after
reassemble (git-fixes).
-rw-r--r--patches.fixes/md-raid10-fix-that-replacement-cannot-complete-recov.patch53
-rw-r--r--series.conf1
2 files changed, 54 insertions, 0 deletions
diff --git a/patches.fixes/md-raid10-fix-that-replacement-cannot-complete-recov.patch b/patches.fixes/md-raid10-fix-that-replacement-cannot-complete-recov.patch
new file mode 100644
index 0000000000..a064e6228e
--- /dev/null
+++ b/patches.fixes/md-raid10-fix-that-replacement-cannot-complete-recov.patch
@@ -0,0 +1,53 @@
+From: BingJing Chang <bingjingc@synology.com>
+Date: Thu, 28 Jun 2018 18:40:11 +0800
+Subject: [PATCH] md/raid10: fix that replacement cannot complete recovery
+ after reassemble
+Git-commit: bda3153998f3eb2cafa4a6311971143628eacdbc
+Patch-mainline: v4.18
+References: git-fixes
+
+During assemble, the spare marked for replacement is not checked.
+conf->fullsync cannot be updated to be 1. As a result, recovery will
+treat it as a clean array. All recovering sectors are skipped. Original
+device is replaced with the not-recovered spare.
+
+mdadm -C /dev/md0 -l10 -n4 -pn2 /dev/loop[0123]
+mdadm /dev/md0 -a /dev/loop4
+mdadm /dev/md0 --replace /dev/loop0
+mdadm -S /dev/md0 # stop array during recovery
+
+mdadm -A /dev/md0 /dev/loop[01234]
+
+After reassemble, you can see recovery go on, but it completes
+immediately. In fact, recovery is not actually processed.
+
+To solve this problem, we just add the missing logics for replacment
+spares. (In raid1.c or raid5.c, they have already been checked.)
+
+Reported-by: Alex Chen <alexchen@synology.com>
+Reviewed-by: Alex Wu <alexwu@synology.com>
+Reviewed-by: Chung-Chiang Cheng <cccheng@synology.com>
+Signed-off-by: BingJing Chang <bingjingc@synology.com>
+Signed-off-by: Shaohua Li <shli@fb.com>
+Acked-by: NeilBrown <neilb@suse.com>
+
+---
+ drivers/md/raid10.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/md/raid10.c
++++ b/drivers/md/raid10.c
+@@ -3926,6 +3926,13 @@ static int raid10_run(struct mddev *mdde
+ disk->rdev->saved_raid_disk < 0)
+ conf->fullsync = 1;
+ }
++
++ if (disk->replacement &&
++ !test_bit(In_sync, &disk->replacement->flags) &&
++ disk->replacement->saved_raid_disk < 0) {
++ conf->fullsync = 1;
++ }
++
+ disk->recovery_disabled = mddev->recovery_disabled - 1;
+ }
+
diff --git a/series.conf b/series.conf
index 1f3637588a..eaa6215c84 100644
--- a/series.conf
+++ b/series.conf
@@ -16869,6 +16869,7 @@
patches.drivers/qed-Fix-setting-of-incorrect-eswitch-mode.patch
patches.drivers/qed-Fix-use-of-incorrect-size-in-memcpy-call.patch
patches.drivers/qede-Adverstise-software-timestamp-caps-when-PHC-is-.patch
+ patches.fixes/md-raid10-fix-that-replacement-cannot-complete-recov.patch
patches.suse/userfaultfd-hugetlbfs-fix-userfaultfd_huge_must_wait-pte-access.patch
patches.fixes/Fix-up-non-directory-creation-in-SGID-directories.patch
patches.drivers/0001-drm-udl-fix-display-corruption-of-the-last-line.patch