Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2067300rwd; Tue, 13 Jun 2023 19:38:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5tV+cpMOMfGnd+sAmtfzDiBYw61LDrH5McNiffyu+JQUV5tgEeA1d5av+qlq4OnrtC3Mbs X-Received: by 2002:a92:da45:0:b0:340:94d7:540 with SMTP id p5-20020a92da45000000b0034094d70540mr1087076ilq.29.1686710298848; Tue, 13 Jun 2023 19:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686710298; cv=none; d=google.com; s=arc-20160816; b=qgRLAX4r+VbqJ47ijWK/cR6ceOa1YK4GtvTWWBx2xSSJyuLboqf67dPVPtQC3VF7Yu MErulfjYyjLpkgJbp3URxo9lmF1NOtST600PegY0Ne+jC4QBcCoU+UL2Ii0hIxVAlM8+ 7diISWQvh+PKknPUIfmtctyeWZVAOmENP+Iz+byyBoGNdXjiBONCeHjZwsqChOO7qy/z VpHOn2E+5TS7bZb1NLjkma2Y0rrZzze0YM0Pf7aUNRFjFRspB3uKTiSBaZx14iYTiSGU Y4E5KBRlNvsIZ44DmjqOcOFSvGpRNRYcUUO+/CGuwkHufGbHUqcv9bqk0HKW1Lf6BEM3 jf5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=ovar5jM/ErdRTwps2mVFQCiqDvytl6pCbWTPwlKlcdY=; b=1LKTcR7yNC5zFBCoPWYJGuV5mrNsfk2JGCJNxhahvz/7QyjdYxak5TIoJMx/de60mL C1EMvlv/ZTXm2WuBZR/bvbmqHGdj9TZPXvl4YW0GtdaKYdCUv0dFnPHZwCUZ60Ua96B2 7/o6DEQns3nnF7hASAs7UYXGc4XwVwrvvEdwWzt5exv93iOVOPAhOHEkUWxJwfU2048o TkYf/QjLADP1Y6ObVhV9kFzHStYJb/OG/epYYPXMEkKzHDC4zMqbCPkatIiPwqRhe4hZ q5ja/unmMYrWD27iDKw3U9BoHehHaed042Tw5aJ2j4dXVgRwP9YNHK01h+wsUyrtBai/ l8jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a639609000000b00543a6b7642esi10061685pge.818.2023.06.13.19.38.07; Tue, 13 Jun 2023 19:38:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241962AbjFNCEk (ORCPT + 99 others); Tue, 13 Jun 2023 22:04:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232820AbjFNCEj (ORCPT ); Tue, 13 Jun 2023 22:04:39 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83AA31980; Tue, 13 Jun 2023 19:04:38 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QgpdZ5Jqmz4f3pBp; Wed, 14 Jun 2023 10:04:34 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP4 (Coremail) with SMTP id gCh0CgAHoZQxIIlkJhyeLg--.20675S3; Wed, 14 Jun 2023 10:04:35 +0800 (CST) Subject: Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock To: Yu Kuai , Xiao Ni , guoqing.jiang@linux.dev, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, song@kernel.org Cc: linux-raid@vger.kernel.org, yangerkun@huawei.com, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, "yukuai (C)" References: <20230529132037.2124527-1-yukuai1@huaweicloud.com> <20230529132037.2124527-5-yukuai1@huaweicloud.com> <05aa3b09-7bb9-a65a-6231-4707b4b078a0@redhat.com> <74b404c4-4fdb-6eb3-93f1-0e640793bba6@huaweicloud.com> From: Yu Kuai Message-ID: <6e738d9b-6e92-20b7-f9d9-e1cf71d26d73@huaweicloud.com> Date: Wed, 14 Jun 2023 10:04:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <74b404c4-4fdb-6eb3-93f1-0e640793bba6@huaweicloud.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAHoZQxIIlkJhyeLg--.20675S3 X-Coremail-Antispam: 1UD129KBjvdXoW7JFy7GrWkJr1UWFyUWw47XFb_yoWxCrc_ua nrC34DGr18WanIqFyvkrn5Zrs7XryfCryUZa4UXF1UtrW0gFyDZF1xuw15Zw15Xw48Gw4I grZ0krWUua10gjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUba8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kI c2xKxwCYjI0SjxkI62AI1cAE67vIY487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4 AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE 17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMI IF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Wr1j6rW3 Jr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcS sGvfC2KfnxnUUI43ZEXa7VU1a9aPUUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, 在 2023/06/14 9:48, Yu Kuai 写道: >> >> In the patch, sync_seq is added in md_reap_sync_thread. In >> idle_sync_thread, if sync_seq isn't equal >> >> mddev->sync_seq, it should mean there is someone that stops the sync >> thread already, right? Why do >> >> you say 'new started sync thread' here? If someone stops the sync thread, and new sync thread is not started, then this sync_seq won't make a difference, above wait_event() will not wait because !test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) will pass. So 'sync_seq' is only used when the old sync thread stops and new sync thread starts, add 'sync_seq' will bypass this case. Thanks, Kuai