Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2156712ybm; Thu, 23 May 2019 12:17:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9xzLUibCwWIhB60NIXQ1H7gscs9kt78rzcVARyBGnHiYPRP5xBbrTRkEUP7mjuRHxpXc8 X-Received: by 2002:a63:78c6:: with SMTP id t189mr19156834pgc.293.1558639043614; Thu, 23 May 2019 12:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639043; cv=none; d=google.com; s=arc-20160816; b=CjUpMy3JAOfrjyxV7saOujSRaNDi/5UOkkLeNJh8geyWqIv3s8O998nGyZYNGPsYfm hvqkCwWNFnHACgnyeE0fMLWxifmJmTrtiu9Lwd5x4xNdmJKhubA/7FcIUj+sxgnPoP45 miN/SDG2OZsQdDcq+amF7/kiH9zWf85fUf16QShdOAtddQZUSjKKEqpHRgF22J2UyBg6 VIOYFq7JH593COhbPI75MzJPbqMLQ8jIbV4rnxH4XBMzA/VsQ0buYI7MprMKcjfq7Qms 384AKC9wuu0qVvB8WUVax0Fl5IxsIRTf23EZK9AZiMkkuzxZnAN4WR5uF8FGMUAHJe9B gEsw== 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=7Vx038xfSVzN1KEFmykdIdjnxcTDsxi145RMnBsGxug=; b=ufsNV0+rWPOkd83tgDXmrUrfqEAvkAK2egdpAmhvLypUlVTLEMtzdsDEA7Pet2rpXJ UKIUQ7xRAMI4kZMW/4Z3d/mpxhtT33X3N9jiQ9INGs4oKGOF11BsfAwN9+Q3oIvE3ie/ IsVcBlHdd63jLpLkZLYdCJPLuuBqV1r6UPaU/jAz3Gi3SgUQGIAAtjyfSnv8NwjvhmXq r2Z3adhc9TyFZxGZttPryDjicDbj2TEgzY0pgt0kdFPb3qNKzpxmHarlWTYXGr0AU2Av 4wtCvi4Qu5d7fF0MRimsGH88dsSLYwke3H08a6ELoFFBT4b0MkS41I8ausF3u9EPLt7g FboQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SwkIDl1N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v19si441612plo.413.2019.05.23.12.17.08; Thu, 23 May 2019 12:17:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SwkIDl1N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388727AbfEWTOS (ORCPT + 99 others); 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);