Skip to content

Commit a1c6ae3

Browse files
ChangSyun Pengliu-song-6
authored andcommitted
md/raid5: Fix Force reconstruct-write io stuck in degraded raid5
In degraded raid5, we need to read parity to do reconstruct-write when data disks fail. However, we can not read parity from handle_stripe_dirtying() in force reconstruct-write mode. Reproducible Steps: 1. Create degraded raid5 mdadm -C /dev/md2 --assume-clean -l5 -n3 /dev/sda2 /dev/sdb2 missing 2. Set rmw_level to 0 echo 0 > /sys/block/md2/md/rmw_level 3. IO to raid5 Now some io may be stuck in raid5. We can use handle_stripe_fill() to read the parity in this situation. Cc: <stable@vger.kernel.org> # v4.4+ Reviewed-by: Alex Wu <alexwu@synology.com> Reviewed-by: BingJing Chang <bingjingc@synology.com> Reviewed-by: Danny Shih <dannyshih@synology.com> Signed-off-by: ChangSyun Peng <allenpeng@synology.com> Signed-off-by: Song Liu <songliubraving@fb.com>
1 parent 3a31cf3 commit a1c6ae3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/md/raid5.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3626,6 +3626,7 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s,
36263626
* is missing/faulty, then we need to read everything we can.
36273627
*/
36283628
if (sh->raid_conf->level != 6 &&
3629+
sh->raid_conf->rmw_level != PARITY_DISABLE_RMW &&
36293630
sh->sector < sh->raid_conf->mddev->recovery_cp)
36303631
/* reconstruct-write isn't being forced */
36313632
return 0;
@@ -4862,7 +4863,7 @@ static void handle_stripe(struct stripe_head *sh)
48624863
* or to load a block that is being partially written.
48634864
*/
48644865
if (s.to_read || s.non_overwrite
4865-
|| (conf->level == 6 && s.to_write && s.failed)
4866+
|| (s.to_write && s.failed)
48664867
|| (s.syncing && (s.uptodate + s.compute < disks))
48674868
|| s.replacing
48684869
|| s.expanding)

0 commit comments

Comments
 (0)