Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1405867rdb; Tue, 30 Jan 2024 18:51:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGT8mhhk+TuiBNOUvkloVSKpxTEOy2Db6QLYOj7qn8Roz74wOsL7zn/jL+BiRDJcZHXKzWJ X-Received: by 2002:a62:61c6:0:b0:6db:cd50:a716 with SMTP id v189-20020a6261c6000000b006dbcd50a716mr503332pfb.1.1706669517773; Tue, 30 Jan 2024 18:51:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706669517; cv=pass; d=google.com; s=arc-20160816; b=v2asDGfH7kWgpJ8NMHESXzwMGm1sAt0az9AqSbo56AQMINCLCSfi2H9x1yggKn9X3q lrXbv5vlPL1W/A51jlVAARxMnH8aMxhVHw4HR43zEEiDACoj2QPTJvmZXDr6x4UlQGav gp19MMyUh17REN3OLJst0oiB/aOTvUR1TuAszMBAN/syv/0G9NtlQ0VviMehHHTLfUTW ln1oCysuLsyCNeBJDGBKl2j8JSsem7Ud9c5kCopkSpKlJLTHQdsSrE/vEf+yWQpdtGHj R/d4hAV3KrMoxVrAlTTByoGPAql2QFW6dGrxnjDOmn+WYSpqs6CyqP05rig96W/Tvz8d u7qQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=6apk995mKZaVbL405iVGAWLP6yHtzLIfPfHEfQbxN74=; fh=sMHfiPUxBB5aY/zbI8X0b/ULrzY/cABvu1rgVjvnsQ0=; b=fo3u+3HE73J4pg6d78Mywu7zZkQmiVGcKVPKmT83A/cFwQnenQUf1x7W3WPa5qyRIo 7bSnXxGg3LHDyZXNAoVpFWptzBzNZh7N3FM6xERZg+Zjx1wK17LnvM9hnwhdNt00R8q1 +cRBgP2OOy8d1F2+WyBTy09pv/lWxXN/2HZ+XWYS13FZ9cQ6YYXzbkctlX6wfosXvOa3 paEYXVgEJUbRvvITsfW0iFqftsehZwoOZi9wxDvLnfisRNninC1JJdCkQEIhzBu/QqQU 7r3v7X5HLS0yuTbSlph4ei7o/PGnvEBsLT59covUWLHo62Rnf21zOLQmNZYbS1nnBEoK 1i/A==; 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-45692-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45692-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCX5Ni4uu45wR4DlTTw6GwFrasHK9nAcY5Q6gRCWDEkaQDfzGQ4TqvOkbQPVODsfxWQAcOmruyXHwsPs8tRyDL+Yr0CqyN//wsCH4/BoHg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y27-20020a637d1b000000b005cecb6a1027si8661910pgc.702.2024.01.30.18.51.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 18:51:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45692-linux.lists.archive=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-45692-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45692-linux.lists.archive=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 6E41D28E203 for ; Wed, 31 Jan 2024 02:51:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0E68FBF3; Wed, 31 Jan 2024 02:51:48 +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 0117DFBE7; Wed, 31 Jan 2024 02:51:44 +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=1706669508; cv=none; b=E6HxHcpiGg11wuba1b8PtPJvZgvyP3541yrFNACNAt7PvScJH3a3kyAFmxYEWvVl2R35NrO2L/2F3gp29y7Y1WgNf6BHgbp8kKvGHxVp9gAGypS8doWN33DltdJ6x7387MEPyQaCehlIMns7mc2cODgHmdJreR8BNgGoa5+ZTcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706669508; c=relaxed/simple; bh=LBJRaF3RGO3hVoNKd7CGkHEMK0mtNVjA3dEhYrl/3WU=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=iUD3b2fQpJrGCcritTzW2KE3aulaMzQaFqyxFjvwGT8nAgXQsG7pjdtCkfxseCZCaNDNqB7TrCPQvExEaXSa+rUZoK8Aer1YK8wuK1cEnfNGpZt9C2HzZIoDaYJsuVLdJVN4qhz5MFZA9r1c6OXS6gQRNBpFN8zkez5UJJbMMe0= 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 4TPmlB5Qqgz4f3lWJ; Wed, 31 Jan 2024 10:51:34 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 40D2D1A0232; Wed, 31 Jan 2024 10:51:41 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgBnOBG7tbllMKkHCg--.3626S3; Wed, 31 Jan 2024 10:51:40 +0800 (CST) Subject: Re: [PATCH v4 RFC 14/14] dm-raid: remove mddev_suspend/resume() To: Yu Kuai , mpatocka@redhat.com, heinzm@redhat.com, xni@redhat.com, agk@redhat.com, snitzer@kernel.org, dm-devel@lists.linux.dev, song@kernel.org, jbrassow@f14.redhat.com, neilb@suse.de, shli@fb.com, akpm@osdl.org Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20240130021843.3608859-1-yukuai1@huaweicloud.com> <20240130021843.3608859-15-yukuai1@huaweicloud.com> From: Yu Kuai Message-ID: <57ec6c2d-f5bb-10fc-39e8-097704daa96c@huaweicloud.com> Date: Wed, 31 Jan 2024 10:51:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240130021843.3608859-15-yukuai1@huaweicloud.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBnOBG7tbllMKkHCg--.3626S3 X-Coremail-Antispam: 1UD129KBjvJXoWxJFW3KF4DZF4kurW3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, ?? 2024/01/30 10:18, Yu Kuai ะด??: > From: Yu Kuai > > dm_suspend() already make sure that no new IO can be issued and will > wait for all dispatched IO to be done. There is no need to call > mddev_suspend() to make sure that again. > I'm about to send the final version(I hope), please let me know if anyone thinks this patch should not be included. Thanks, Kuai > Signed-off-by: Yu Kuai > --- > drivers/md/dm-raid.c | 8 +++----- > drivers/md/md.c | 11 +++++++++++ > 2 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c > index 5f78cc19d6f3..ed8c28952b14 100644 > --- a/drivers/md/dm-raid.c > +++ b/drivers/md/dm-raid.c > @@ -3241,7 +3241,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) > rs->md.in_sync = 1; > > /* Has to be held on running the array */ > - mddev_suspend_and_lock_nointr(&rs->md); > + mddev_lock_nointr(&rs->md); > > /* Keep array frozen until resume. */ > md_frozen_sync_thread(&rs->md); > @@ -3829,11 +3829,9 @@ static void raid_postsuspend(struct dm_target *ti) > { > struct raid_set *rs = ti->private; > > - if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) { > + if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) > /* Writes have to be stopped before suspending to avoid deadlocks. */ > md_stop_writes(&rs->md); > - mddev_suspend(&rs->md, false); > - } > } > > static void attempt_restore_of_faulty_devices(struct raid_set *rs) > @@ -4091,7 +4089,7 @@ static void raid_resume(struct dm_target *ti) > mddev->ro = 0; > mddev->in_sync = 0; > md_unfrozen_sync_thread(mddev); > - mddev_unlock_and_resume(mddev); > + mddev_unlock(mddev); > } > } > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 093abf3ce27b..e3a56a958b47 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -437,6 +437,10 @@ int mddev_suspend(struct mddev *mddev, bool interruptible) > { > int err = 0; > > + /* Array is supended from dm_suspend() for dm-raid. */ > + if (!mddev->gendisk) > + return 0; > + > /* > * hold reconfig_mutex to wait for normal io will deadlock, because > * other context can't update super_block, and normal io can rely on > @@ -488,6 +492,13 @@ EXPORT_SYMBOL_GPL(mddev_suspend); > > static void __mddev_resume(struct mddev *mddev, bool recovery_needed) > { > + /* > + * Array is supended from dm_suspend() and resumed from dm_resume() for > + * dm-raid. > + */ > + if (!mddev->gendisk) > + return; > + > lockdep_assert_not_held(&mddev->reconfig_mutex); > > mutex_lock(&mddev->suspend_mutex); >