From patchwork Tue Aug 8 22:40:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13347122 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 5985AC04E69 for ; Tue, 8 Aug 2023 22:41:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbjHHWlA (ORCPT ); Tue, 8 Aug 2023 18:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbjHHWlA (ORCPT ); Tue, 8 Aug 2023 18:41:00 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8238AFE for ; Tue, 8 Aug 2023 15:40:59 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3BC4A220F4 for ; Tue, 8 Aug 2023 22:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691534458; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TN1iAzD1c46swHcK3wbG5q+6/0YrH8TH9/ePZT6UiMo=; b=axuxxvATvJtqA/fx6RGYZur171A6/8nngSojmn6tuVJTJvUcVRzwvVcIlvVGssyrhRyxVl Gg4aAKWEYihk3c188VzW6idZyvWbm3+o6PA992VRCn7g/C4XbTQXcjhcggVNWQbT4/Joxu ItspVWWEBT7ThucQqteBRd8n1RcKvYg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 91470139D1 for ; Tue, 8 Aug 2023 22:40:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0OgMF3nE0mQICgAAMHmgww (envelope-from ) for ; Tue, 08 Aug 2023 22:40:57 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/4] btrfs-progs: tests/mkfs/005: use udevadm settle to avoid false alerts Date: Wed, 9 Aug 2023 06:40:41 +0800 Message-ID: <688da51813559124605fca0f67c178095baca8d2.1691533896.git.wqu@suse.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org [BUG] During my test runs of mkfs-tests, 005-long-device-name-for-ssd failed with the following error messages: ====== RUN CHECK dmsetup remove btrfs-test-with-very-long-name-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQPGc device-mapper: remove ioctl on btrfs-test-with-very-long-name-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQPGc failed: Device or resource busy Command failed. failed: dmsetup remove btrfs-test-with-very-long-name-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQPGc test failed for case 005-long-device-name-for-ssd [CAUSE] There seems to be a race between "btrfs inspect dump-super" and the dmsetup removal. [FIX] Add a "udevadm settle" before removing the dm devices. Also since we're here, use the same "udevadm settle" instead of the manual sleep to wait for the new dm device to showup. Signed-off-by: Qu Wenruo --- tests/mkfs-tests/005-long-device-name-for-ssd/test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh index 208698dce243..c32eb3a42def 100755 --- a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh +++ b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh @@ -24,7 +24,7 @@ loopdev=`run_check_stdout $SUDO_HELPER losetup --find --show img` run_check $SUDO_HELPER dmsetup create "$dmname" --table "0 1048576 linear $loopdev 0" # Setting up the device may need some time to appear -sleep 5 +run_check $SUDO_HELPER udevadm settle if ! [ -b "$dmdev" ]; then _not_run "dm device created but not visible in /dev/mapper" fi @@ -43,6 +43,8 @@ run_check_stdout $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@" "$dmdev" | grep -q 'SSD detected:.*yes' || _fail 'SSD not detected' run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$dmdev" +run_check $SUDO_HELPER udevadm settle + # cleanup run_check $SUDO_HELPER dmsetup remove "$dmname" run_mayfail $SUDO_HELPER losetup -d "$loopdev" From patchwork Tue Aug 8 22:40:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13347123 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 754CAC001DB for ; Tue, 8 Aug 2023 22:41:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbjHHWlB (ORCPT ); Tue, 8 Aug 2023 18:41:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbjHHWlB (ORCPT ); Tue, 8 Aug 2023 18:41:01 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 831FDFD for ; Tue, 8 Aug 2023 15:41:00 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 47CCE1F853 for ; Tue, 8 Aug 2023 22:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691534459; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VpcJUfyx823L0mpm43zyNXi7pxT46u0NGb5HMam35y0=; b=RzrvHuKRoVAkjCdRX1zXQBBx9U0B1Y4XoUJ4km9Mp6npByR2phU3og4t+S7dnK8amGlmGU yQiyYvxCP4WVGgGbnWg0ReUgqepVpSUNT53vZgOjKRJ45jPx2eVKV8KS6IDHN7Du17WiSM WoYXNGPQyK4mEZCndEh/R8+i0ziAhgY= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9D761139D1 for ; Tue, 8 Aug 2023 22:40:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wMf5GXrE0mQICgAAMHmgww (envelope-from ) for ; Tue, 08 Aug 2023 22:40:58 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/4] btrfs-progs: tests/misc/030: do not require v1 cache for the test case Date: Wed, 9 Aug 2023 06:40:42 +0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org [PROBLEM] Since we have migrated to default v2 cache, the test case misc/030-missing-device-image is no longer executed: [TEST/misc] 030-missing-device-image [NOTRUN] unable to create v1 space cache [CAUSE] The test case itself is trying its best to cover all paths, including the data extent read path. Thus the test case is requiring v1 cache, as that's the only way to cover the data read path. [FIX] Just remove the v1 space cache requirement, it's still better to run the test even it only exercises the metadata read path. The good news is, after commit 3ff9d352576b ("btrfs-progs: use read_data_from_disk() to replace read_extent_from_disk() and replace read_extent_data()"), all data/metadata read paths are unified. They only differ in the verification part. Thus even if we didn't fully exercise the data read path, we didn't lose much coverage anyway. Signed-off-by: Qu Wenruo --- tests/misc-tests/030-missing-device-image/test.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/misc-tests/030-missing-device-image/test.sh b/tests/misc-tests/030-missing-device-image/test.sh index be022c4bb9eb..1438f8a45229 100755 --- a/tests/misc-tests/030-missing-device-image/test.sh +++ b/tests/misc-tests/030-missing-device-image/test.sh @@ -37,14 +37,6 @@ test_missing() run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/b" bs=4k count=1000 conv=sync run_check $SUDO_HELPER umount "$TEST_MNT" - # make sure we have space cache - if ! run_check_stdout "$TOP/btrfs" inspect dump-tree -t root "$dev1" | - grep -q "EXTENT_DATA"; then - # Normally the above operation should create the space cache. - # If not, it may mean we have migrated to v2 cache by default - _not_run "unable to create v1 space cache" - fi - # now wipe the device run_check wipefs -fa "$bad_dev" From patchwork Tue Aug 8 22:40:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13347124 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 EEA89C04FDF for ; Tue, 8 Aug 2023 22:41:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjHHWlD (ORCPT ); Tue, 8 Aug 2023 18:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbjHHWlC (ORCPT ); Tue, 8 Aug 2023 18:41:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA444FD for ; Tue, 8 Aug 2023 15:41:01 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 55DED1F45E for ; Tue, 8 Aug 2023 22:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691534460; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w8bhDiSiUrx/6Flv2xsJfVr9psz/69NC0dqq1ZfcFIY=; b=Y6wkzddD3mtwbjcDz1sSzk9heM55wqnZMvyd1R4Oe/hIXgE9z2eixW0Uv6NfEwRete5Qeg TvWvwuaLmF2abFMj5vZ7pTr/xqRe9wVYTbI7+KD/mwxvIiNTYTj/ucwM+ijl0Jji/9CrXB ujZI4CBuEjKwoCXlpyXrL6du0yDVk/A= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AAD88139D1 for ; Tue, 8 Aug 2023 22:40:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iI/kHHvE0mQICgAAMHmgww (envelope-from ) for ; Tue, 08 Aug 2023 22:40:59 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/4] btrfs-progs: tests/misc/046: fix false alerts on write detection Date: Wed, 9 Aug 2023 06:40:43 +0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org [BUG] Test case misc/046-seed-multi-mount would always fail with the following error: [TEST] misc-tests.sh [TEST/misc] 046-seed-multi-mount unexpected success: writable file despite read-only mount test failed for case 046-seed-multi-mount [CAUSE] Although mounting seed device is indeed read-only, sprouting it with a new device would always make it read-write by itself. The behavior is already there for a long time, thus expecting a new behavior (not changing the read-only flag) is a little weird. [FIX] Instead of doing the write check after the sprout, do it before the sprout. This looks more correct, and would not rely on the kernel behavior change (if we determine to go that path). Signed-off-by: Qu Wenruo --- tests/misc-tests/046-seed-multi-mount/test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/misc-tests/046-seed-multi-mount/test.sh b/tests/misc-tests/046-seed-multi-mount/test.sh index 83f7a91effdd..95654fd904ff 100755 --- a/tests/misc-tests/046-seed-multi-mount/test.sh +++ b/tests/misc-tests/046-seed-multi-mount/test.sh @@ -42,9 +42,11 @@ nextdevice() { run_check mkdir -p "$mnt" TEST_MNT="$mnt" run_check_mount_test_dev - run_check $SUDO_HELPER "$TOP/btrfs" device add ${loopdevs[$nextdev]} "$TEST_MNT" run_mustfail "writable file despite read-only mount" \ $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/file$nextdevice" bs=1M count=1 status=none + run_check $SUDO_HELPER "$TOP/btrfs" device add ${loopdevs[$nextdev]} "$TEST_MNT" + # Although seed sprout would make the fs RW, explicitly remount it RW + # just in case of future behavior change. run_check $SUDO_HELPER mount -o remount,rw "$TEST_MNT" # Rewrite the file md5sum=$(run_check_stdout md5sum "$TEST_MNT/file$nextdev" | awk '{print $1}') From patchwork Tue Aug 8 22:40:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13347125 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 36DACC04E69 for ; Tue, 8 Aug 2023 22:41:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjHHWlE (ORCPT ); Tue, 8 Aug 2023 18:41:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbjHHWlD (ORCPT ); Tue, 8 Aug 2023 18:41:03 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC02FD for ; Tue, 8 Aug 2023 15:41:02 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 617B81F853 for ; Tue, 8 Aug 2023 22:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691534461; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ff7alGF9fATTFj75SKCxHOxDxpbQoDt65+5iOilJ3pQ=; b=VgDHnu2D6aVHgoT9rF/hRmOJiXyLwPPuvszwiKnybGlImYyeqDYXDN+sj8qlKgNEHUjeIy suV1tH5GDgsqrAMWVuuJQUoCuJ1thZTNmF3PE7iuZHeECfaGKD8EPlAnimAgTlCkpa1PIJ FzcClopOrvjy5A/xh+4Wl4e3cmvvuH4= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B6EC4139D1 for ; Tue, 8 Aug 2023 22:41:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cL8eIHzE0mQICgAAMHmgww (envelope-from ) for ; Tue, 08 Aug 2023 22:41:00 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 4/4] btrfs-progs: tests/misc/058: reduce the space requirement and speed up the test Date: Wed, 9 Aug 2023 06:40:44 +0800 Message-ID: <173e7faa9202a5d3438cd5bbdca765708f3bc729.1691533896.git.wqu@suse.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org [BUG] When I was testing misc/058, the fs still has around 7GiB free space, but during that test case, btrfs kernel module reports write failures and even git commands failed inside that fs. And obviously the test case failed. [CAUSE] It turns out that, the test case itself would require 6GiB (4 data disks) + 1.5GiB x 2 (the two replace target), thus it requires 9 GiB free space. And obviously my partition is not that large and failed. [FIX] In fact, we really don't need that much space at all. Our objective is to test "btrfs device replace --enqueue" functionality, there is not much need to wait for 1 second, we can just do the enqueue immediately. So this patch would reduce the file size to a more sane (and rounded) 2GiB, and do the enqueue immediately. Signed-off-by: Qu Wenruo --- tests/misc-tests/058-replace-start-enqueue/test.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/misc-tests/058-replace-start-enqueue/test.sh b/tests/misc-tests/058-replace-start-enqueue/test.sh index 1a24d5ec7ecb..bdbc87b4090d 100755 --- a/tests/misc-tests/058-replace-start-enqueue/test.sh +++ b/tests/misc-tests/058-replace-start-enqueue/test.sh @@ -21,16 +21,15 @@ run_check_mount_test_dev run_check $SUDO_HELPER "$TOP/btrfs" device remove "$REPLACE1" "$TEST_MNT" run_check $SUDO_HELPER "$TOP/btrfs" device remove "$REPLACE2" "$TEST_MNT" -for i in `seq 48`; do +for i in `seq 16`; do run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/file$i" bs=1M count=128 status=noxfer done # Sync so replace start does not block in unwritten IO run_check "$TOP/btrfs" filesystem sync "$TEST_MNT" run_check "$TOP/btrfs" filesystem usage -T "$TEST_MNT" -# Go background, should not be that fast, estimated 10 seconds +# Go background, should not be that fast. run_check $SUDO_HELPER "$TOP/btrfs" replace start 2 "$REPLACE1" "$TEST_MNT" -run_check sleep 1 # No background, should wait run_check $SUDO_HELPER "$TOP/btrfs" replace start --enqueue 3 "$REPLACE2" "$TEST_MNT" run_check $SUDO_HELPER "$TOP/btrfs" replace status "$TEST_MNT"