summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuoqing Jiang <guoqing.jiang@cloud.ionos.com>2019-11-27 17:57:50 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-17 20:08:37 +0100
commit51952b3c0340bd101c9076fde1cd276e26510ebd (patch)
tree9c8ab7585198fb60bf02c30daf2ccbc54781a84b
parent9b025e3f91e1f132700394bfcc8a6962f941cf55 (diff)
downloadlinux-stable-51952b3c0340bd101c9076fde1cd276e26510ebd.tar.gz
linux-stable-51952b3c0340bd101c9076fde1cd276e26510ebd.tar.bz2
linux-stable-51952b3c0340bd101c9076fde1cd276e26510ebd.zip
raid5: need to set STRIPE_HANDLE for batch head
[ Upstream commit a7ede3d16808b8f3915c8572d783530a82b2f027 ] With commit 6ce220dd2f8ea71d6afc29b9a7524c12e39f374a ("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: 6ce220dd2f8ea ("raid5: don't set STRIPE_HANDLE to stripe which is in batch list") Reported-by: Xiao Ni <xni@redhat.com> Tested-by: Xiao Ni <xni@redhat.com> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/md/raid5.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7c18dfd343b4..3ffc1ae2fe72 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5721,7 +5721,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) &&