]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.3/md-raid6-avoid-data-corruption-during-recovery-of-double-degraded-raid6.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.3 / md-raid6-avoid-data-corruption-during-recovery-of-double-degraded-raid6.patch
1 From 9c4bdf697c39805078392d5ddbbba5ae5680e0dd Mon Sep 17 00:00:00 2001
2 From: NeilBrown <neilb@suse.de>
3 Date: Wed, 13 Aug 2014 09:57:07 +1000
4 Subject: md/raid6: avoid data corruption during recovery of double-degraded RAID6
5
6 From: NeilBrown <neilb@suse.de>
7
8 commit 9c4bdf697c39805078392d5ddbbba5ae5680e0dd upstream.
9
10 During recovery of a double-degraded RAID6 it is possible for
11 some blocks not to be recovered properly, leading to corruption.
12
13 If a write happens to one block in a stripe that would be written to a
14 missing device, and at the same time that stripe is recovering data
15 to the other missing device, then that recovered data may not be written.
16
17 This patch skips, in the double-degraded case, an optimisation that is
18 only safe for single-degraded arrays.
19
20 Bug was introduced in 2.6.32 and fix is suitable for any kernel since
21 then. In an older kernel with separate handle_stripe5() and
22 handle_stripe6() functions the patch must change handle_stripe6().
23
24 Fixes: 6c0069c0ae9659e3a91b68eaed06a5c6c37f45c8
25 Cc: Yuri Tikhonov <yur@emcraft.com>
26 Cc: Dan Williams <dan.j.williams@intel.com>
27 Reported-by: "Manibalan P" <pmanibalan@amiindia.co.in>
28 Tested-by: "Manibalan P" <pmanibalan@amiindia.co.in>
29 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1090423
30 Signed-off-by: NeilBrown <neilb@suse.de>
31 Acked-by: Dan Williams <dan.j.williams@intel.com>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33
34 ---
35 drivers/md/raid5.c | 2 ++
36 1 file changed, 2 insertions(+)
37
38 --- a/drivers/md/raid5.c
39 +++ b/drivers/md/raid5.c
40 @@ -3817,6 +3817,8 @@ static void handle_stripe(struct stripe_
41 set_bit(R5_Wantwrite, &dev->flags);
42 if (prexor)
43 continue;
44 + if (s.failed > 1)
45 + continue;
46 if (!test_bit(R5_Insync, &dev->flags) ||
47 ((i == sh->pd_idx || i == sh->qd_idx) &&
48 s.failed == 0))