Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1160709rwd; Tue, 13 Jun 2023 05:50:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6jF4rQYXvcoZyCeLWoFhAeBfzBFPrR+NKPsfXYU0PcvS+MZb2R/Qb8ajf18z/HTOvWLMBq X-Received: by 2002:a17:907:94c7:b0:977:e501:cc01 with SMTP id dn7-20020a17090794c700b00977e501cc01mr11738741ejc.24.1686660648084; Tue, 13 Jun 2023 05:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686660648; cv=none; d=google.com; s=arc-20160816; b=YPycXiHyuKQzFt32aCD1p0+JWPhnLGpE9MC0HixhyESdDu7n4d5B7YhbXyV0esYove hDgQJt8JEfZH3AitdjzxTU5GckhMRzxnPzgMh5N51o5ST4Xzb50eBlmKoVwvliUhdmdC 6Uu2TdDLdB3gQtyK5M+b3bXiRH8yRAKCi0VLXKK6Zkk1QYt8MtzkOY9vo+UH0U6XPoYj r9yK8pnteygwLg6uqmp6YFtWmQ76ZrXaciK6uqXM8T/JULIJF0GF49Ob75HtsBKSUjYD Z41lkT0kDGiFMRTout0qHZdCZdOQL4i0EGRqhIJROMxWMgJmJvcknwxop4/tDy5ALrt5 Yh8g== 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=GjKXeUDS6d4nwJ2aq/easp5j6Oz3KlXQi4+jPoCm4uU=; b=tZSjfVK9uD/iGiFcOebaECtXOOp2rDhR8quqGF/vfS3phr4Y9OhwPvVtC0mRA42Fzg Ho6UfOdNWJ/Ezs2/R1QLHrkwR+t9Mss3F/yXEozh2jBoCswTcagiLVb2dER64B7GTyim BtBjweR5UreqCIzbNLh/wyrf7HIE5x+VZFZXqziOJVzR6kjBLTkUsHfcSmkWzFM6JObv jlmd64aVliwDW2Nc/lI0VTCron9gxmJlEhFXStfQaeVG8UnQ137Ez7lrCACHxaw2rC76 UpRjOTeSGgo60PTqLJGoVvT046qS0ybDKTM7la2sF+RXhc9jCdle6fwJCt3pcYDS58xR XjrQ== 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 e24-20020a1709067e1800b00975425ec9absi6796409ejr.550.2023.06.13.05.50.22; Tue, 13 Jun 2023 05:50:48 -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 S240993AbjFMMoc (ORCPT + 99 others); Tue, 13 Jun 2023 08:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236464AbjFMMoa (ORCPT ); Tue, 13 Jun 2023 08:44:30 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC495AD; Tue, 13 Jun 2023 05:44:29 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QgStK4XF5z4f3v55; Tue, 13 Jun 2023 20:44:25 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP4 (Coremail) with SMTP id gCh0CgAHuKuoZIhkVmRyLg--.57499S3; Tue, 13 Jun 2023 20:44:26 +0800 (CST) Subject: Re: [dm-devel] [PATCH -next v2 2/6] md: refactor action_store() for 'idle' and 'frozen' To: Xiao Ni , Yu Kuai Cc: guoqing.jiang@linux.dev, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, song@kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, "yukuai (C)" References: <20230529132037.2124527-1-yukuai1@huaweicloud.com> <20230529132037.2124527-3-yukuai1@huaweicloud.com> <1aaf9150-bbd3-87a8-8d54-8b5d63ab5ed3@huaweicloud.com> From: Yu Kuai Message-ID: <68b215a4-b4bb-7c94-6ad4-84ea859af742@huaweicloud.com> Date: Tue, 13 Jun 2023 20:44:24 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAHuKuoZIhkVmRyLg--.57499S3 X-Coremail-Antispam: 1UD129KBjvdXoWrZrW5Kw4DXry5ZF43uw43GFg_yoWkWFX_Cr s2ywnrGr18ZFnIgwn0yr4rJ39rKFn5Wr47X3yUZF4Yvw18Xa4kJr4ktr18Ww45WayYyrnI vFyq9ay7XrZ7ZjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb3AFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IY64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2IY 04v7Mxk0xIA0c2IEe2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7 v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF 1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIx AIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrJr0_WFyU JwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCT nIWIevJa73UjIFyTuYvjfUoOJ5UUUUU 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/13 20:25, Xiao Ni 写道: > On Tue, Jun 13, 2023 at 8:00 PM Yu Kuai wrote: >> >> Hi, >> >> 在 2023/06/13 16:02, Xiao Ni 写道: >>> >>> 在 2023/5/29 下午9:20, Yu Kuai 写道: >>>> From: Yu Kuai >>>> >>>> Prepare to handle 'idle' and 'frozen' differently to fix a deadlock, >>>> there >>>> are no functional changes except that MD_RECOVERY_RUNNING is checked >>>> again after 'reconfig_mutex' is held. >>> >>> >>> Can you explain more about why it needs to check MD_RECOVERY_RUNNING >>> again here? >> >> As I explain in the following comment: > > Hi > > Who can clear the flag before the lock is held? Basically every where that can clear the flag... // This context // Other context mutex_lock ... test_bit -> pass clear_bit mutex_unlock mutex_lock test_bit -> check again Thanks, Kuai > > Regards > Xiao >>>> + /* >>>> + * Check again in case MD_RECOVERY_RUNNING is cleared before lock is >>>> + * held. >>>> + */ >>>> + if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) { >>>> + mddev_unlock(mddev); >>>> + return; >>>> + } >> >> Thanks, >> Kuai >> > > . >