From: Tomasz Majchrzak <tomasz.majchrzak@xxxxxxxxx> This patch has been added to the stable tree. If you have any objections, please let us know. =============== [ Upstream commit 9b622e2bbcf049c82e2550d35fb54ac205965f50 ] md pending write counter must be incremented after bio is split, otherwise it gets decremented too many times in end bio callback and becomes negative. Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@xxxxxxxxx> Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@xxxxxxxxx> Signed-off-by: Shaohua Li <shli@xxxxxx> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx> --- drivers/md/raid10.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 0ba6c358c6e0..4cbc3df79a2a 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1161,6 +1161,8 @@ static void __make_request(struct mddev *mddev, struct bio *bio) int max_sectors; int sectors; + md_write_start(mddev, bio); + /* * Register the new request and wait if the reconstruction * thread has put up a bar for new requests. @@ -1559,8 +1561,6 @@ static void make_request(struct mddev *mddev, struct bio *bio) return; } - md_write_start(mddev, bio); - do { /* -- 2.11.0