Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp998730rdb; Wed, 24 Jan 2024 01:23:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjr1Xrt3eLecWTfwNx4HVgWVEkOGzNks47N5nvjoG6Uyr0ihW/gXvJyBevNXH3jha+ClTM X-Received: by 2002:a2e:964b:0:b0:2ce:6dd:fedf with SMTP id z11-20020a2e964b000000b002ce06ddfedfmr658441ljh.57.1706088211532; Wed, 24 Jan 2024 01:23:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706088211; cv=pass; d=google.com; s=arc-20160816; b=IhAUXeAnSHXc0+esP+5w4No1HkLbdC2R6aWFE09J06k58mdU9LSmK42tqUBbUKB7Ju 4D0IYtO3vFxe2eRAdB+sTgeRPS0gmlTQC8sYZj9VpnU+cs7LYSOo4pWcyqcW/TezRQhW rrcrtT9MVBim5tAB3u3imVU1HGz1wOYQ2b7xZLubQBmWDj2HhSDKtz+74+nHcLg6jMBI v7/c8+XyTEhz2NDANom8SOFX4nZnzN7WndTyQ4rQPlfWuzXNHHXuYhdgGEJ/ISbVqHhZ hWiFGT+1dDRA8K9Qs7ljNq0qcjaZFBBZ997HwQiac6pxSOb3F+IEKbc+esplxY7eQ9LC N9Cw== 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=IzmW8Qf6Yuk0p9uVsWhKpdWH6bYLzUvv4zwHZcR3/fI=; fh=SaJ9rWjnsGFI+7ibUS2Ywr9D7BSRvW01ZC90UJpOFqs=; b=mqhN8VLAB0ie56j5D1EkrB4uRNzBPWQ/8bFWEHbO7ty8u7xTXVqE/BqORI0R/JQjTE y0A5MGDB4ew2/2og0Ys+JASrxThF7eqMmYLDQbMhUx6VRWMgFl+Eb+G+K6uo/aQwCJip 9UjoFG7/ZzuLUz08Xh+ZR4UYHBPxPBZ85D7BcavLjVfd3Y4cBgpWtEsEdPrJAFDWasZi uyD3YqaVAmIrf9CrGMwGPLGIbqzNevz3zcVNseIU2tx4CDR+qaLQ5rsSGLKsRuZpksT9 FCQpicWNkL+8qNtFs/Ll5BjK0HSm3MwpFOYtlvkbEyvHle+YaIPV8PEgl+2xboEkZOhm ERew== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-36702-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36702-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cn4-20020a0564020ca400b0055c00f52518si4149610edb.280.2024.01.24.01.23.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 01:23:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36702-linux.lists.archive=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=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-36702-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36702-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 7C2B81F21E4F for ; Wed, 24 Jan 2024 09:22:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 178E618646; Wed, 24 Jan 2024 09:21:07 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 0F09517C96; Wed, 24 Jan 2024 09:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706088066; cv=none; b=p2Qv9QLZUjFSSS+bYPfd5I+9iOZmEzn8rYFKgaP2kw588qeI912nF5obrWLcU6qU0HgS9jHp91tm2ZPtGBROrbwrrxs1+bC/KTfRrIWEYKwk+HwkJ604ifn4T8EZwFT4/Ati1Uh19b6ViHAoBmW+sGToLJ1zGtdjXNKTp1HA/IU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706088066; c=relaxed/simple; bh=fdBIcj3RbVlZfmB6uhAL7W8qOsSmbuWgs6wmgjCw6BI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gQ5VDzsPQ2N0ZSvXkYOZwrU8N+MwEFIQl9x0/ZbOLKsw5bW98hyiQsZJf+yYr/g1WUVZ63YIDVn6OHaPZj+uRR6pygpoIhPNy4zzln0A14DMlalOJKgJ0AsYJA5X3Ys2AYPVWeRo+IEm6PRUdthgg16dZ3aWR1H4PrYFvwcHs1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TKdhp3GlZz1xmdq; Wed, 24 Jan 2024 17:20:10 +0800 (CST) Received: from kwepemm600009.china.huawei.com (unknown [7.193.23.164]) by mail.maildlp.com (Postfix) with ESMTPS id CD0D41A0170; Wed, 24 Jan 2024 17:20:47 +0800 (CST) Received: from huawei.com (10.175.104.67) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 24 Jan 2024 17:18:26 +0800 From: Yu Kuai To: , , , , , , , , , , , CC: , , , , Subject: [PATCH v2 09/11] dm-raid: add a new helper prepare_suspend() in md_personality Date: Wed, 24 Jan 2024 17:14:19 +0800 Message-ID: <20240124091421.1261579-10-yukuai3@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240124091421.1261579-1-yukuai3@huawei.com> References: <20240124091421.1261579-1-yukuai3@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600009.china.huawei.com (7.193.23.164) There are no functional changes for now, prepare to fix a deadlock for dm-raid456. Signed-off-by: Yu Kuai --- drivers/md/dm-raid.c | 10 +++++++--- drivers/md/md.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index f1637cf88559..ede2e4574ee5 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3806,10 +3806,14 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits) static void raid_presuspend(struct dm_target *ti) { struct raid_set *rs = ti->private; + struct mddev *mddev = &rs->md; - mddev_lock_nointr(&rs->md); - md_frozen_sync_thread(&rs->md); - mddev_unlock(&rs->md); + mddev_lock_nointr(mddev); + md_frozen_sync_thread(mddev); + mddev_unlock(mddev); + + if (mddev->pers && mddev->pers->prepare_suspend) + mddev->pers->prepare_suspend(mddev); } static void raid_presuspend_undo(struct dm_target *ti) diff --git a/drivers/md/md.h b/drivers/md/md.h index 437ab70ce79b..29b476ff3b9f 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -617,6 +617,7 @@ struct md_personality int (*start_reshape) (struct mddev *mddev); void (*finish_reshape) (struct mddev *mddev); void (*update_reshape_pos) (struct mddev *mddev); + void (*prepare_suspend) (struct mddev *mddev); /* quiesce suspends or resumes internal processing. * 1 - stop new actions and wait for action io to complete * 0 - return to normal behaviour -- 2.39.2