Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1544079rdb; Wed, 20 Sep 2023 12:06:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHbezC6yHoG3S6FCYmRvDsYiUX2BDjNuizuYFgpHEgVeZ87b6k5xJ51CEKrGwtCtUz5pNu X-Received: by 2002:a05:6a20:1612:b0:159:c918:1016 with SMTP id l18-20020a056a20161200b00159c9181016mr4062421pzj.49.1695236809858; Wed, 20 Sep 2023 12:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695236809; cv=none; d=google.com; s=arc-20160816; b=VlRDPbgn06IWfN3jciJ6VR/rGybu/ZC5LwYoWKVMHf4E9INHZ1Mhp/SE6fZ8KrmlbF 4cQpCV0JN1i4OJn5AP/J/PVbAlCjiVfJgJF76AlcTY8D058kZT5MnnZbZpIgUNV8PC6V JbPHD5WUASzUYaYr9pMd6qPrYfcQG7lAOI5bR/gx8+ch/zmpf+Vy3s91V9//vP+k7GZ2 m1g0O9xIGlDhGKKwiM+xanggsFvIieiR2EADg143w9dZ10w25QUVeaJyfOZeYV/EboaW kHDffdIWwxKZ4TiQlCy67krprIZio8gaN6me28aedQfXwqiZesQBJtWgazpKn2qPIIrp dy1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=14VM4X1q7LDh2tjcesU2z1sSQLPjnF+BKTQYi/I+DZ8=; fh=3AFgu7o3QvEmI/+AtqtfwQ060gFZ/ifEv3zg2LNrUA8=; b=pJc6a0IQbihq6mMD/YftkiERP7DvK3y9krwkpU40SYg1RcaVJYxvbZwnpSsHOlZ3Au 5nbyi+I3UDeB3yqjRlod5Cgbm+PhcV7TKR5jLzvs7Szoldr+noc6IbOr7OJUBhvKqesk Tmfo0dT50FCAYLTdpq3PiDqw6LwORruFv2E19fbC1cdPcVetim/ApllaImKuQHOOefX1 p4AxT0RScq1mPC67tojRdrE2g5Z2wmcA5efOi2B01lv7NycoatS5rkoDU5Fe4jijagSs kAJfnS4u6x3l19vLzhwxdKfFFyFh5FnnAz94hSsGl09CdVDadfQlfxVzKJX7xEAkrBy6 0zTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EOYkS4Fk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id 63-20020a630042000000b0056534e3aeeasi12467977pga.474.2023.09.20.12.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 12:06:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EOYkS4Fk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1DE5181F964D; Wed, 20 Sep 2023 01:47:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233681AbjITIrq (ORCPT + 99 others); Wed, 20 Sep 2023 04:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233658AbjITIro (ORCPT ); Wed, 20 Sep 2023 04:47:44 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA0394 for ; Wed, 20 Sep 2023 01:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695199618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14VM4X1q7LDh2tjcesU2z1sSQLPjnF+BKTQYi/I+DZ8=; b=EOYkS4Fkd4S8ndG572pTnkIWIkCA1gluOoQmofcRBgzScrXO2Uo/wq1ciw+UOJlsOSSipO 3NZpLZYRVSqFKkjD+X2apdKnmvSZuZBiHgHMMo9LGyiC4Ks95KD7+nMoW+BgVBrW4zegMM wA1KQxAhN54cfTGBWD+kMU5HLvybjws= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-aQPWEdtqMQuKyUd2VL68Iw-1; Wed, 20 Sep 2023 04:46:56 -0400 X-MC-Unique: aQPWEdtqMQuKyUd2VL68Iw-1 Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-690c2fec489so1602651b3a.2 for ; Wed, 20 Sep 2023 01:46:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695199615; x=1695804415; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=14VM4X1q7LDh2tjcesU2z1sSQLPjnF+BKTQYi/I+DZ8=; b=Q2UiG15YD7k1omwAJBM4kHuPiOPd7WlGqvUF6r4cFlBlQuH7x8UI1XzZw0siddFdqI YZBc7Ka8CJj9ySzD3gUKOD2XFNwtZQmsCFbO9IV8nj9/2bRjBIe3a2pYRrH+njqSGRlB P6zC9fMfnpzlYovvXud1XRctMLekhtdEeyETS/RLkaWSydCk0EQk6KyicwsYx6d4ackE 0uMa+92EIxXZd4yUUaiClm0Xw1MBzDA1BdwordrUav7IGYf0hfA/JwEnlxpY7uBWBGCS 2S6gy8CH3/K6pOHWflErEiwGejP9bPba1nkZ/yWJMXF2t5lf85x32ntqX2IxXdthrjSd QQ1Q== X-Gm-Message-State: AOJu0YwvvqtlOVfa645sJ9O5+ERZSyfADpiKKovmGxg8DnywTJaADMiA WpAPh+968hOH9Y0f85Hg6qNh02UvLkQ9wHVC0wb7DA4ldDDNmS/zVxS/BVfyBxicTpSIkYsDMGb 1OXJAOAlsD2s4RfEPxu5WC0ou/Hhtk8g7gMzJwUb1 X-Received: by 2002:a05:6a20:7f9d:b0:13d:df16:cf29 with SMTP id d29-20020a056a207f9d00b0013ddf16cf29mr2570689pzj.15.1695199614998; Wed, 20 Sep 2023 01:46:54 -0700 (PDT) X-Received: by 2002:a05:6a20:7f9d:b0:13d:df16:cf29 with SMTP id d29-20020a056a207f9d00b0013ddf16cf29mr2570673pzj.15.1695199614768; Wed, 20 Sep 2023 01:46:54 -0700 (PDT) MIME-Version: 1.0 References: <20230828020021.2489641-1-yukuai1@huaweicloud.com> <20230828020021.2489641-3-yukuai1@huaweicloud.com> In-Reply-To: <20230828020021.2489641-3-yukuai1@huaweicloud.com> From: Xiao Ni Date: Wed, 20 Sep 2023 16:46:42 +0800 Message-ID: Subject: Re: [PATCH -next v2 02/28] md: use 'mddev->suspended' for is_md_suspended() To: Yu Kuai Cc: agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, song@kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 20 Sep 2023 01:47:51 -0700 (PDT) On Mon, Aug 28, 2023 at 10:04=E2=80=AFAM Yu Kuai = wrote: > > From: Yu Kuai > > 'pers->prepare_suspend' is introduced to prevent a deadlock for raid456, > this change prepares to clean this up in later patches while refactoring > mddev_suspend(). Specifically allow reshape to make progress while > waiting for 'active_io' to be 0. Hi Kuai From my side, I can't understand the comments. The change has relationship with pers->prepare_suspend? And why this change can affect reshape? If this change indeed can affect these two things, can you explain more? > > Signed-off-by: Yu Kuai > --- > drivers/md/md.c | 2 +- > drivers/md/md.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 9d8dff9d923c..7fa311a14317 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -355,7 +355,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock); > */ > static bool is_suspended(struct mddev *mddev, struct bio *bio) > { > - if (is_md_suspended(mddev)) > + if (is_md_suspended(mddev) || percpu_ref_is_dying(&mddev->active_= io)) If we use mddev->suspended to judge if the raid is suspended, it should be enough? Because mddev->suspended must be true when active_io is dying. Best Regards Xiao > return true; > if (bio_data_dir(bio) !=3D WRITE) > return false; > diff --git a/drivers/md/md.h b/drivers/md/md.h > index b628c292506e..fb3b123f16dd 100644 > --- a/drivers/md/md.h > +++ b/drivers/md/md.h > @@ -584,7 +584,7 @@ static inline bool md_is_rdwr(struct mddev *mddev) > > static inline bool is_md_suspended(struct mddev *mddev) > { > - return percpu_ref_is_dying(&mddev->active_io); > + return READ_ONCE(mddev->suspended); > } > > static inline int __must_check mddev_lock(struct mddev *mddev) > -- > 2.39.2 >