From patchwork Wed Jan 18 00:43:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13105335 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 7CA82C38159 for ; Wed, 18 Jan 2023 00:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229933AbjARAzz (ORCPT ); Tue, 17 Jan 2023 19:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbjARAzL (ORCPT ); Tue, 17 Jan 2023 19:55:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE0AF521E0; Tue, 17 Jan 2023 16:43:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 87508615AC; Wed, 18 Jan 2023 00:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E591BC433EF; Wed, 18 Jan 2023 00:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674002581; bh=Fb6oqW1tMHFVsrwKrrchD42lq9oZroRnmzUNq8BhvT0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=eHk2GDTmG3T5alcK/kZHKRhhgqkVZye5+NhIg7IqecKpEhC7i0rW//o1K+cFSUupg tNA7lXeAUXN6CuA2cdshrxO06TSIvSnDySfinN5tVa2Kc1Qysrp14H+fHie8jYieIT 7GJbMwratgU9N5/IBeW5miWZIkTzox9UeAJf63I0AgjGjhIqUZGlDowKdz3P1Eu9mY IX4Rmg3V/zho4cCFS3gDWJzjFANYCr1nTUnRZdKLpUiD9pypg9bY3Q2VVB93B+hctg 5szH8lA9VWT4EUKbpwU6EsUEVWStRB2GbB7maMJ/CxmFvkwY/SRcuBgyZVO8bceLWQ UYdLxctGNMQfQ== Date: Tue, 17 Jan 2023 16:43:00 -0800 Subject: [PATCH 1/3] xfs: skip fragmentation tests when alwayscow mode is enabled From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Message-ID: <167400102759.1914975.16224258103457998795.stgit@magnolia> In-Reply-To: <167400102747.1914975.6709564559821901777.stgit@magnolia> References: <167400102747.1914975.6709564559821901777.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong If the always_cow debugging flag is enabled, all file writes turn into copy writes. This dramatically ramps up fragmentation in the filesystem (intentionally!) so there's no point in complaining about fragmentation. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- common/xfs | 9 +++++++++ tests/xfs/182 | 1 + tests/xfs/192 | 1 + tests/xfs/198 | 1 + tests/xfs/204 | 1 + tests/xfs/211 | 1 + 6 files changed, 14 insertions(+) diff --git a/common/xfs b/common/xfs index 7eee76c0ee..a00d90a4b5 100644 --- a/common/xfs +++ b/common/xfs @@ -1108,6 +1108,15 @@ _require_no_xfs_bug_on_assert() fi } +# Require that XFS is not configured in always_cow mode. +_require_no_xfs_always_cow() +{ + if [ -f /sys/fs/xfs/debug/always_cow ]; then + grep -q "1" /sys/fs/xfs/debug/always_cow && \ + _notrun "test requires XFS always_cow to be off, turn it off to run the test" + fi +} + # Get a metadata field # The first arg is the field name # The rest of the arguments are xfs_db commands to find the metadata. diff --git a/tests/xfs/182 b/tests/xfs/182 index 696b933e60..511aca6f2d 100755 --- a/tests/xfs/182 +++ b/tests/xfs/182 @@ -24,6 +24,7 @@ _require_cp_reflink _require_xfs_io_command "fiemap" _require_xfs_io_command "cowextsize" _require_odirect +_require_no_xfs_always_cow # writes have to converge to overwrites echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 diff --git a/tests/xfs/192 b/tests/xfs/192 index ced18fa3c1..eb577f15fc 100755 --- a/tests/xfs/192 +++ b/tests/xfs/192 @@ -26,6 +26,7 @@ _require_xfs_io_command "fiemap" _require_xfs_io_command "cowextsize" _require_xfs_io_command "funshare" _require_odirect +_require_no_xfs_always_cow # writes have to converge to overwrites echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 diff --git a/tests/xfs/198 b/tests/xfs/198 index c61fbab70d..e5b98609de 100755 --- a/tests/xfs/198 +++ b/tests/xfs/198 @@ -23,6 +23,7 @@ _require_cp_reflink _require_xfs_io_command "fiemap" _require_xfs_io_command "cowextsize" _require_odirect +_require_no_xfs_always_cow # writes have to converge to overwrites echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 diff --git a/tests/xfs/204 b/tests/xfs/204 index ca21dfe722..7d6b79a86d 100755 --- a/tests/xfs/204 +++ b/tests/xfs/204 @@ -28,6 +28,7 @@ _require_xfs_io_command "fiemap" _require_xfs_io_command "cowextsize" _require_xfs_io_command "funshare" _require_odirect +_require_no_xfs_always_cow # writes have to converge to overwrites echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 diff --git a/tests/xfs/211 b/tests/xfs/211 index 96c0b85b14..3ce6496afc 100755 --- a/tests/xfs/211 +++ b/tests/xfs/211 @@ -24,6 +24,7 @@ _require_cp_reflink _require_xfs_io_command "fiemap" _require_xfs_io_command "cowextsize" _require_odirect +_require_no_xfs_always_cow # writes have to converge to overwrites echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 From patchwork Wed Jan 18 00:43:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13105336 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 021B5C00A5A for ; Wed, 18 Jan 2023 00:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbjARA4H (ORCPT ); Tue, 17 Jan 2023 19:56:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbjARAzu (ORCPT ); Tue, 17 Jan 2023 19:55:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B11F53578; Tue, 17 Jan 2023 16:43:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1823761598; Wed, 18 Jan 2023 00:43:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A5DC433D2; Wed, 18 Jan 2023 00:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674002596; bh=xFx4DwWNh6w9yII6olWGnSqQcMNQe19xFRRYflB13OU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=r4EMxF3FOJG/vvy36skErNHFtFT86xAo0kELe5cqhKrP4w92bzj9CE7Gz6f+Z9RWJ HqMoMmMcNh18rHPz8e0i86izYKx+NNVq9QllhdtmLDn0XYcmdttz3s9O57SHX/rFPe DNJgmTxrgcYsofc3J5yoeIeHZkUd/mt7q1LtcpqHS8ilUJvO+EAOIEkPvpI0Km0hSM kO+SEckVeQGzJO2MDulY/aSuO5a5cucpzXDcmVE+3QujqOxgt7z+jO0Dqbr9pnJ9rT M4ZJ5YY0F9A2lU12DuuvioibhZCK3c7K8mXzNvvqj9P9InifIam5Um2KlICnSFZ5uW M+cpFb14SKN6w== Date: Tue, 17 Jan 2023 16:43:16 -0800 Subject: [PATCH 2/3] xfs/{080,329,434,436}: add missing check for fallocate support From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Message-ID: <167400102773.1914975.13189675469601933878.stgit@magnolia> In-Reply-To: <167400102747.1914975.6709564559821901777.stgit@magnolia> References: <167400102747.1914975.6709564559821901777.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Don't run this test if the filesystem doesn't support fallocate. This is only ever the case if always_cow is enabled. The same logic applies to xfs/329, though it's more subtle because the test itself does not explicitly invoke fallocate; rather, it is xfs_fsr that requires fallocate. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- tests/xfs/080 | 1 + tests/xfs/329 | 1 + tests/xfs/434 | 1 + tests/xfs/436 | 1 + 4 files changed, 4 insertions(+) diff --git a/tests/xfs/080 b/tests/xfs/080 index 20b20a08eb..abcfa004b5 100755 --- a/tests/xfs/080 +++ b/tests/xfs/080 @@ -21,6 +21,7 @@ _cleanup() _supported_fs xfs _require_test +_require_xfs_io_command falloc # iogen requires falloc quiet=-q clean=-c diff --git a/tests/xfs/329 b/tests/xfs/329 index 4cad686c17..15dc3c242f 100755 --- a/tests/xfs/329 +++ b/tests/xfs/329 @@ -22,6 +22,7 @@ _require_cp_reflink _require_command "$XFS_FSR_PROG" "xfs_fsr" _require_xfs_io_error_injection "bmap_finish_one" _require_xfs_scratch_rmapbt +_require_xfs_io_command falloc # fsr requires support for preallocation rm -f "$seqres.full" diff --git a/tests/xfs/434 b/tests/xfs/434 index 576f1b0e1e..de52531053 100755 --- a/tests/xfs/434 +++ b/tests/xfs/434 @@ -35,6 +35,7 @@ _require_quota _require_scratch_reflink _require_cp_reflink _require_command "$XFS_FSR_PROG" "xfs_fsr" +_require_xfs_io_command falloc # fsr requires support for preallocation _require_xfs_io_error_injection "bmap_finish_one" _require_xfs_scratch_rmapbt diff --git a/tests/xfs/436 b/tests/xfs/436 index 9e6ec9372d..b95da8abf4 100755 --- a/tests/xfs/436 +++ b/tests/xfs/436 @@ -30,6 +30,7 @@ _supported_fs xfs _require_loadable_fs_module "xfs" _require_scratch_reflink _require_cp_reflink +_require_xfs_io_command falloc # fsr requires support for preallocation _require_command "$XFS_FSR_PROG" "xfs_fsr" _require_xfs_io_error_injection "bmap_finish_one" _require_xfs_scratch_rmapbt From patchwork Wed Jan 18 00:43:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13105337 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 8D099C38147 for ; Wed, 18 Jan 2023 00:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbjARA4v (ORCPT ); Tue, 17 Jan 2023 19:56:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjARA4H (ORCPT ); Tue, 17 Jan 2023 19:56:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD31253F9A; Tue, 17 Jan 2023 16:43:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A729A6159F; Wed, 18 Jan 2023 00:43:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D2E6C433EF; Wed, 18 Jan 2023 00:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674002612; bh=k9B1yMSPPgwPTCdmLCZKzXMwT/SeamJUv2emMzpV4Bw=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Tqco34qTFzx95y7ZnRHxY1LMlovFK0K/n6r8JudkR26uNW9H0qAVrz9avpKhtaM0q ZiyLTaB8o5Hnhihtwp+I5sBOcVGRRPge1H6eeXBnIq0JwCRpzUE5kuPB/gRgzgce28 gQRgkiheslxONrVXddRctMXAeWbM/cHPn2puUmjAQrqi2RQzAz5D1Va8jA/yoZBrXV 09Pxt0FHpTje0gLLFibye3uTfmdNlK3lx2F0BoX8ZgLFB1X6VTA4HBmKLEWgknZAbm unpL182ucBsxT3EyLdL7ycObeQ2ZoneQ79hn0ZgzvPvXxbYaEj6sbWtHEBRL9XwCSi MVeIBRxOMa+xQ== Date: Tue, 17 Jan 2023 16:43:31 -0800 Subject: [PATCH 3/3] various: test is not appropriate for always_cow mode From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Message-ID: <167400102786.1914975.17542930173906194035.stgit@magnolia> In-Reply-To: <167400102747.1914975.6709564559821901777.stgit@magnolia> References: <167400102747.1914975.6709564559821901777.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong When always_cow mode is enabled, thes tests cannot set up the preconditions for the functionality that they wants to test and should be skipped. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- tests/generic/392 | 10 ++++++++++ tests/xfs/326 | 12 ++++++++++++ tests/xfs/558 | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/tests/generic/392 b/tests/generic/392 index ac4014ab0c..c4bb3f4b92 100755 --- a/tests/generic/392 +++ b/tests/generic/392 @@ -28,6 +28,16 @@ _scratch_mkfs >/dev/null 2>&1 _require_metadata_journaling $SCRATCH_DEV _scratch_mount +# This test requires that i_blocks remains unchanged from the start of the +# check_inode_metadata call until after recovery is complete. fpunch calls +# turn into pagecache writes if the arguments are not aligned to the fs +# blocksize. If the range being punched is already mapped to a written extent +# and alwayscow is enabled, i_blocks will increase by the size of the COW +# staging extent. This causes stat to report different numbers for %b, which +# results in a test failure. Hence do not run this test if XFS is in alwayscow +# mode. +test "$FSTYP" = "xfs" && _require_no_xfs_always_cow + testfile=$SCRATCH_MNT/testfile # check inode metadata after shutdown diff --git a/tests/xfs/326 b/tests/xfs/326 index 8ab60684bf..ac620fc433 100755 --- a/tests/xfs/326 +++ b/tests/xfs/326 @@ -43,6 +43,18 @@ _scratch_mount >> $seqres.full _require_congruent_file_oplen $SCRATCH_MNT $blksz $XFS_IO_PROG -c "cowextsize $sz" $SCRATCH_MNT +# This test uses a very large cowextszhint to manipulate the COW fork to +# contain a large unwritten extent before injecting the error. The goal is +# that the write() will succeed, writeback will flush the dirty data to disk, +# and writeback completion will shut down the filesystem when it tries to +# remove the staging extent record from the refcount btree. In other words, +# this test ensures that XFS always finishes a COW completion it has started. +# +# This test isn't compatible with always_cow mode because the hole in the COW +# fork left by the first write means that writeback tries to allocate a COW +# staging extent for an unshared extent and trips over the injected error. +_require_no_xfs_always_cow + echo "Create files" _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2 diff --git a/tests/xfs/558 b/tests/xfs/558 index 819faf22bc..9e9b3be867 100755 --- a/tests/xfs/558 +++ b/tests/xfs/558 @@ -114,6 +114,12 @@ _require_xfs_io_error_injection "wb_delay_ms" _require_scratch_reflink _require_cp_reflink +# This test races writeback of a pure overwrite of a data fork extent against +# the creation of a speculative COW preallocation. In alwayscow mode, there +# are no pure overwrites, which means that a precondition of the test is not +# satisfied, and this test should be skipped. +_require_no_xfs_always_cow + _scratch_mkfs >> $seqres.full _scratch_mount >> $seqres.full