Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md/r5cache: fix set_syndrome_sources() for data in cache

Before this patch, device InJournal will be included in prexor
(SYNDROME_SRC_WANT_DRAIN) but not in reconstruct (SYNDROME_SRC_WRITTEN). So it
will break parity calculation. With srctype == SYNDROME_SRC_WRITTEN, we need
include both dev with non-null ->written and dev with R5_InJournal. This fixes
logic in 1e6d690(md/r5cache: caching phase of r5cache)

Cc: stable@vger.kernel.org (v4.10+)
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>

authored by

Song Liu and committed by
Shaohua Li
0977762f 13459213

+2 -1
+2 -1
drivers/md/raid5.c
··· 1401 1401 (test_bit(R5_Wantdrain, &dev->flags) || 1402 1402 test_bit(R5_InJournal, &dev->flags))) || 1403 1403 (srctype == SYNDROME_SRC_WRITTEN && 1404 - dev->written)) { 1404 + (dev->written || 1405 + test_bit(R5_InJournal, &dev->flags)))) { 1405 1406 if (test_bit(R5_InJournal, &dev->flags)) 1406 1407 srcs[slot] = sh->dev[i].orig_page; 1407 1408 else