Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2047168iob; Fri, 20 May 2022 00:02:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWbrqTFTEPHGUMQgpPfT7cYtur1VNmClZdVj/QtGbJZOodLOhOrng/7XYAazZt0470boOz X-Received: by 2002:a05:6a00:24d2:b0:510:9f7a:3eec with SMTP id d18-20020a056a0024d200b005109f7a3eecmr8519430pfv.57.1653030146904; Fri, 20 May 2022 00:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653030146; cv=none; d=google.com; s=arc-20160816; b=u8rw2W8mbKQfRjsz98c+A1xmf0T7/TIF9pWXuoHro6lwLcUuX+soK102dbNBsgQICB ERKDfqJwtfIP/8Yvhx9tXumYps4S5Vq66qswNOwC4E+TDjXak4S5XbVeCwkf1UoIzV7v EZ4S4tqaZnoG8KIodz+c0v+GT1hpctuB0e9mpfheVAwzVqt2bxJHKHCQwFIo1rgdsKgc 2BgDlvSopvD+RGmpbmNBF7LhUzVVPg22CAcxzpv1lmwHE5j+CvKlyXRxwyV3/u3NQb6a W4x7XIALwXZGO/mYCPtfM07t+gFgXdKby+AcPkrUTFTFV8svUTkVs2xfX5mSNsKbLjp0 9tbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=5THCuTuhB9Pg9vg5D4m+VHayGZUEXqzPFCngvBnB6Js=; b=HIYHz0waPeNp/tsAE7S8cLLPfxsPf/NHvxDBuFSfKgjmXRkbUrXwrK9F8YRyq8PVXk 1qNyzNS3YThRCtdp9tGmfyNYJQeA66o/OfAntwWuFvVxaB6BwbPKPxd7Wh82XF0UahxY jXHxRzP/xYnsquHqp7xDtTMuV2gJUXZK8pesyXrIXObaFqJmC3558Zymkto2uUEg3u6C qYNGI1Ncc37E4DW1TWSTBmIFdrlJRXR5sCPLD7eZiviPgmeuwgeQ5vVwkMDoLEwa0C+1 gkRHHThy4zfLRXfAtaN/VGBLhEqRd48n3iGjGRaBJPCb8B9ArVcnRcNuXNZVRC6+nQUd y6ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=iCRYgfCv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a63ad46000000b003f5cfa3bbfdsi9541001pgo.233.2022.05.20.00.02.14; Fri, 20 May 2022 00:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=iCRYgfCv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244377AbiESTNl (ORCPT + 99 others); Thu, 19 May 2022 15:13:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243841AbiESTNZ (ORCPT ); Thu, 19 May 2022 15:13:25 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB14AF303; Thu, 19 May 2022 12:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=5THCuTuhB9Pg9vg5D4m+VHayGZUEXqzPFCngvBnB6Js=; b=iCRYgfCvxgb35jDAzhb0ZKLeUp eO9+zkTgEkWF90tHMsTZ3SBgCV66LRy5bKlFi1FvqFiAE7K1vlZE3qTtYq94VJ4ftf21eCXpSmKKy UV/ouRtTN+HCKxP/SKOAHHorYMV0Wj1B0/OUmQ6LxOnsSPoUCDXQd99OwtErGF3aPWKx5la7208Qk bTFK7l+5au4Vo30j3CpEqQ+DdmI8hS8LkOo9uBcvRpfpEAohN5/k8X8qLCV8cpB0TqtFas1D6zVjb cyjzb/3Q7/FYcd7V2N0u+dl0iJwJU+/2qoU0q4EJUniD7djBU9diTmIFVklNjlOSDrE2qgCWGBJCH OhaiEdsA==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nrlaI-002TqR-Vm; Thu, 19 May 2022 13:13:19 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1nrlaF-0004Tx-Td; Thu, 19 May 2022 13:13:16 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, Song Liu Cc: Christoph Hellwig , Guoqing Jiang , Xiao Ni , Stephen Bates , Martin Oliveira , David Sloan , Logan Gunthorpe Date: Thu, 19 May 2022 13:13:10 -0600 Message-Id: <20220519191311.17119-15-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220519191311.17119-1-logang@deltatee.com> References: <20220519191311.17119-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, song@kernel.org, hch@infradead.org, guoqing.jiang@linux.dev, xni@redhat.com, sbates@raithlin.com, Martin.Oliveira@eideticom.com, David.Sloan@eideticom.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH v1 14/15] md: Ensure resync is reported after it starts X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 07layouts test in mdadm fails on some systems. The failure presents itself as the backup file not being removed before the next layout is grown into: mdadm: /dev/md0: cannot create backup file /tmp/md-test-backup: File exists This is because the background mdadm process, which is responsible for cleaning up this backup file gets into an infinite loop waiting for the reshape to start. mdadm checks the mdstat file if a reshape is going and, if it is not, it waits for an event on the file or times out in 5 seconds. On faster machines, the reshape may complete before the 5 seconds times out, and thus the background mdadm process loops waiting for a reshape to start that has already occurred. mdadm reads the mdstat file to start, but mdstat does not report that the reshape has begun, even though it has indeed begun. So the mdstat_wait() call (in mdadm) which polls on the mdstat file won't ever return until timing out. The reason mdstat reports the reshape has started is due to an issue in status_resync(). recovery_active is subtracted from curr_resync which will result in a value of zero for the first chunk of reshaped data, and the resulting read will report no reshape in progress. To fix this, if "resync - recovery_active" is zero: force the value to be 4 so the code reports a resync in progress. Signed-off-by: Logan Gunthorpe --- drivers/md/md.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 8273ac5eef06..dbac63c8e35c 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8022,10 +8022,18 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev) if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) /* Still cleaning up */ resync = max_sectors; - } else if (resync > max_sectors) + } else if (resync > max_sectors) { resync = max_sectors; - else + } else { resync -= atomic_read(&mddev->recovery_active); + if (!resync) { + /* + * Resync has started, but if it's zero, ensure + * it is still reported, by forcing it to be 4 + */ + resync = 4; + } + } if (resync == 0) { if (test_bit(MD_RESYNCING_REMOTE, &mddev->recovery)) { -- 2.30.2