Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3148699rwd; Mon, 29 May 2023 06:26:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QJ/az1+EX8qD7abMKGm9kFMMOdM2WGr2WEszD2BisrrEngPmTMIYgt6ehoho3oOCJTew9 X-Received: by 2002:a05:6a20:be23:b0:10b:b5cc:6348 with SMTP id ge35-20020a056a20be2300b0010bb5cc6348mr8475964pzb.20.1685366806286; Mon, 29 May 2023 06:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685366806; cv=none; d=google.com; s=arc-20160816; b=OT6ccSwh7uAEvOsLmQBiwi7exneSqpzBRpAsdoiYoaPtNwzpzhgH3CEDppeBPyUKxs f4U61ns9jimaghY4Ksebe78fj8yezPOGvHQXhen2cGtBcu9IDQbWzG9t88/wW6x4z1l8 KqKVbv07pGRJHqJeoMNVcj4y/LsTJaa8XV6sVwnYwTko//mfSylwVTK17ifm0VM/WSp8 +YNESmTNXiJeZBpQApEQvpga8jDoehBQwRpvI5Se6bgdMbgikyaaUxZB62Ilbz7aFhNP /iyOAFIBDXuseF3fy7ox7Qe29Iev8UaZGSdHuJPuJ14Uv9XSKAhsrw7dEALZYhJQFLqA bC8A== 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 :message-id:date:subject:cc:to:from; bh=hBTBzBhP6IInOdkIAnYtNGpWSGjyOHXbvd113IGeapE=; b=oqx4YbjCF/HC7UM8EYU8g44gmnHBF+Hb2oMQ2An4EgB7CJjBF8jCuUVbFkCV2gUDOr FSAs3debIOBH45vvWvCmp5ABAx7gcGOVHC1u1fLA5tSqzP1QkHtJ90+HqIZiRQhb2JTB GZ0Z6o43JPZPG1J4h9B1auXRt8/CdvcEDIOWlNPTC8nOWMnzJRJXIb63wU0yMCXYCp1G sJCTvrQNA2IF/lJgH5pK38lMNM7GqyVriUbTypdQkOOvhpMRNv6r6ld6rigFDd9ACrM1 ziCPHTS0jEIXxLM+1KlFR4gM1t3vhSI4oe6HsEiI+qiHWVdPK37eMF/5ugsWcz316irJ IEUA== 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 w4-20020a656944000000b004fb8abdd188si9413526pgq.115.2023.05.29.06.26.33; Mon, 29 May 2023 06:26:46 -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 S229770AbjE2NYV (ORCPT + 99 others); Mon, 29 May 2023 09:24:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjE2NYU (ORCPT ); Mon, 29 May 2023 09:24:20 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1313CC4; Mon, 29 May 2023 06:24:19 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGT93tDkz4f3v58; Mon, 29 May 2023 21:24:13 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgAHvbB9p3RkWVPoKQ--.23397S4; Mon, 29 May 2023 21:24:14 +0800 (CST) From: Yu Kuai To: guoqing.jiang@linux.dev, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, song@kernel.org Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next v2 0/6] md: fix that MD_RECOVERY_RUNNING can be cleared while sync_thread is still running Date: Mon, 29 May 2023 21:20:31 +0800 Message-Id: <20230529132037.2124527-1-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAHvbB9p3RkWVPoKQ--.23397S4 X-Coremail-Antispam: 1UD129KBjvdXoW7Gw1rAw43JrW7Zr4kur4fGrg_yoWfurX_Xa 43XFy3Gr47WF15JFyDKr1jv3yDGF45ur1DXFyFqayjyr17WrnrCr1Duw1a9w1Yva42yF18 ArWUCrWxurs7WjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIxFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFyl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWrJr0_WFyUJwCI42IY6I8E87Iv67AK xVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa 7VU1a9aPUUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Yu Kuai Changes in v2: - rebase for the latest md-next Patch 1 revert the commit because it will cause MD_RECOVERY_RUNNING to be cleared while sync_thread is still running. The deadlock this patch tries to fix will be fixed by patch 2-5. Patch 6 enhance checking to prevent MD_RECOVERY_RUNNING to be cleared while sync_thread is still running. Yu Kuai (6): Revert "md: unlock mddev before reap sync_thread in action_store" md: refactor action_store() for 'idle' and 'frozen' md: add a mutex to synchronize idle and frozen in action_store() md: refactor idle/frozen_sync_thread() to fix deadlock md: wake up 'resync_wait' at last in md_reap_sync_thread() md: enhance checking in md_check_recovery() drivers/md/dm-raid.c | 1 - drivers/md/md.c | 124 +++++++++++++++++++++++++++++-------------- drivers/md/md.h | 5 ++ 3 files changed, 88 insertions(+), 42 deletions(-) -- 2.39.2