From patchwork Thu Aug 20 09:18:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 265269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 692F7C433DF for ; Thu, 20 Aug 2020 13:49:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BC602076E for ; Thu, 20 Aug 2020 13:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597931363; bh=xYZFrxz2rOk+HHlaipfAhKHpLbGhnQdZtYRZaRvmBy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=m+VmFuThN9xiqmTfoettuQWN767TNIRxE6zxDsIIMwPc5YR0WcZUgWzIec7FaRb55 Uq7moUB8+32wyb0zjO9nDHbcq5SFKM62Dcp63oOAnGtqlk2aEmMbdE9HU5s494U5XT +hDHm8hkD23P8sBATkXr+rKF245QFM6USULsOmSs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728727AbgHTNjC (ORCPT ); Thu, 20 Aug 2020 09:39:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:37548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726956AbgHTJ1s (ORCPT ); Thu, 20 Aug 2020 05:27:48 -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 D3A2222D08; Thu, 20 Aug 2020 09:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915668; bh=xYZFrxz2rOk+HHlaipfAhKHpLbGhnQdZtYRZaRvmBy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9dvpcPMgfBvApVeX0edlxCJAY5X/7Nh6kMNCRIG+nntcRJA+SFbRLuICxTUH5snd OEXJId7Kzsj6IovOuFI9Zms7W7GRX+YlmHl4ZWMgK5AjgGxowf6Q0pcyG5hbS47oU5 eAAFv349s32YS+qIOpogL1n9w6bQDR9VelNKZxV8= 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 5.8 064/232] md/raid5: Fix Force reconstruct-write io stuck in degraded raid5 Date: Thu, 20 Aug 2020 11:18:35 +0200 Message-Id: <20200820091615.894873996@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -3607,6 +3607,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; @@ -4842,7 +4843,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)