From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,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 621BAC282DD for ; Thu, 23 May 2019 19:14:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25DDD20863 for ; Thu, 23 May 2019 19:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558638859; bh=yAuVqjRgjW6xn6vI8RLO4YCZ8n4X7jLMhWHxvFEjw5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nHXuZZiYJMxGHLg9+ylGng4roxgCFVQqdQzv5kkMZxNRhYCv1kbOABb01Aa0/N7EI nl9EfK+TlzlyKBufdI/7BLycgIks+OdLC9j8fX9H+FDcKVoSyiI01mjUc+Iiryk1ut 2HOhD4tzG2AFDFUlCRglGd60CLxKl/HSYZUqafG8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388215AbfEWTOS (ORCPT ); Thu, 23 May 2019 15:14:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:48208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388698AbfEWTOP (ORCPT ); Thu, 23 May 2019 15:14:15 -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 493F421855; Thu, 23 May 2019 19:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558638854; bh=yAuVqjRgjW6xn6vI8RLO4YCZ8n4X7jLMhWHxvFEjw5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SwkIDl1NJg0lCqftX1gfTvaqt9wyf1UPpy2vyNOCTM7vxXeh1diqy/7Xglqc+YReh ag/H0AoFo17zYfZnMBCMIFZ3LMb0PP533mCCb7kl5zthyj673YlWmnhr8DM5mFfBID koeEIkWvQ0l8ps4RGea2NpObFfA3eQiHKjoZSfQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Williams , Nigel Croxon , Song Liu Subject: [PATCH 4.14 73/77] md/raid: raid5 preserve the writeback action after the parity check Date: Thu, 23 May 2019 21:06:31 +0200 Message-Id: <20190523181730.064636896@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181719.982121681@linuxfoundation.org> References: <20190523181719.982121681@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: Nigel Croxon commit b2176a1dfb518d870ee073445d27055fea64dfb8 upstream. The problem is that any 'uptodate' vs 'disks' check is not precise in this path. Put a "WARN_ON(!test_bit(R5_UPTODATE, &dev->flags)" on the device that might try to kick off writes and then skip the action. Better to prevent the raid driver from taking unexpected action *and* keep the system alive vs killing the machine with BUG_ON. Note: fixed warning reported by kbuild test robot Signed-off-by: Dan Williams Signed-off-by: Nigel Croxon Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid5.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4182,7 +4182,7 @@ static void handle_parity_checks6(struct /* now write out any block on a failed drive, * or P or Q if they were recomputed */ - BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */ + dev = NULL; if (s->failed == 2) { dev = &sh->dev[s->failed_num[1]]; s->locked++; @@ -4207,6 +4207,14 @@ static void handle_parity_checks6(struct set_bit(R5_LOCKED, &dev->flags); set_bit(R5_Wantwrite, &dev->flags); } + if (WARN_ONCE(dev && !test_bit(R5_UPTODATE, &dev->flags), + "%s: disk%td not up to date\n", + mdname(conf->mddev), + dev - (struct r5dev *) &sh->dev)) { + clear_bit(R5_LOCKED, &dev->flags); + clear_bit(R5_Wantwrite, &dev->flags); + s->locked--; + } clear_bit(STRIPE_DEGRADED, &sh->state); set_bit(STRIPE_INSYNC, &sh->state);