From patchwork Fri Mar 1 09:56:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 208739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp974678dyb; Fri, 1 Mar 2024 02:05:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWFFctgjPh6WwtWCJpOXRTpxS7mEtXxUgX08L8BK72rwZfAJsawjgX7OyicD+3QP228r0NlNUUxtfMPKMLVOdVMGvVJoQ== X-Google-Smtp-Source: AGHT+IEtvCd8qptXtbh/0tIdP08vaMVHEbzcqg9k2Wb9UqYTRpe+UdpvB2uRFr5o4zvkZ3reyp82 X-Received: by 2002:a05:6102:18da:b0:470:3f14:b86 with SMTP id jj26-20020a05610218da00b004703f140b86mr886085vsb.11.1709287555729; Fri, 01 Mar 2024 02:05:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709287555; cv=pass; d=google.com; s=arc-20160816; b=BablzNtoe09Ndp7Vj+BIPm5AvOiZiXzhSZMWvBMWoQrfhd4Gj4Of1lJXGdqnAAoLBr qr3nAOl3oePUbHX3f1pdruw8XsaHX+Dx/al1UldY2msTQu1cfzhUmQ/wYJ5x+lN3RnK3 YDzOrRX/ObDShEwl2CIm4NNqcr9SnyVSOMVizpYk/NKu+E3qPy1MLmwXBW74Ret4RhzM WplqE2QmCpSZkKNdWIDShmss6uYIkRd60pYrX5GI7anVBm3HnwwzeoKBbHI2yxDmSbkI Q9B1qqMI/zhJ3UYENW5C1rqQMm8dD6QKdjCb909vuDNp7TIaxX7lYq8K3ZGesnmj7wxk pmQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xObqlGlhAKa1jLRcREsbIhKmj0Adee/KHvqXgnT0F/w=; fh=D0tHjPHp+NwWiP9dALgrUrDY+JdDylAJlTP6wFQuWjg=; b=mN50XdRsAv+zKc0k544dpDJ2BgEpKGSADs3UY/4NG2PUK/liEk5K/fcOzamxK9wZuW iaV5b2JwCLPX+OLlBXpwkB4Es738apHBqTemASoXwv0uPjlBcJVp9XfvYUIgMLrRBEZy kCnJxnS6eZeTevloWhv3uFggNk2Q6vHbm38jJjNKi3aUfkGpJznErqjoSP4Cf5dOT3/C lbn14+v/0kL0rEILaOPy2sFvWVJ9hheNwaYY0QzUr9QFqyDKMqsAlL/h6cy6CcwUIenA L33PO5FgnG/opPaCCPpYrABM6OdvkkWJkocvmOmM/VdwfMcWY4J+2BC8YIk9P7RPHxYz xykg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-88224-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88224-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y14-20020ac8708e000000b0042c74f61419si3077861qto.634.2024.03.01.02.05.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:05:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88224-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-88224-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88224-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 857C21C20E75 for ; Fri, 1 Mar 2024 10:05:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28C096F514; Fri, 1 Mar 2024 10:03:12 +0000 (UTC) Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9DFD6A8B9; Fri, 1 Mar 2024 10:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709287389; cv=none; b=cLkI2OdBTBA/85CYfld1S54LC2mVCgH4c1/DKK4g439kub5JlOJoX6lu9osw9wlHQS1WCR1sw4mDvvKa9AtD34ZIaFkpmUPrtEkUFAlQfEg7XUM4jEGR60PADsff+pIo429zJBGzsWY0GiEf+JHcT+C9tSCCj/fGWJN23gErstQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709287389; c=relaxed/simple; bh=u3t3DKW3x7GgosZFCclGCU3l8cfElCExYBTh1wR4y2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R0Rt166PLtPaBDUPYfI3qnFCyZDOKXVkNnxMnpYyK9KQDO+N60mj+QUJ3YH0D8aqXu5QvTBtViVghidzF06mtkBuV/8xDdOHL9OL//ulKuwLISJtiU77p0Fw2gkkOFpSCN35CJVWSe4kt03Xgl4XGPvOjpC4tDNXVOpDPZ3yQes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TmNv42xl4z4f3nbV; Fri, 1 Mar 2024 18:02:56 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id C278A1A07FA; Fri, 1 Mar 2024 18:03:03 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgCXaBHTp+FlqmBuFg--.36874S5; Fri, 01 Mar 2024 18:03:03 +0800 (CST) From: Yu Kuai To: zkabelac@redhat.com, xni@redhat.com, agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, dm-devel@lists.linux.dev, song@kernel.org, yukuai3@huawei.com, heinzm@redhat.com, neilb@suse.de, jbrassow@redhat.com Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next 1/9] md: don't clear MD_RECOVERY_FROZEN for new dm-raid until resume Date: Fri, 1 Mar 2024 17:56:49 +0800 Message-Id: <20240301095657.662111-2-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240301095657.662111-1-yukuai1@huaweicloud.com> References: <20240301095657.662111-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: cCh0CgCXaBHTp+FlqmBuFg--.36874S5 X-Coremail-Antispam: 1UD129KBjvJXoW7Zw4ktrW3uFy7uFyfZw1UJrb_yoW8Gr4Dpa n7Gr1S9rWkArWaka1Dta4q9ayYqa9xJrW0kry3u3y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X-GMAIL-THRID: 1792317908108687354 X-GMAIL-MSGID: 1792317908108687354 From: Yu Kuai After commit 9dbd1aa3a81c ("dm raid: add reshaping support to the target") raid_ctr() will set MD_RECOVERY_FROZEN before md_run() and expect to keep array frozen until resume. However, md_run() will clear the flag by setting mddev->recovery to 0. Before commit 1baae052cccd ("md: Don't ignore suspended array in md_check_recovery()"), dm-raid actually relied on suspending to prevent starting new sync_thread. Fix this problem by keeping 'MD_RECOVERY_FROZEN' for dm-raid in md_run(). Fixes: 1baae052cccd ("md: Don't ignore suspended array in md_check_recovery()") Fixes: 9dbd1aa3a81c ("dm raid: add reshaping support to the target") Signed-off-by: Yu Kuai --- drivers/md/md.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 3bd42d76e95f..7156e765d027 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6032,7 +6032,10 @@ int md_run(struct mddev *mddev) pr_warn("True protection against single-disk failure might be compromised.\n"); } - mddev->recovery = 0; + /* dm-raid expect sync_thread to be frozen until resume */ + if (mddev->gendisk) + mddev->recovery = 0; + /* may be over-ridden by personality */ mddev->resync_max_sectors = mddev->dev_sectors;