From patchwork Thu Feb 1 09:25:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 195226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp30960dyb; Thu, 1 Feb 2024 01:34:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6pajeuZ3BpUXZJPzYtqXgUGoN4KAjDBLxmWlk6oywlSMr+7GWKjWVluIF11lemqL2Cldq X-Received: by 2002:a17:90b:1052:b0:295:d2b5:699b with SMTP id gq18-20020a17090b105200b00295d2b5699bmr4282991pjb.9.1706780080800; Thu, 01 Feb 2024 01:34:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706780080; cv=pass; d=google.com; s=arc-20160816; b=xhXSP0L0d8ffCBUPlsKSFWFvlNs4qDFRU8sKjbiYJdmrAWgnyEGPuWJWTBYer2A4In onJ7TrxRVYeVJBeG1CHVJr2CvhJ+6u8j2Az1XKT7dSMLJiuGIEc61S4fDXRL/uTHiphn wkaxCNUXinc70lm8QiT+0AsbnqExC4BHyMpmxUZ9HUaGMno+BpTvRTfVQFeLBjo/wzR7 xsTjpSGUOBp72ZO2LqCFWGWWl2XEEwXCuhpEKXtfzZWepDHdI89qATeXC44l0g5XTEr/ Mzuxm2GzTCAJS3VskysL4oC1SxtbtUfnvyTdI/GtGwgaMN9XVwebP0vDchwW9pxW4Dqu nFVg== 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=YesPop8N4Nj1TL4Lwk2VerrSF3fxZ2OETwBiOABqBkU=; fh=IieR2OFhmSLEHpUsr659qE7y52NLE0XA7VruMDfsZN0=; b=0qwuG7qxfulID7rqg96Onxy4OJJd6pwND/tnWR/p0cQspVvJtouUEjNojZD3VZlfYL B+8tJzYl7gM0TW0u58ur18MQUCyIdAzbnvAYj7iYAzyrnfeRZS/fGW/uMDTe1mWgQY7g zTnPa43B50N4Tm80Ua21LeNB4CmltlBIS47zioL6KtHjR0VodwRB/+UKJPGhQzQo8/Hn VlxRsgfWhaUIYZBxbT7EVb3pfAyk6yItCHIiAftH6XXEt5v66CaRtgIPgYj2JLhmvqCJ gW1JUI14BA+09qc8bsSysSQxyi/wMsuUe0cx4tcpViG+K+XovRl1+xflpIL6VYjjgvC7 ttVA==; 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-47875-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47875-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWWTexQUovTlFxRk1MdEJSli18A9b4YjUBsG0296B/rpRrhWAtH/6hgCo/pxNZlFsdBorCTGAnE8ufPpf8jhwRuVPUXFA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z10-20020a17090acb0a00b0029065135790si3310336pjt.166.2024.02.01.01.34.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 01:34:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47875-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-47875-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47875-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AA9D3284972 for ; Thu, 1 Feb 2024 09:34:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C33CD163AB5; Thu, 1 Feb 2024 09:30:40 +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 39F5616086A; Thu, 1 Feb 2024 09:30:36 +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=1706779839; cv=none; b=IEVDQEiRHJG4FWFCTIFTA9Ia/c0OK9gZVQd91l4HPgqUtJv493pXcp9TQS6IjnKB1iZHRIhzM8W/soUlBS9XjXapTJnbcbS8xuVnCkCoOZirppq4a4FySXGUuDlqMu0V0hohM7burxxJALZYB+1ft6Lc+ne76nsCQOfdUYHisII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706779839; c=relaxed/simple; bh=y1m/wjQCy2MHnV2sXFZWtN+UQNGVqcl5T4H2E6C4AX0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cnMbKemnrT/EH5uI+RrCNJI+9LVjZ8GG4OuhWDZOU+szXWkK+FYqzaTN/LABkj0AA0ecxrhKB0CRFdO2bRxsZXLiNPcPn8N4LF3yFNqthY+20QxQ6DUhsW86y/agxF5RNEWT66/7Pr9+jdquqCvPimkgEQSy7yTWGDZBv4JOD2Q= 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 4TQYXz4GXNz4f3mJ6; Thu, 1 Feb 2024 17:30:27 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 22D6E1A0232; Thu, 1 Feb 2024 17:30:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgCXaBGtZLtl8V6KCg--.33515S15; Thu, 01 Feb 2024 17:30:33 +0800 (CST) From: Yu Kuai To: mpatocka@redhat.com, heinzm@redhat.com, xni@redhat.com, blazej.kucman@linux.intel.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 v5 11/14] dm-raid: add a new helper prepare_suspend() in md_personality Date: Thu, 1 Feb 2024 17:25:56 +0800 Message-Id: <20240201092559.910982-12-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201092559.910982-1-yukuai1@huaweicloud.com> References: <20240201092559.910982-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: cCh0CgCXaBGtZLtl8V6KCg--.33515S15 X-Coremail-Antispam: 1UD129KBjvJXoW7Kr47Kr4xtrykGw13uF4fGrg_yoW8Wr48p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trlr6x35dzhxuhorxvhhfrp/ X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789688629898779166 X-GMAIL-MSGID: 1789688629898779166 From: Yu Kuai 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 6b6c011d9f69..16d3348abfed 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 684cc866402a..8e81f9e2fb20 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -629,6 +629,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