Message ID | 20231124075953.1932764-2-yukuai1@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp986574vqx; Fri, 24 Nov 2023 00:03:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaAkdwPoxkC8MR88QOVMq/TKTsi8UAgMm0yYq+Rfyk92ds0ZXRNwYYnr91r3xgwoA9Lg9O X-Received: by 2002:a05:6808:1489:b0:3b2:e61f:f0a8 with SMTP id e9-20020a056808148900b003b2e61ff0a8mr2295115oiw.45.1700813030409; Fri, 24 Nov 2023 00:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700813030; cv=none; d=google.com; s=arc-20160816; b=Tn6zsAtNRXmOPfWPIb2Dqq8jM/yb8wq9wyxlhyhI2ZhNxS2cjX7Pfqkuicl9e5a9R8 Qp5GwWU3Zj7uG0BvJ6KOcr2fhV0y4BAifBVJY89qtvNtzGQ8xlIXWxXw/Ag6uqkDriEb +nxObTygI/Q/srsMM6cuNXfK4rdwMNXczkrnLHk0+TAg9jnXS0B/bBVzOwa6vkOKrGHs ohsqK4f/2ST6gPHgKIaoeOP1spl2ehLK2an/LH3GL9GEHAGFL4ZRdh0hYZMyJP92jtQZ bmnwTDAbz/pk8roHCm5IIlDG47CY0IPSYdXtk69ZK2ghvA7eWmNkjML99kxvuV+fNw8h dg+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XD8KLYDbv7rkboSwxABZO6cIVwy5bXk5EQwp93O/OuU=; fh=1OsC7ljVhdTcf5FTl08sAtO9qsMpveq6AJn+JsIEEss=; b=x6f28y7PpMcLI7jALoq14cHIuM1fSfTkm8oVoCL/0J2cjgK3h9lFhHvbhZvZmkfLs9 v6nyx3wGfT1DkShUz6WZ/bMKTcFELOtCRhH8LCqBZVOWL/TZ4M5ch4OxkYZrYzG1iK03 lj+ndcQyUh7yeyRtv8Ka2hl0e6D/cCOgMbGvInFK3dkGr0QvlGZ1Kbk38867ALeq/D3d DXrdWRwAu/52765X1NiRjRQHkbXzRocm0n/BlrCdt+5BNoTBHWo/FXvpQIhzmlu+NTav uSUuHJXXbdFuXEScrzkpJTvgcNxY2mdgJM2yoGE/qwe6R9J3LD2tA8tqFBGeLsKh/PGW Z5mA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e28-20020a63545c000000b005bd3d377a54si3017438pgm.123.2023.11.24.00.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 00:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id AA1D681BC4A4; Fri, 24 Nov 2023 00:03:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235098AbjKXIDU (ORCPT <rfc822;jaysivo@gmail.com> + 29 others); Fri, 24 Nov 2023 03:03:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234620AbjKXIDA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Nov 2023 03:03:00 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 821274483; Fri, 24 Nov 2023 00:00:23 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Sc6pm6QW1z4f3jZQ; Fri, 24 Nov 2023 16:00:16 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id A0C4D1A03D0; Fri, 24 Nov 2023 16:00:19 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgDX2xERWGBlUnAqBw--.22901S5; Fri, 24 Nov 2023 16:00:19 +0800 (CST) From: Yu Kuai <yukuai1@huaweicloud.com> To: song@kernel.org, yukuai3@huawei.com, xni@redhat.com Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH v2 1/6] md: fix missing flush of sync_work Date: Fri, 24 Nov 2023 15:59:48 +0800 Message-Id: <20231124075953.1932764-2-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231124075953.1932764-1-yukuai1@huaweicloud.com> References: <20231124075953.1932764-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgDX2xERWGBlUnAqBw--.22901S5 X-Coremail-Antispam: 1UD129KBjvJXoW7tr18WF13Cr18Cr4kJw13Jwb_yoW8Xry5p3 ySqa45ArWrAay3t34UGa4qva4rWw10qrZrtrW3u345JF1aqF45G3WY9F1jqFykJF93Zwn8 ZF48ta9xZ3W0vr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9m14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jr4l82xGYIkIc2 x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr 0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUqAp5UUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 24 Nov 2023 00:03:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783431723957745670 X-GMAIL-MSGID: 1783431723957745670 |
Series |
md: bugfix and cleanup for sync_thread
|
|
Commit Message
Yu Kuai
Nov. 24, 2023, 7:59 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com> Commit ac619781967b ("md: use separate work_struct for md_start_sync()") use a new sync_work to replace del_work, however, stop_sync_thread() and __md_stop_writes() was trying to wait for sync_thread to be done, hence they should switch to use sync_work as well. Noted that md_start_sync() from sync_work will grab 'reconfig_mutex', hence other contex can't held the same lock to flush work, and this will be fixed in later patches. Fixes: ac619781967b ("md: use separate work_struct for md_start_sync()") Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- drivers/md/md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Fri, Nov 24, 2023 at 12:00 AM Yu Kuai <yukuai1@huaweicloud.com> wrote: > > From: Yu Kuai <yukuai3@huawei.com> > > Commit ac619781967b ("md: use separate work_struct for md_start_sync()") > use a new sync_work to replace del_work, however, stop_sync_thread() and > __md_stop_writes() was trying to wait for sync_thread to be done, hence > they should switch to use sync_work as well. > > Noted that md_start_sync() from sync_work will grab 'reconfig_mutex', > hence other contex can't held the same lock to flush work, and this will > be fixed in later patches. > > Fixes: ac619781967b ("md: use separate work_struct for md_start_sync()") This fix should go via md-fixes branch. Please send it separately. Thanks, Song > Signed-off-by: Yu Kuai <yukuai3@huawei.com> > --- > drivers/md/md.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 09686d8db983..1701e2fb219f 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -4865,7 +4865,7 @@ static void stop_sync_thread(struct mddev *mddev) > return; > } > > - if (work_pending(&mddev->del_work)) > + if (work_pending(&mddev->sync_work)) > flush_workqueue(md_misc_wq); > > set_bit(MD_RECOVERY_INTR, &mddev->recovery); > @@ -6273,7 +6273,7 @@ static void md_clean(struct mddev *mddev) > static void __md_stop_writes(struct mddev *mddev) > { > set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); > - if (work_pending(&mddev->del_work)) > + if (work_pending(&mddev->sync_work)) > flush_workqueue(md_misc_wq); > if (mddev->sync_thread) { > set_bit(MD_RECOVERY_INTR, &mddev->recovery); > -- > 2.39.2 >
Hi, 在 2023/11/28 8:02, Song Liu 写道: > On Fri, Nov 24, 2023 at 12:00 AM Yu Kuai <yukuai1@huaweicloud.com> wrote: >> >> From: Yu Kuai <yukuai3@huawei.com> >> >> Commit ac619781967b ("md: use separate work_struct for md_start_sync()") >> use a new sync_work to replace del_work, however, stop_sync_thread() and >> __md_stop_writes() was trying to wait for sync_thread to be done, hence >> they should switch to use sync_work as well. >> >> Noted that md_start_sync() from sync_work will grab 'reconfig_mutex', >> hence other contex can't held the same lock to flush work, and this will >> be fixed in later patches. >> >> Fixes: ac619781967b ("md: use separate work_struct for md_start_sync()") > > This fix should go via md-fixes branch. Please send it separately. This patch alone is not good, there are follow up problems to be fixed completely after patch 5. Can this patchset applied to md-fixes? Or I can split patch 1,4 and 5 for md-fixes, and keep others to md-next. Thanks, Kuai > > Thanks, > Song > >> Signed-off-by: Yu Kuai <yukuai3@huawei.com> >> --- >> drivers/md/md.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/md/md.c b/drivers/md/md.c >> index 09686d8db983..1701e2fb219f 100644 >> --- a/drivers/md/md.c >> +++ b/drivers/md/md.c >> @@ -4865,7 +4865,7 @@ static void stop_sync_thread(struct mddev *mddev) >> return; >> } >> >> - if (work_pending(&mddev->del_work)) >> + if (work_pending(&mddev->sync_work)) >> flush_workqueue(md_misc_wq); >> >> set_bit(MD_RECOVERY_INTR, &mddev->recovery); >> @@ -6273,7 +6273,7 @@ static void md_clean(struct mddev *mddev) >> static void __md_stop_writes(struct mddev *mddev) >> { >> set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); >> - if (work_pending(&mddev->del_work)) >> + if (work_pending(&mddev->sync_work)) >> flush_workqueue(md_misc_wq); >> if (mddev->sync_thread) { >> set_bit(MD_RECOVERY_INTR, &mddev->recovery); >> -- >> 2.39.2 >> > . >
On Mon, Nov 27, 2023 at 6:07 PM Yu Kuai <yukuai1@huaweicloud.com> wrote: > > Hi, > > 在 2023/11/28 8:02, Song Liu 写道: > > On Fri, Nov 24, 2023 at 12:00 AM Yu Kuai <yukuai1@huaweicloud.com> wrote: > >> > >> From: Yu Kuai <yukuai3@huawei.com> > >> > >> Commit ac619781967b ("md: use separate work_struct for md_start_sync()") > >> use a new sync_work to replace del_work, however, stop_sync_thread() and > >> __md_stop_writes() was trying to wait for sync_thread to be done, hence > >> they should switch to use sync_work as well. > >> > >> Noted that md_start_sync() from sync_work will grab 'reconfig_mutex', > >> hence other contex can't held the same lock to flush work, and this will > >> be fixed in later patches. > >> > >> Fixes: ac619781967b ("md: use separate work_struct for md_start_sync()") > > > > This fix should go via md-fixes branch. Please send it separately. > > This patch alone is not good, there are follow up problems to be fixed > completely after patch 5. Can this patchset applied to md-fixes? > > Or I can split patch 1,4 and 5 for md-fixes, and keep others to md-next. Yes, please split the patches into two sets. Thanks, Song
diff --git a/drivers/md/md.c b/drivers/md/md.c index 09686d8db983..1701e2fb219f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4865,7 +4865,7 @@ static void stop_sync_thread(struct mddev *mddev) return; } - if (work_pending(&mddev->del_work)) + if (work_pending(&mddev->sync_work)) flush_workqueue(md_misc_wq); set_bit(MD_RECOVERY_INTR, &mddev->recovery); @@ -6273,7 +6273,7 @@ static void md_clean(struct mddev *mddev) static void __md_stop_writes(struct mddev *mddev) { set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); - if (work_pending(&mddev->del_work)) + if (work_pending(&mddev->sync_work)) flush_workqueue(md_misc_wq); if (mddev->sync_thread) { set_bit(MD_RECOVERY_INTR, &mddev->recovery);