From patchwork Thu Aug 3 13:29:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1174413vqx; Thu, 3 Aug 2023 07:09:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFB3eB8RLPPQHhutNsK3ehbOc6Ya4NCBQQYOE39+tdqX0JTRIo89IOOzD9zTiSSCyk6Xkfa X-Received: by 2002:a05:6e02:20e3:b0:346:5249:9ae1 with SMTP id q3-20020a056e0220e300b0034652499ae1mr21168033ilv.12.1691071772801; Thu, 03 Aug 2023 07:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691071772; cv=none; d=google.com; s=arc-20160816; b=mZvzJrs65sRjPN67XoOUuLzJwbQsw5qHMR3JF0uWi+yiQSEF6NnrkxtOHTSKov8daB RJEdF0cIhrgiLuDVi6t8vFy1maSmRyunCifUdDfiX/wXoYaenvLTHnjUw/01EBw5fJYm Xp4mL7+euhEx9PEvQKQmEPPGhBhqLLrwl9Jo06C+/Qq0jxnvFfE5+amHxKv0pW/6HfMX XdXLp3EyyFFvOJBi3uKm9iR+A7twHbjDpvBCKsH0pI+rrjlrx7EcHIbMTFDSDSSyu6PK nYYOHT92l+Fg1MwdMtUYIBssi6ckeuofOA2ZHARAQT629NAkM+jhALgf6Jxuyj2/zv0G Cdig== 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=ONBsvQsCCHI8GY2zpU3c9VMpsfa9URW0b6gGVBiCfmk=; fh=Ktvf84aTmiKPjIiQsnocICsaz7FvZSNYviQ4CE4oKUo=; b=jZgAFOjpy92PnUGBa7oDohRTNQH5BSDIBzEm8qTcyR+LagOFfdhY9y0kNAy2mO3eK8 3J2J40kovZypmOz6wLDm2eRY3vpIHcw25PWyRh3KReoqR0f0xRzZDXR3sayaciIzmmfN ajlgxhaIsX6/zx9n6bGJUYOudhr13/S/ZItD9ZYW0Fy5yX2dldKP8J96KrPHS0EiPF8f CX8GUJywYwvlQeDrGerGKzvNWQ7gbObUAdjepR9Ps0z8ypiobNFVzlG4qPht53oUkaip EfvwALlypJTV/6MUQt70E6vP+CPQqLLzuy4GELqkIuokjT+jkvv4bBAYxKN7jpZANYxJ bASA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga11-20020a17090b038b00b00263d00e1c54si14660pjb.54.2023.08.03.07.09.18; Thu, 03 Aug 2023 07:09:32 -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 S236304AbjHCNeU (ORCPT + 99 others); Thu, 3 Aug 2023 09:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235377AbjHCNdn (ORCPT ); Thu, 3 Aug 2023 09:33:43 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8A5C4694; Thu, 3 Aug 2023 06:32:31 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4RGqX83Vg5z4f3l7M; Thu, 3 Aug 2023 21:32:24 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgAHuKtqrMtkWHLlPQ--.49699S4; Thu, 03 Aug 2023 21:32:27 +0800 (CST) From: Yu Kuai To: song@kernel.org, xni@redhat.com Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next 00/29] md: synchronize io with array reconfiguration Date: Thu, 3 Aug 2023 21:29:01 +0800 Message-Id: <20230803132930.2742286-1-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHuKtqrMtkWHLlPQ--.49699S4 X-Coremail-Antispam: 1UD129KBjvJXoWxZr4DWr48Cr1xWryxKr1Utrb_yoW5trWfp3 9rtFZIvw48JFy5Ar4xX3yDGF95Jw1rKrW2kr9xCw4rC3W3GryrZrWUGr98XrZYkFyfAF9r Ja4UX34rGr18Aa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyE14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1l42xK82IYc2Ij64vI r41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Xr0_Ar1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAIcVCF04 k26cxKx2IYs7xG6Fyj6rWUJwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF 7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7VUb7GYJUUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773217275222316086 X-GMAIL-MSGID: 1773217275222316086 From: Yu Kuai After previous four patchset of preparatory work, this patchset impelement a new version of mddev_suspend(), the new apis: - reconfig_mutex is not required; - the weird logical that suspend array hold 'reconfig_mutex' for mddev_check_recovery() to update superblock is not needed; - the special handling, 'pers->prepare_suspend', for raid456 is not needed; - It's safe to be called at any time once mddev is allocated, and it's designed to be used from slow path where array configuration is changed; And use the new api to replace: mddev_lock mddev_suspend or not // array reconfiguration mddev_resume or not mddev_unlock With: mddev_suspend mddev_lock // array reconfiguration mddev_unlock mddev_resume However, the above change is not possible for raid5 and raid-cluster in some corner cases, and mddev_suspend/resume() is replaced with quiesce() callback, which will suspend the array as well. This patchset is tested in my VM with mdadm testsuite with loop device except for 10ddf tests(they always fail before this patchset). A lot of cleanups will be started after this patchset. Yu Kuai (29): md: use READ_ONCE/WRITE_ONCE for 'suspend_lo' and 'suspend_hi' md: use 'mddev->suspended' for is_md_suspended() md: add new helpers to suspend/resume array md: add new helpers to suspend/resume and lock/unlock array md: use new apis to suspend array for suspend_lo/hi/store() md: use new apis to suspend array for level_store() md: use new apis to suspend array for serialize_policy_store() md/dm-raid: use new apis to suspend array md/md-bitmap: use new apis to suspend array for location_store() md/raid5-cache: use READ_ONCE/WRITE_ONCE for 'conf->log' md/raid5-cache: use new apis to suspend array for r5c_disable_writeback_async() md/raid5-cache: use new apis to suspend array for r5c_journal_mode_store() md/raid5: use new apis to suspend array for raid5_store_stripe_size() md/raid5: use new apis to suspend array for raid5_store_skip_copy() md/raid5: use new apis to suspend array for raid5_store_group_thread_cnt() md/raid5: use new apis to suspend array for raid5_change_consistency_policy() md/raid5: replace suspend with quiesce() callback md: quiesce before md_kick_rdev_from_array() for md-cluster md: use new apis to suspend array for ioctls involed array reconfiguration md: use new apis to suspend array for adding/removing rdev from state_store() md: use new apis to suspend array for bind_rdev_to_array() md: use new apis to suspend array related to serial pool in state_store() md: use new apis to suspend array in backlog_store() md: suspend array in md_start_sync() if array need reconfiguration md: cleanup mddev_create/destroy_serial_pool() md/md-linear: cleanup linear_add() md: remove mddev_suspend() and mddev_resume() md/raid5: Revert "md/raid5: fix a deadlock in the case that reshape is interrupted" md: Revert "md: add a new api prepare_suspend() in md_personality" drivers/md/dm-raid.c | 12 +- drivers/md/md-autodetect.c | 4 +- drivers/md/md-bitmap.c | 18 ++- drivers/md/md-linear.c | 2 - drivers/md/md.c | 267 ++++++++++++++++++++++--------------- drivers/md/md.h | 57 ++++++-- drivers/md/raid5-cache.c | 65 +++++---- drivers/md/raid5.c | 100 +++----------- 8 files changed, 267 insertions(+), 258 deletions(-)