Message ID | 20240130021843.3608859-11-yukuai1@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-43815-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp964653dyb; Mon, 29 Jan 2024 18:52:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IE138v7ysX64BuNHX2uhHTKTBDwfNBTestXP+7SR+M2r4hNkpD8Vm8zr8RumCIUh5gSFVIt X-Received: by 2002:a17:907:a587:b0:a35:278:1c23 with SMTP id vs7-20020a170907a58700b00a3502781c23mr333841ejc.35.1706583164035; Mon, 29 Jan 2024 18:52:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706583164; cv=pass; d=google.com; s=arc-20160816; b=oWZvZ2aLK8aXb8Q7L9C8vYTcuunC0RnXX+GKjgyqtl8OXk1FoY3UxFKcBIVReMAynt yp4EpA+7Px391IX3KKxqXXLLll7CI2qhFgKME9hM9mzWXps1w3VAkt6//+U7ExPOzCqn zEyQGOFksCzyAxZU1XoLC7v60DZWYx13tYH2XoZ0S/AxIMuf7nCMO0uPA27teZeiK3UF ftsxesArC3JrDgzHDKis6RnyWUxORnZQUvdFyhqVZpQSyk8bqzMfftNawQI8SeJiTdoY QDBP2D2SnJfoueuQjQHdpenoPPL6sdGfNoDpU4ICn4nPZ3AqGdvulw15yEJo44yELXMW aTDg== 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=2fF99IaCNquBgHf7hcoZW47islH522Eb0h4ofbbUL7I=; fh=FtirvJJ13L8gehLQ375a0lCTkAroffAi0JfnF40Fa78=; b=MRILDMwLE3lsuIo3FKS0GqaDVCb2Q7QLA+hfG8pPqqqy48yHI09MV3zdcOLhjnul5p IThsYw9b9dkhc69m4H/ksr0OfmnhaFjXNlhXY9007K1S2QQETo8hbBA8PcBUw+oBsL4r iZ3ip/EZ5lyalPt9rI12fZuPNh8kDpGCvfB7mZt3H/jzHOsJudMO1ZTDuOfe4AAIJzoH MrY7Zg+RoSIvG4tc8I5kMUhgssXDvdnob7r7QB1c0v06V6nYiLWiCIblM1QKfrQ5B1A3 DZTuySmkYZygPXJeZwwwSIfrYNt1m+VdQZhDmxzWJVGjoW5S/rs/KjAnkVeGgC+yzYNk WLEQ== 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-43815-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43815-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r14-20020a170906350e00b00a3605794828si518211eja.125.2024.01.29.18.52.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 18:52:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43815-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-43815-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43815-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 021A01F27858 for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 02:27:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11C7015AAB1; Tue, 30 Jan 2024 02:23:15 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [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 C2A97364D2; Tue, 30 Jan 2024 02:23:10 +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=1706581392; cv=none; b=gFGZOjacjQDm2B7biD3RIdlZiS3JpT37ADfWqphHp43IgjTZF0n/HPzvH8ccd7uk2TRPLjhDAchtusiX7lVuEWjeL7swl26rISdzgIn8ZniMj6/THhr6h1geh5XYm2aedCzXFKT5WUWawkBCXzcJyGXN7lheDMbyjZ0S/8lqUx4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706581392; c=relaxed/simple; bh=6YDQmrYqLiTMI1nBqXhhAgN5M0sQ1yDoPL9hqgOUqgk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SgzKMzdo4I1daiBAK7NbIQCNCE15QtZSCQFZRmetZhEFEoB+1H4SyZlLw0hj3HmqtnIzmxy0KJ2MmCB3D8Pv+7NnypvkjnpZ4pwzYy9I7EpBXys+YpAiQbbHAGMKumj7H3j2Yvch2VDXFYn8j7zuVB4K2bb54d1R3txeUNEjcTM= 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.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TP88j2RTTz4f3m6y; Tue, 30 Jan 2024 10:23:01 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id C90E31A01E9; Tue, 30 Jan 2024 10:23:07 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBHGBGBXbhlrAigCQ--.55484S14; Tue, 30 Jan 2024 10:23:07 +0800 (CST) From: Yu Kuai <yukuai1@huaweicloud.com> To: mpatocka@redhat.com, heinzm@redhat.com, xni@redhat.com, agk@redhat.com, snitzer@kernel.org, dm-devel@lists.linux.dev, song@kernel.org, yukuai3@huawei.com, jbrassow@f14.redhat.com, neilb@suse.de, shli@fb.com, akpm@osdl.org Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH v4 10/14] md: don't suspend the array for interrupted reshape Date: Tue, 30 Jan 2024 10:18:39 +0800 Message-Id: <20240130021843.3608859-11-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130021843.3608859-1-yukuai1@huaweicloud.com> References: <20240130021843.3608859-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgBHGBGBXbhlrAigCQ--.55484S14 X-Coremail-Antispam: 1UD129KBjvJXoW7uF1fuFy3ZFWkArykCr17Jrb_yoW8ur13p3 yakF1ayrs8X39IvayUG3Z7KFyFk3s5trWYy3srG34UAw13Gr1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THRID: 1789482147841023690 X-GMAIL-MSGID: 1789482147841023690 |
Series |
dm-raid: fix v6.7 regressions
|
|
Commit Message
Yu Kuai
Jan. 30, 2024, 2:18 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com> md_start_sync() will suspend the array if there are spares that can be added or removed from conf, however, if reshape is still in progress, this won't happen at all or data will be corrupted(remove_and_add_spares won't be called from md_choose_sync_action for reshape), hence there is no need to suspend the array if reshape is not done yet. Meanwhile, there is a potential deadlock for raid456: 1) reshape is interrupted; 2) set one of the disk WantReplacement, and add a new disk to the array, however, recovery won't start until the reshape is finished; 3) then issue an IO across reshpae position, this IO will wait for reshape to make progress; 4) continue to reshape, then md_start_sync() found there is a spare disk that can be added to conf, mddev_suspend() is called; Step 4 and step 3 is waiting for each other, deadlock triggered. Noted this problem is found by code review, and it's not reporduced yet. Fix this porblem by don't suspend the array for interrupted reshape, this is safe because conf won't be changed until reshape is done. Fixes: bc08041b32ab ("md: suspend array in md_start_sync() if array need reconfiguration") Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- drivers/md/md.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c index b942cc126ce0..093abf3ce27b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9391,12 +9391,17 @@ static void md_start_sync(struct work_struct *ws) bool suspend = false; char *name; - if (md_spares_need_change(mddev)) + /* + * If reshape is still in progress, spares won't be added or removed + * from conf until reshape is done. + */ + if (mddev->reshape_position == MaxSector && + md_spares_need_change(mddev)) { suspend = true; + mddev_suspend(mddev, false); + } - suspend ? mddev_suspend_and_lock_nointr(mddev) : - mddev_lock_nointr(mddev); - + mddev_lock_nointr(mddev); if (!md_is_rdwr(mddev)) { /* * On a read-only array we can: