From: Guoqing Jiang Date: Wed, 27 Nov 2019 16:57:50 +0000 (+0100) Subject: raid5: need to set STRIPE_HANDLE for batch head X-Git-Tag: baikal/mips/sdk5.9~14713^2~2^2~2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=b7c246b50ee2dcc3160b1fb066a02bd398814337;p=kernel.git raid5: need to set STRIPE_HANDLE for batch head With commit 73772ed148edf966316d01447f02c821f84e386d ("raid5: don't set STRIPE_HANDLE to stripe which is in batch list"), we don't want to set STRIPE_HANDLE flag for sh which is already in batch list. However, the stripe which is the head of batch list should set this flag, otherwise panic could happen inside init_stripe at BUG_ON(sh->batch_head), it is reproducible with raid5 on top of nvdimm devices per Xiao oberserved. Thanks for Xiao's effort to verify the change. Fixes: 73772ed148edf ("raid5: don't set STRIPE_HANDLE to stripe which is in batch list") Reported-by: Xiao Ni Tested-by: Xiao Ni Signed-off-by: Guoqing Jiang Signed-off-by: Song Liu --- diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index f0fc538bfe597..d4d3b67ffbba7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5726,7 +5726,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) do_flush = false; } - if (!sh->batch_head) + if (!sh->batch_head || sh == sh->batch_head) set_bit(STRIPE_HANDLE, &sh->state); clear_bit(STRIPE_DELAYED, &sh->state); if ((!sh->batch_head || sh == sh->batch_head) &&