From patchwork Mon May 29 13:28:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258588 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09AE0C77B7A for ; Mon, 29 May 2023 13:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229826AbjE2NcM (ORCPT ); Mon, 29 May 2023 09:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjE2NcJ (ORCPT ); Mon, 29 May 2023 09:32:09 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98A08E for ; Mon, 29 May 2023 06:32:07 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGfD1Dyvz4f3lXL for ; Mon, 29 May 2023 21:32:04 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S5; Mon, 29 May 2023 21:32:05 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 1/8] tests: add a new test for rdev lifetime Date: Mon, 29 May 2023 21:28:19 +0800 Message-Id: <20230529132826.2125392-2-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBH_rFSqXRkMLjoKQ--.57183S5 X-Coremail-Antispam: 1UD129KBjvJXoWxJFW8Gw1DAr45KF47ur1rWFg_yoW5GFyUpr 4I9F15Gr48Gw17AF43WF4fGF1rAa1kCF47Ars7Xr1DZF1jvw47JFyUKF1jvFnxGrZ5ZF1x ta4kJa1rKw17GaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBFb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26F4j6r4UJwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x 0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x07UC0PfUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai This test add and remove a underlying disk to raid concurretly, verify that the following problem is fixed: run mdadm test 23rdev-lifetime at Fri Apr 28 03:25:30 UTC 2023 md: could not open device unknown-block(1,0). sysfs: cannot create duplicate filename '/devices/virtual/block/md0/md/dev-ram0' CPU: 26 PID: 10521 Comm: test Not tainted 6.3.0-rc2-00134-g7b3a8828043c #115 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/014 Call Trace: dump_stack_lvl+0xe7/0x180 dump_stack+0x18/0x30 sysfs_warn_dup+0xa2/0xd0 sysfs_create_dir_ns+0x119/0x140 kobject_add_internal+0x143/0x4d0 kobject_add_varg+0x35/0x70 kobject_add+0x64/0xd0 bind_rdev_to_array+0x254/0x840 [md_mod] new_dev_store+0x14d/0x350 [md_mod] md_attr_store+0xc1/0x1a0 [md_mod] sysfs_kf_write+0x51/0x70 kernfs_fop_write_iter+0x188/0x270 vfs_write+0x27e/0x460 ksys_write+0x85/0x180 __x64_sys_write+0x21/0x30 do_syscall_64+0x6c/0xe0 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f26bacf5387 Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 84 RSP: 002b:00007ffe98d79e68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f26bacf5387 RDX: 0000000000000004 RSI: 000055bd10282bf0 RDI: 0000000000000001 RBP: 000055bd10282bf0 R08: 000000000000000a R09: 00007f26bad8b4e0 R10: 00007f26bad8b3e0 R11: 0000000000000246 R12: 0000000000000004 R13: 00007f26badc8520 R14: 0000000000000004 R15: 00007f26badc8700 Signed-off-by: Yu Kuai --- tests/23rdev-lifetime | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/23rdev-lifetime diff --git a/tests/23rdev-lifetime b/tests/23rdev-lifetime new file mode 100644 index 00000000..1750b0db --- /dev/null +++ b/tests/23rdev-lifetime @@ -0,0 +1,34 @@ +devname=${dev0##*/} +devt=`cat /sys/block/$devname/dev` +pid="" +runtime=2 + +clean_up_test() { + pill -9 $pid + echo clear > /sys/block/md0/md/array_state +} + +trap 'clean_up_test' EXIT + +add_by_sysfs() { + while true; do + echo $devt > /sys/block/md0/md/new_dev + done +} + +remove_by_sysfs(){ + while true; do + echo remove > /sys/block/md0/md/dev-${devname}/state + done +} + +echo md0 > /sys/module/md_mod/parameters/new_array || die "create md0 failed" + +add_by_sysfs & +pid="$pid $!" + +remove_by_sysfs & +pid="$pid $!" + +sleep $runtime +exit 0 From patchwork Mon May 29 13:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258591 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBEA3C7EE2E for ; Mon, 29 May 2023 13:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbjE2NcQ (ORCPT ); Mon, 29 May 2023 09:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbjE2NcM (ORCPT ); Mon, 29 May 2023 09:32:12 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E04C9 for ; Mon, 29 May 2023 06:32:09 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGfD5Dqfz4f3pFk for ; Mon, 29 May 2023 21:32:04 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S6; Mon, 29 May 2023 21:32:05 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 2/8] tests: support to skip checking dmesg Date: Mon, 29 May 2023 21:28:20 +0800 Message-Id: <20230529132826.2125392-3-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBH_rFSqXRkMLjoKQ--.57183S6 X-Coremail-Antispam: 1UD129KBjvdXoW7XFykJFyDtFyrKw4kuF4kWFg_yoWDXrc_tr yS9as7Wr45GFnrKw1avF1qvFsYk3y3Wr1xuryqkFy5XF15uF18GaykKFWrZa1furZ0y39a kw1IgrsxJr129jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbS8YFVCjjxCrM7AC8VAFwI0_Wr0E3s1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r15M2 8IrcIa0xkI8VCY1x0267AKxVW8JVW5JwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r 4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx 0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWU JVW8JwACjcxG0xvY0x0EwIxGrwACI402YVCY1x02628vn2kIc2xKxwCF04k20xvY0x0EwI xGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480 Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7 IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x 0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x07jbF4iUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai Prepare to add a regression test for raid10 that require error injection to trigger error path, and kernel will complain about io error, checking dmesg for error log will make it impossible to pass this test. Signed-off-by: Yu Kuai Acked-by: Mariusz Tkaczyk --- test | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test b/test index 61d9ee83..b244453b 100755 --- a/test +++ b/test @@ -107,8 +107,12 @@ do_test() { echo -ne "$_script... " if ( set -ex ; . $_script ) &> $targetdir/log then - dmesg | grep -iq "error\|call trace\|segfault" && - die "dmesg prints errors when testing $_basename!" + if [ -f "${_script}.inject_error" ]; then + echo "dmesg checking is skipped because test inject error" + else + dmesg | grep -iq "error\|call trace\|segfault" && + die "dmesg prints errors when testing $_basename!" + fi echo "succeeded" _fail=0 else From patchwork Mon May 29 13:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258590 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 275BFC7EE2F for ; Mon, 29 May 2023 13:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229641AbjE2NcP (ORCPT ); Mon, 29 May 2023 09:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbjE2NcL (ORCPT ); Mon, 29 May 2023 09:32:11 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 730DD90 for ; Mon, 29 May 2023 06:32:09 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGfF5kl1z4f3pG6 for ; Mon, 29 May 2023 21:32:05 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S7; Mon, 29 May 2023 21:32:06 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 3/8] tests: add a regression test for raid10 deadlock Date: Mon, 29 May 2023 21:28:21 +0800 Message-Id: <20230529132826.2125392-4-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBH_rFSqXRkMLjoKQ--.57183S7 X-Coremail-Antispam: 1UD129KBjvJXoWxAr1xArW3tryUWryxCF4xXrb_yoW5CFWUpw 4UuFy5KrWxW3W3Xr13Ga1UJFyFva1DArW3A347u3y3K3y7ZFyvvan7Kry5ZFZ2vr40yw1k u3Z0kF48Kr1j9FUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB2b4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWw A2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAIcVCF 04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7 CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxUOlksDUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai The deadlock is described in [1], it's fixed first by [2], however, it turns out this commit will trigger other problems[3], hence this commit will be reverted and the deadlock is supposed to be fixed by [1]. [1] https://lore.kernel.org/linux-raid/20230322064122.2384589-5-yukuai1@huaweicloud.com/ [2] https://lore.kernel.org/linux-raid/20220621031129.24778-1-guoqing.jiang@linux.dev/ [3] https://lore.kernel.org/linux-raid/20230322064122.2384589-2-yukuai1@huaweicloud.com/ Signed-off-by: Yu Kuai --- tests/24raid10deadlock | 88 +++++++++++++++++++++++++++++ tests/24raid10deadlock.inject_error | 0 2 files changed, 88 insertions(+) create mode 100644 tests/24raid10deadlock create mode 100644 tests/24raid10deadlock.inject_error diff --git a/tests/24raid10deadlock b/tests/24raid10deadlock new file mode 100644 index 00000000..ee330aa9 --- /dev/null +++ b/tests/24raid10deadlock @@ -0,0 +1,88 @@ +devs="$dev0 $dev1 $dev2 $dev3" +runtime=120 +pid="" +action_pid="" + +set_up_injection() +{ + echo -1 > /sys/kernel/debug/fail_make_request/times + echo 1 > /sys/kernel/debug/fail_make_request/probability + echo 0 > /sys/kernel/debug/fail_make_request/verbose + echo 1 > /sys/block/${1##*/}/make-it-fail +} + +clean_up_injection() +{ + echo 0 > /sys/block/${1##*/}/make-it-fail + echo 0 > /sys/kernel/debug/fail_make_request/times + echo 0 > /sys/kernel/debug/fail_make_request/probability + echo 2 > /sys/kernel/debug/fail_make_request/verbose +} + +test_rdev() +{ + while true; do + mdadm -f $md0 $1 &> /dev/null + mdadm -r $md0 $1 &> /dev/null + mdadm --zero-superblock $1 &> /dev/null + mdadm -a $md0 $1 &> /dev/null + sleep $2 + done +} + +test_write_action() +{ + while true; do + echo frozen > /sys/block/md0/md/sync_action + echo idle > /sys/block/md0/md/sync_action + sleep 0.1 + done +} + +set_up_test() +{ + fio -h &> /dev/null || die "fio not found" + + # create a simple raid10 + mdadm -Cv -R -n 4 -l10 $md0 $devs || die "create raid10 failed" +} + +clean_up_test() +{ + clean_up_injection $dev0 + pkill -9 fio + kill -9 $pid + kill -9 $action_pid + + sleep 1 + + if ps $action_pid | tail -1 | awk '{print $3}' | grep D; then + die "thread that is writing sysfs is stuck in D state, deadlock is triggered" + fi + mdadm -S $md0 +} + +cat /sys/kernel/debug/fail_make_request/times || die "fault injection is not enabled" + +trap 'clean_up_test' EXIT + +set_up_test || die "set up test failed" + +# backgroup io pressure +fio -filename=$md0 -rw=randwrite -direct=1 -name=test -bs=4k -numjobs=16 -iodepth=16 & + +# trigger add/remove device by io failure +set_up_injection $dev0 +test_rdev $dev0 2 & +pid="$pid $!" + +# add/remove device directly +test_rdev $dev3 10 & +pid="$pid $!" + +test_write_action & +action_pid="$!" + +sleep $runtime + +exit 0 diff --git a/tests/24raid10deadlock.inject_error b/tests/24raid10deadlock.inject_error new file mode 100644 index 00000000..e69de29b From patchwork Mon May 29 13:28:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258595 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7929AC77B7E for ; Mon, 29 May 2023 13:32:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229450AbjE2NcV (ORCPT ); Mon, 29 May 2023 09:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229836AbjE2NcM (ORCPT ); Mon, 29 May 2023 09:32:12 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38C05C7 for ; Mon, 29 May 2023 06:32:09 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGfG1j1Pz4f3tNq for ; Mon, 29 May 2023 21:32:06 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S8; Mon, 29 May 2023 21:32:07 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 4/8] tests: add a regression test for raid456 deadlock Date: Mon, 29 May 2023 21:28:22 +0800 Message-Id: <20230529132826.2125392-5-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBH_rFSqXRkMLjo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IYCTnIWIevJa73UjIFyTuYvjxUoeOJUUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai The deadlock is described in [1], as the last patch described, it's fixed first by [2], however this fix will be reverted and the deadlock is supposed to be fixed by [3]. [1] https://lore.kernel.org/linux-raid/5ed54ffc-ce82-bf66-4eff-390cb23bc1ac@molgen.mpg.de/T/#t [2] https://lore.kernel.org/linux-raid/20220621031129.24778-1-guoqing.jiang@linux.dev/ [3] https://lore.kernel.org/linux-raid/20230322064122.2384589-5-yukuai1@huaweicloud.com/ Signed-off-by: Yu Kuai --- tests/24raid456deadlock | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/24raid456deadlock diff --git a/tests/24raid456deadlock b/tests/24raid456deadlock new file mode 100644 index 00000000..80e6e97e --- /dev/null +++ b/tests/24raid456deadlock @@ -0,0 +1,58 @@ +devs="$dev0 $dev1 $dev2 $dev3 $dev4 $dev5" +runtime=120 +pid="" +old=`cat /proc/sys/vm/dirty_background_ratio` + +test_write_action() +{ + while true; do + echo check > /sys/block/md0/md/sync_action &> /dev/null + sleep 0.1 + echo idle > /sys/block/md0/md/sync_action &> /dev/null + done +} + +test_write_back() +{ + fio -filename=$md0 -bs=4k -rw=write -numjobs=1 -name=test \ + -time_based -runtime=$runtime &> /dev/null +} + +set_up_test() +{ + fio -h &> /dev/null || die "fio not found" + + # create a simple raid6 + mdadm -Cv -R -n 6 -l6 $md0 $devs --assume-clean || die "create raid6 failed" + + # trigger dirty pages write back + echo 0 > /proc/sys/vm/dirty_background_ratio +} + +clean_up_test() +{ + echo $old > /proc/sys/vm/dirty_background_ratio + + pkill -9 fio + kill -9 $pid + + sleep 1 + + if ps $pid | tail -1 | awk '{print $3}' | grep D; then + die "thread that is writing sysfs is stuck in D state, deadlock is triggered" + fi + mdadm -S $md0 +} + +trap 'clean_up_test' EXIT + +set_up_test || die "set up test failed" + +test_write_back & + +test_write_action & +pid="$!" + +sleep $runtime + +exit 0 From patchwork Mon May 29 13:28:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258596 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24CD7C7EE2E for ; Mon, 29 May 2023 13:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjE2NcW (ORCPT ); Mon, 29 May 2023 09:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbjE2NcM (ORCPT ); Mon, 29 May 2023 09:32:12 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576BED9 for ; Mon, 29 May 2023 06:32:10 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGfG3Yhkz4f3pr1 for ; Mon, 29 May 2023 21:32:06 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S9; Mon, 29 May 2023 21:32:07 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 5/8] tests: add a regression test that raid456 can't assemble Date: Mon, 29 May 2023 21:28:23 +0800 Message-Id: <20230529132826.2125392-6-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBH_rFSqXRkMLjoKQ--.57183S9 X-Coremail-Antispam: 1UD129KBjvJXoW7Ww13KFyxKFyUWFyDCFW3Jrb_yoW8Xr48pa nxurnIkr4xAFs2yFZIg3WrWa4rWaykJrW5C3sxJr1Ikr47uryIv3yxKF15tryxXr4I9ay5 Z34kKa4fGw40k3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBSb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAI cVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2js IEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxUoeOJUUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai If recovery is interrupted and reshape is started, then this array can't assemble anymore. The problem is supposed to be fixed by [1]. [1] https://lore.kernel.org/linux-raid/20230529031045.1760883-1-yukuai1@huaweicloud.com/ Signed-off-by: Yu Kuai --- tests/25raid456-reshape-while-recovery | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/25raid456-reshape-while-recovery diff --git a/tests/25raid456-reshape-while-recovery b/tests/25raid456-reshape-while-recovery new file mode 100644 index 00000000..b9f871f2 --- /dev/null +++ b/tests/25raid456-reshape-while-recovery @@ -0,0 +1,32 @@ +devs="$dev0 $dev1 $dev2" + +set_up_test() +{ + mdadm -Cv -R -n 3 -l5 $md0 $devs --assume-clean --size=50M || die "create array failed" + mdadm -a $md0 $dev3 $dev4 || die "failed to bind new disk to array" + echo 1000 > /sys/block/md0/md/sync_speed_max +} + +clean_up_test() +{ + mdadm -S $md0 +} + +trap 'clean_up_test' EXIT + +set_up_test || die "set up test failed" + +# set up replacement +echo want_replacement > /sys/block/md0/md/rd0/state +sleep 1 + +# trigger reshape +echo frozen > /sys/block/md0/md/sync_action +mdadm --grow -l 6 $md0 +sleep 1 + +# reassemeble array +mdadm -S $md0 || die "can't stop array" +mdadm --assemble $md0 $devs $dev3 $dev4 || die "can't assemble array" + +exit 0 From patchwork Mon May 29 13:28:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258592 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3ABFC77B7E for ; Mon, 29 May 2023 13:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229606AbjE2NcR (ORCPT ); Mon, 29 May 2023 09:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbjE2NcO (ORCPT ); Mon, 29 May 2023 09:32:14 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FBF3E0 for ; Mon, 29 May 2023 06:32:12 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4QVGfG1pQcz4f3nx7 for ; Mon, 29 May 2023 21:32:06 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S10; Mon, 29 May 2023 21:32:07 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 6/8] tests: add a regression test that raid456 can't assemble again Date: Mon, 29 May 2023 21:28:24 +0800 Message-Id: <20230529132826.2125392-7-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBH_rFSqXRkMLjoKQ--.57183S10 X-Coremail-Antispam: 1UD129KBjvJXoW7tw43Ar1xCF13uFW3Ww48Zwb_yoW8GF4xpw sxZF9Ikr4UCanayFW3G3WfWa4rWaykJrWYkwsxXF1IkrW3Zr1vvw4xKF1YyryfXr4I9395 u34kKa4Fgw1FkaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBSb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAI cVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2js IEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxUoeOJUUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai This is a regression test for commit 0aecb06e2249 ("md/raid5: don't allow replacement while reshape is in progress"). Signed-off-by: Yu Kuai --- tests/25raid456-recovery-while-reshape | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/25raid456-recovery-while-reshape diff --git a/tests/25raid456-recovery-while-reshape b/tests/25raid456-recovery-while-reshape new file mode 100644 index 00000000..3f6251bf --- /dev/null +++ b/tests/25raid456-recovery-while-reshape @@ -0,0 +1,33 @@ +devs="$dev0 $dev1 $dev2" + +set_up_test() +{ + mdadm -Cv -R -n 3 -l5 $md0 $devs --assume-clean --size=50M || die "create array failed" + mdadm -a $md0 $dev3 $dev4 || die "failed to bind new disk to array" + echo 1000 > /sys/block/md0/md/sync_speed_max +} + +clean_up_test() +{ + mdadm -S $md0 +} + +trap 'clean_up_test' EXIT + +set_up_test || die "set up test failed" + +# trigger reshape +mdadm --grow -l 6 $md0 +sleep 1 + +# set up replacement +echo frozen > /sys/block/md0/md/sync_action +echo want_replacement > /sys/block/md0/md/rd0/state +echo reshape > /sys/block/md0/md/sync_action +sleep 1 + +# reassemeble array +mdadm -S $md0 || die "can't stop array" +mdadm --assemble $md0 $devs $dev3 $dev4 || die "can't assemble array" + +exit 0 From patchwork Mon May 29 13:28:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258593 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B108C7EE2E for ; Mon, 29 May 2023 13:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbjE2NcS (ORCPT ); Mon, 29 May 2023 09:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjE2NcN (ORCPT ); Mon, 29 May 2023 09:32:13 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30F49B7 for ; Mon, 29 May 2023 06:32:11 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGfH3mdQz4f3v4k for ; Mon, 29 May 2023 21:32:07 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S11; Mon, 29 May 2023 21:32:08 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 7/8] tests: add a regression test that reshape can corrupt data Date: Mon, 29 May 2023 21:28:25 +0800 Message-Id: <20230529132826.2125392-8-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRAN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2js IEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxUoeOJUUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai This is a regression test for commit 1544e95c6dd8 ("md: fix data corruption for raid456 when reshape restart while grow up"). Signed-off-by: Yu Kuai --- tests/25raid456-reshape-corrupt-data | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/25raid456-reshape-corrupt-data diff --git a/tests/25raid456-reshape-corrupt-data b/tests/25raid456-reshape-corrupt-data new file mode 100644 index 00000000..fdb875fb --- /dev/null +++ b/tests/25raid456-reshape-corrupt-data @@ -0,0 +1,35 @@ +devs="$dev0 $dev1 $dev2" + +set_up_test() +{ + mdadm -Cv -R -n 3 -l5 $md0 $devs --size=50M || die "create array failed" + mdadm -a $md0 $dev3 || die "failed to bind new disk to array" + mkfs.xfs -f $md0 || die "mkfs failed" + xfs_ncheck $md0 || die "check fs failed" +} + +clean_up_test() +{ + mdadm -S $md0 +} + +trap 'clean_up_test' EXIT + +set_up_test || die "set up test failed" + +# trigger reshape +echo 1000 > /sys/block/md0/md/sync_speed_max +mdadm --grow -l 6 $md0 +sleep 1 + +# stop and start reshape +echo frozen > /sys/block/md0/md/sync_action +echo system > /sys/block/md0/md/sync_speed_max +echo reshape > /sys/block/md0/md/sync_action + +mdadm -W $md0 + +# check if data is corrupted +xfs_ncheck $md0 || die "data is corrupted after reshape" + +exit 0 From patchwork Mon May 29 13:28:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13258594 X-Patchwork-Delegate: jes@trained-monkey.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68AF2C77B7A for ; Mon, 29 May 2023 13:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjE2NcU (ORCPT ); Mon, 29 May 2023 09:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbjE2NcN (ORCPT ); Mon, 29 May 2023 09:32:13 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8239BDF for ; Mon, 29 May 2023 06:32:11 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4QVGfH0swbz4f3nxN for ; Mon, 29 May 2023 21:32:07 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBH_rFSqXRkMLjoKQ--.57183S12; Mon, 29 May 2023 21:32:08 +0800 (CST) From: Yu Kuai To: linux-raid@vger.kernel.org, mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org, pmenzel@molgen.mpg.de, logang@deltatee.com, song@kernel.org, guoqing.jiang@linux.dev Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 8/8] tests: add a regression test for raid456 deadlock again Date: Mon, 29 May 2023 21:28:26 +0800 Message-Id: <20230529132826.2125392-9-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529132826.2125392-1-yukuai1@huaweicloud.com> References: <20230529132826.2125392-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBH_rFSqXRkMLjoKQ--.57183S12 X-Coremail-Antispam: 1UD129KBjvJXoW7tw43Ar1xCF13uw13Zr1DZFb_yoW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35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai This is a regression test for commit ("md/raid5: fix a deadlock in the case that reshape is interrupted"). Signed-off-by: Yu Kuai --- tests/25raid456-reshape-deadlock | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/25raid456-reshape-deadlock diff --git a/tests/25raid456-reshape-deadlock b/tests/25raid456-reshape-deadlock new file mode 100644 index 00000000..bfa0cc56 --- /dev/null +++ b/tests/25raid456-reshape-deadlock @@ -0,0 +1,34 @@ +devs="$dev0 $dev1 $dev2" + +set_up_test() +{ + mdadm -Cv -R -n 3 -l5 $md0 $devs --size=50M || die "create array failed" + mdadm -a $md0 $dev3 || die "failed to bind new disk to array" + echo 1000 > /sys/block/md0/md/sync_speed_max +} + +clean_up_test() +{ + echo idle > /sys/block/md0/md/sync_action + mdadm -S $md0 +} + +trap 'clean_up_test' EXIT + +set_up_test || die "set up test failed" + +# trigger reshape +mdadm --grow -l 6 $md0 +sleep 1 + +# stop reshape +echo frozen > /sys/block/md0/md/sync_action + +# read accross reshape +dd if=$md0 of=/dev/NULL bs=1m count=100 iflag=direct &> /dev/null & +sleep 2 + +# suspend array +echo 1 > /sys/block/md0/md/suspend_lo + +exit 0