Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1200835pxa; Thu, 20 Aug 2020 05:29:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp9NhlPrCT1SgTC+Udd9PezZJkQ5Ao8h0JRGV9Li0TkjoOBM3IgIwlO8GTIfOguBPUeoGu X-Received: by 2002:a50:bf08:: with SMTP id f8mr2531231edk.207.1597926586884; Thu, 20 Aug 2020 05:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597926586; cv=none; d=google.com; s=arc-20160816; b=KynJ0LgDcNvQrb85l82WHxRRuemVeCP6+kaW1vHxRa6DxddVBJpk6P4JKFUK6OY0v9 PXE4bTeWHx5rM18WI4Jls7dawbhZwcpaBO17ubasBlB28K0NlpLyP9kDeSFPznayS9CT DFLpIa0gJ5ueGhGiJ1fYHFIOHffB1CzSwWnoCJnLoQRRzcUp+f2gOxOGIChnH0eIn0Gc DhBL+Alb8ZAlUbI0FU1D38uDaUeH7X6ucvHG0MgEyvzQ51tl1aHM1DlIXuf3/ptK+UVw /LK+2WlofYB0qaf9dDZk7LJs7y/HBn1EHCoRId6O9Hj2Ed3c9MvS1Zn7CCSni1tR6ipt H1Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9P/4dIDWM2ELj3VlaS1gbOlylsCUx7wH1zSFC5pDXVU=; b=CgkpJKxqXSz6RtVhIh5YwZb5YOgIB07BwKO4G0suAAHjLTqTh9Y29C2C1yQICa/sCE O9znJkVMTzt0Bs+dYx7nPGwrnrcI7mboazU7RGdnKoX5pFRUn7Vx7/6qAdINw4s3MIym 7Uj2u+b4+dNDoiiNuUL418RfjrzvOTTES+npBy8JfAQ43mi4UCdY4Y0n6xwzYBiJahGv gaI8tE5a1l/FxCbOgStkOgGy3C1lOPkzpdcDRM+oFi553vJZXOgllbWBQxq3cTlzDqmr C/WWe0zKVyDVd/n/E4z5kav7JpTSOKZUY6BmK8B7208i6nUqSd6D18R9yqu6TCqUkPTC XlWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=phu1p1+P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bh4si1193134ejb.629.2020.08.20.05.29.21; Thu, 20 Aug 2020 05:29:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=phu1p1+P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbgHTM0k (ORCPT + 99 others); Thu, 20 Aug 2020 08:26:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:34344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730009AbgHTJwt (ORCPT ); Thu, 20 Aug 2020 05:52:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 150572075E; Thu, 20 Aug 2020 09:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597917168; bh=lBNttqA3EORBs1vjmPPFPnFN6nVGZSBZZd8Eaj570Y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=phu1p1+P+6XJJUjrlqsTDdu+S4m8qWSdTvu16ydxQxh8/7+GsLLS9JpC5gPcZnHUM 2F8KjtjASdtKlHyb3kvw80w81d5+ovehE9wnIzlocU197zHjdG7+sFPZcGe0IUT3iD hPiph90EXrUPIb93oPZ9JjA+EOhAeh20hrNlrDFU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Wu , BingJing Chang , Danny Shih , ChangSyun Peng , Song Liu Subject: [PATCH 4.19 28/92] md/raid5: Fix Force reconstruct-write io stuck in degraded raid5 Date: Thu, 20 Aug 2020 11:21:13 +0200 Message-Id: <20200820091539.010171532@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091537.490965042@linuxfoundation.org> References: <20200820091537.490965042@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: ChangSyun Peng commit a1c6ae3d9f3dd6aa5981a332a6f700cf1c25edef upstream. 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: # v4.4+ Reviewed-by: Alex Wu Reviewed-by: BingJing Chang Reviewed-by: Danny Shih Signed-off-by: ChangSyun Peng Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3596,6 +3596,7 @@ static int need_this_block(struct stripe * is missing/faulty, then we need to read everything we can. */ if (sh->raid_conf->level != 6 && + sh->raid_conf->rmw_level != PARITY_DISABLE_RMW && sh->sector < sh->raid_conf->mddev->recovery_cp) /* reconstruct-write isn't being forced */ return 0; @@ -4832,7 +4833,7 @@ static void handle_stripe(struct stripe_ * or to load a block that is being partially written. */ if (s.to_read || s.non_overwrite - || (conf->level == 6 && s.to_write && s.failed) + || (s.to_write && s.failed) || (s.syncing && (s.uptodate + s.compute < disks)) || s.replacing || s.expanding)