From patchwork Wed May 12 02:01:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4974DC433B4 for ; Wed, 12 May 2021 02:01:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1967C61166 for ; Wed, 12 May 2021 02:01:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230414AbhELCCz (ORCPT ); Tue, 11 May 2021 22:02:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:49244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbhELCCz (ORCPT ); Tue, 11 May 2021 22:02:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01FA4610EA; Wed, 12 May 2021 02:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784908; bh=kinM7C0LmXrsdhExmdtvm6AYJNahDP+OdN/yzlFtOIs=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=MV3IpPQOXeS4+u5PZoBbUw/YfMFgPD9AMQg/o6+0iRBmvgaRPXWuA5unY37n9hxjH pjoS2u4yEkT1TuE2GvL0yfVenw2NB8LyynOwxfu0PgktClLnLQ5APgoMUhvpy7nuyQ 1gwv2dwzt/p9Cc13nQpyWIMdGsOaViys/p0bEpZe3he//Gd5+IFJ92qnGd2JRw/Ds2 qgvW1KQQU4ORu799ZyOEG1Up8aDGn8aRAzDfllzU5daKTHAl+GxQCgYkmNSU8urcnZ 6bmgYG6JuomRFXnjubpq3ABCvySjzVGo7N5ViyhsOzYG44ldJvfRirN9F28TP4Bbq8 KvjzlawVXc5eQ== Subject: [PATCH 1/8] xfs/122: add entries for structures added to 5.13 From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:01:45 -0700 Message-ID: <162078490538.3302755.11517881840628679922.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 Add a new entry for a structure that was changed in 5.13. Signed-off-by: Darrick J. Wong --- tests/xfs/122.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index f229465a..7607f0a5 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -99,6 +99,7 @@ sizeof(struct xfs_inumbers) = 24 sizeof(struct xfs_inumbers_req) = 64 sizeof(struct xfs_legacy_timestamp) = 8 sizeof(struct xfs_log_dinode) = 176 +sizeof(struct xfs_log_legacy_timestamp) = 8 sizeof(struct xfs_map_extent) = 32 sizeof(struct xfs_phys_extent) = 16 sizeof(struct xfs_refcount_key) = 4 From patchwork Wed May 12 02:01:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, LOTS_OF_MONEY,MAILING_LIST_MULTI,MONEY_NOHTML,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECB1AC433B4 for ; Wed, 12 May 2021 02:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1171610EA for ; Wed, 12 May 2021 02:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbhELCDB (ORCPT ); Tue, 11 May 2021 22:03:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:49388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbhELCDA (ORCPT ); Tue, 11 May 2021 22:03:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9AA4C61166; Wed, 12 May 2021 02:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784913; bh=EMbXuOeK5J0ubX7gtp/s1a0yy9J7P4qptIZ2bQ1wANU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=s0hRuBtS7CfT+aMowrrtXCPGTUlHhhWdt3R4OMEZCXJrIa1rVW2EVoANk33eSjYpq BLwyo4gGsn9MOXBJ7QLn8YS1zDVFHnhjwR9M4C9JfC8S+kR/8hIlY5+obgn6MErOd0 FSt7fnQEiTyrsgGyix+/cQ5rlQ6h+PC7f3jpQwnt+N1B+23G5rx2ap6o54QDQEXeEN fyVX4bc88ATd46HB12pwsJbhKXVJ5M91Burx6HFT1LbhQb1+smh7/MNy7/23QSenw0 aDcIOZQ/7bb7Y4hoja21A/2zT9Ql/Db0BVOJG0IWSE59W2d555dQK5QCv+pC3/gtRy b2G7PgNATa/4w== Subject: [PATCH 2/8] common/xfs: refactor commands to select a particular xfs backing device From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:01:51 -0700 Message-ID: <162078491108.3302755.3627499639796540923.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 Refactor all the places where we try to force new file data allocations to a specific xfs backing device so that we don't end up open-coding the same xfs_io command lines over and over. Signed-off-by: Darrick J. Wong --- common/populate | 2 +- common/xfs | 25 +++++++++++++++++++++++++ tests/generic/223 | 3 ++- tests/generic/449 | 2 +- tests/xfs/004 | 2 +- tests/xfs/088 | 1 + tests/xfs/089 | 1 + tests/xfs/091 | 1 + tests/xfs/120 | 1 + tests/xfs/130 | 1 + tests/xfs/146 | 2 +- tests/xfs/147 | 2 +- tests/xfs/235 | 1 + tests/xfs/272 | 2 +- tests/xfs/318 | 2 +- tests/xfs/431 | 4 ++-- tests/xfs/521 | 2 +- tests/xfs/528 | 2 +- tests/xfs/532 | 2 +- tests/xfs/533 | 2 +- tests/xfs/538 | 2 +- 21 files changed, 47 insertions(+), 15 deletions(-) diff --git a/common/populate b/common/populate index d484866a..e1704b10 100644 --- a/common/populate +++ b/common/populate @@ -162,7 +162,7 @@ _scratch_xfs_populate() { # Clear the rtinherit flag on the root directory so that files are # always created on the data volume regardless of MKFS_OPTIONS. We can # set the realtime flag when needed. - $XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT + _scratch_xfs_force_bdev data $SCRATCH_MNT blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')" diff --git a/common/xfs b/common/xfs index 5cd7b35c..49bd6c31 100644 --- a/common/xfs +++ b/common/xfs @@ -194,6 +194,31 @@ _xfs_get_file_block_size() $XFS_INFO_PROG "$path" | grep realtime | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g' } +# Set or clear the realtime status of every supplied path. The first argument +# is either 'data' or 'realtime'. All other arguments should be paths to +# existing directories or empty regular files. +# +# For each directory, each file subsequently created will target the given +# device for file data allocations. For each empty regular file, each +# subsequent file data allocation will be on the given device. +_scratch_xfs_force_bdev() +{ + local device="$1" + shift + local chattr_arg="" + + case "$device" in + "data") chattr_arg="-t";; + "realtime") chattr_arg="+t";; + *) + echo "${device}: Don't know what device this is?" + return 1 + ;; + esac + + $XFS_IO_PROG -c "chattr $chattr_arg" "$@" +} + _xfs_get_fsxattr() { local field="$1" diff --git a/tests/generic/223 b/tests/generic/223 index f6393293..0df84c2b 100755 --- a/tests/generic/223 +++ b/tests/generic/223 @@ -46,7 +46,8 @@ for SUNIT_K in 8 16 32 64 128; do # This test checks for stripe alignments of space allocations on the # filesystem. Make sure all files get created on the main device, # which for XFS means no rt files. - test "$FSTYP" = "xfs" && $XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT + test "$FSTYP" = "xfs" && \ + _scratch_xfs_force_bdev data $SCRATCH_MNT for SIZE_MULT in 1 2 8 64 256; do let SIZE=$SIZE_MULT*$SUNIT_BYTES diff --git a/tests/generic/449 b/tests/generic/449 index 5fd15367..9035b705 100755 --- a/tests/generic/449 +++ b/tests/generic/449 @@ -46,7 +46,7 @@ _scratch_mount || _fail "mount failed" # This is a test of xattr behavior when we run out of disk space for xattrs, # so make sure the pwrite goes to the data device and not the rt volume. test "$FSTYP" = "xfs" && \ - $XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT + _scratch_xfs_force_bdev data $SCRATCH_MNT TFILE=$SCRATCH_MNT/testfile.$seq diff --git a/tests/xfs/004 b/tests/xfs/004 index 7633071c..b3a00fb6 100755 --- a/tests/xfs/004 +++ b/tests/xfs/004 @@ -31,7 +31,7 @@ _populate_scratch() # This test looks at specific behaviors of the xfs_db freesp command, # which reports on the contents of the free space btrees for the data # device. Don't let anything get created on the realtime volume. - $XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT + _scratch_xfs_force_bdev data $SCRATCH_MNT dd if=/dev/zero of=$SCRATCH_MNT/foo count=200 bs=4096 >/dev/null 2>&1 & dd if=/dev/zero of=$SCRATCH_MNT/goo count=400 bs=4096 >/dev/null 2>&1 & dd if=/dev/zero of=$SCRATCH_MNT/moo count=800 bs=4096 >/dev/null 2>&1 & diff --git a/tests/xfs/088 b/tests/xfs/088 index fe621d0a..62360ca8 100755 --- a/tests/xfs/088 +++ b/tests/xfs/088 @@ -48,6 +48,7 @@ _scratch_mkfs_xfs > /dev/null echo "+ mount fs image" _scratch_mount blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "+ make some files" mkdir -p "${TESTDIR}" diff --git a/tests/xfs/089 b/tests/xfs/089 index 3339ff63..79167a57 100755 --- a/tests/xfs/089 +++ b/tests/xfs/089 @@ -48,6 +48,7 @@ _scratch_mkfs_xfs > /dev/null echo "+ mount fs image" _scratch_mount blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "+ make some files" mkdir -p "${TESTDIR}" diff --git a/tests/xfs/091 b/tests/xfs/091 index 9304849d..db6bb0b2 100755 --- a/tests/xfs/091 +++ b/tests/xfs/091 @@ -48,6 +48,7 @@ _scratch_mkfs_xfs > /dev/null echo "+ mount fs image" _scratch_mount blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "+ make some files" mkdir -p "${TESTDIR}" diff --git a/tests/xfs/120 b/tests/xfs/120 index 59ac0433..9fcce9ee 100755 --- a/tests/xfs/120 +++ b/tests/xfs/120 @@ -47,6 +47,7 @@ echo "+ mount fs image" _scratch_mount blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" nr="$((blksz * 2 / 16))" +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "+ make some files" $XFS_IO_PROG -f -c "pwrite -S 0x62 0 $((blksz * nr))" -c 'fsync' "${SCRATCH_MNT}/bigfile" >> $seqres.full diff --git a/tests/xfs/130 b/tests/xfs/130 index 9fec009f..b4404c5d 100755 --- a/tests/xfs/130 +++ b/tests/xfs/130 @@ -43,6 +43,7 @@ echo "+ mount fs image" _scratch_mount blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "+ make some files" _pwrite_byte 0x62 0 $((blksz * 64)) "${SCRATCH_MNT}/file0" >> "$seqres.full" diff --git a/tests/xfs/146 b/tests/xfs/146 index 8f85024d..a62b8429 100755 --- a/tests/xfs/146 +++ b/tests/xfs/146 @@ -78,7 +78,7 @@ _scratch_mkfs -r size=$rtsize >> $seqres.full _scratch_mount >> $seqres.full # Make sure the root directory has rtinherit set so our test file will too -$XFS_IO_PROG -c 'chattr +t' $SCRATCH_MNT +_scratch_xfs_force_bdev realtime $SCRATCH_MNT # Allocate some stuff at the start, to force the first falloc of the ouch file # to happen somewhere in the middle of the rt volume diff --git a/tests/xfs/147 b/tests/xfs/147 index da962f96..0071f5c3 100755 --- a/tests/xfs/147 +++ b/tests/xfs/147 @@ -50,7 +50,7 @@ rextblks=$((rextsize / blksz)) echo "blksz $blksz rextsize $rextsize rextblks $rextblks" >> $seqres.full # Make sure the root directory has rtinherit set so our test file will too -$XFS_IO_PROG -c 'chattr +t' $SCRATCH_MNT +_scratch_xfs_force_bdev realtime $SCRATCH_MNT sz=$((rextsize * 100)) range="$((blksz * 3)) $blksz" diff --git a/tests/xfs/235 b/tests/xfs/235 index 1ed19424..553a3bc8 100755 --- a/tests/xfs/235 +++ b/tests/xfs/235 @@ -41,6 +41,7 @@ echo "+ mount fs image" _scratch_mount blksz=$(stat -f -c '%s' ${SCRATCH_MNT}) agcount=$(_xfs_mount_agcount $SCRATCH_MNT) +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "+ make some files" _pwrite_byte 0x62 0 $((blksz * 64)) ${SCRATCH_MNT}/file0 >> $seqres.full diff --git a/tests/xfs/272 b/tests/xfs/272 index 6c0fede5..2848848d 100755 --- a/tests/xfs/272 +++ b/tests/xfs/272 @@ -38,7 +38,7 @@ _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount # Make sure everything is on the data device -$XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT +_scratch_xfs_force_bdev data $SCRATCH_MNT _pwrite_byte 0x80 0 737373 $SCRATCH_MNT/urk >> $seqres.full sync diff --git a/tests/xfs/318 b/tests/xfs/318 index 07375b1f..823f3e6c 100755 --- a/tests/xfs/318 +++ b/tests/xfs/318 @@ -44,7 +44,7 @@ _scratch_mount >> $seqres.full # This test depends on specific behaviors of the data device, so create all # files on it. -$XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "Create files" touch $SCRATCH_MNT/file1 diff --git a/tests/xfs/431 b/tests/xfs/431 index e67906dc..dd634ed6 100755 --- a/tests/xfs/431 +++ b/tests/xfs/431 @@ -47,7 +47,7 @@ _scratch_mount # Set realtime inherit flag on scratch mount, suppress output # as this may simply error out on future kernels -$XFS_IO_PROG -c 'chattr +t' $SCRATCH_MNT &> /dev/null +_scratch_xfs_force_bdev realtime $SCRATCH_MNT &> /dev/null # Check if 't' is actually set, as xfs_io returns 0 even when it fails to set # an attribute. And erroring out here is fine, this would be desired behavior @@ -60,7 +60,7 @@ if $XFS_IO_PROG -c 'lsattr' $SCRATCH_MNT | grep -q 't'; then # Remove the testfile and rt inherit flag after we are done or # xfs_repair will fail. rm -f $SCRATCH_MNT/testfile - $XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT | tee -a $seqres.full 2>&1 + _scratch_xfs_force_bdev data $SCRATCH_MNT | tee -a $seqres.full 2>&1 fi # success, all done diff --git a/tests/xfs/521 b/tests/xfs/521 index b8026d45..64155662 100755 --- a/tests/xfs/521 +++ b/tests/xfs/521 @@ -55,7 +55,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Check rt volume stats" -$XFS_IO_PROG -c 'chattr +t' $testdir +_scratch_xfs_force_bdev realtime $testdir $XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full before=$(stat -f -c '%b' $testdir) diff --git a/tests/xfs/528 b/tests/xfs/528 index 7f98c5b8..4db4f513 100755 --- a/tests/xfs/528 +++ b/tests/xfs/528 @@ -77,7 +77,7 @@ test_ops() { _notrun "Could not mount rextsize=$rextsize with synthetic rt volume" # Force all files to be realtime files - $XFS_IO_PROG -c 'chattr +t' $SCRATCH_MNT + _scratch_xfs_force_bdev realtime $SCRATCH_MNT log "Test regular write, rextsize=$rextsize" mk_file $SCRATCH_MNT/write $rextsize diff --git a/tests/xfs/532 b/tests/xfs/532 index 560af586..1749d6ac 100755 --- a/tests/xfs/532 +++ b/tests/xfs/532 @@ -47,7 +47,7 @@ _scratch_mount >> $seqres.full # Disable realtime inherit flag (if any) on root directory so that space on data # device gets fragmented rather than realtime device. -$XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT +_scratch_xfs_force_bdev data $SCRATCH_MNT bsize=$(_get_block_size $SCRATCH_MNT) diff --git a/tests/xfs/533 b/tests/xfs/533 index dd4cb4c4..b73097e1 100755 --- a/tests/xfs/533 +++ b/tests/xfs/533 @@ -58,7 +58,7 @@ _scratch_mount >> $seqres.full # Disable realtime inherit flag (if any) on root directory so that space on data # device gets fragmented rather than realtime device. -$XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT +_scratch_xfs_force_bdev data $SCRATCH_MNT echo "Consume free space" fillerdir=$SCRATCH_MNT/fillerdir diff --git a/tests/xfs/538 b/tests/xfs/538 index 97273b88..deb43d7c 100755 --- a/tests/xfs/538 +++ b/tests/xfs/538 @@ -44,7 +44,7 @@ _scratch_mount >> $seqres.full # Disable realtime inherit flag (if any) on root directory so that space on data # device gets fragmented rather than realtime device. -$XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT +_scratch_xfs_force_bdev data $SCRATCH_MNT bsize=$(_get_file_block_size $SCRATCH_MNT) From patchwork Wed May 12 02:01:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AB61C433B4 for ; Wed, 12 May 2021 02:02:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34D98611BD for ; Wed, 12 May 2021 02:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbhELCDG (ORCPT ); Tue, 11 May 2021 22:03:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:49524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230216AbhELCDG (ORCPT ); Tue, 11 May 2021 22:03:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3ACC5610EA; Wed, 12 May 2021 02:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784919; bh=AOi4sVKfMQ9Vkmc3t1BrijdRVluIUpPSUdJ4YRS/oWw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=iGS9oC/NtM6MPl/lLL0+5HCONj8zpU8JjmoF+E18R4lSb0E6k4TRW+EFuraDMX0fq WQp9ykxdmj4pARSSO2KMNYhDZDSlKWK7DimbH3K/nKtzQTeCvhGXtu9yBoa3b82HZD bXbKOeTeKB3Wq/cfY1nKGhNWGvEJBBneup92AuxqqYDfEvUO3VGduF/aruRdvvgRQP iQFM6ZxgB8sxrmUQaxChXXmbdNKo2JWBRWCGMJbqaRiTk9GuT4JbjtBzeqjctWe3um N97OfwbmV/8UhazoDYmLJ40gRdwcLN5QPP4+rJ6CMM1DO6Co37BxWJX6WEXqumuvuM FUoUJgKfmHXnQ== Subject: [PATCH 3/8] xfs: fix old fuzz test invocations of xfs_repair From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:01:56 -0700 Message-ID: <162078491663.3302755.12377341247476799022.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 Some of the older blocktrash-based fuzz tests cause the fs to go down due to the corrupted image and fail to remount. Offline repair fails because _repair_scratch_fs is the helper that is smart enough to call xfs_repair -L, not _scratch_xfs_repair. Fix these instances. Signed-off-by: Darrick J. Wong --- tests/xfs/083 | 8 ++++---- tests/xfs/085 | 2 +- tests/xfs/086 | 4 ++-- tests/xfs/087 | 2 +- tests/xfs/088 | 4 ++-- tests/xfs/089 | 4 ++-- tests/xfs/091 | 4 ++-- tests/xfs/093 | 2 +- tests/xfs/097 | 2 +- tests/xfs/099 | 4 ++-- tests/xfs/100 | 4 ++-- tests/xfs/101 | 4 ++-- tests/xfs/102 | 4 ++-- tests/xfs/105 | 4 ++-- tests/xfs/112 | 4 ++-- tests/xfs/113 | 4 ++-- tests/xfs/117 | 2 +- tests/xfs/120 | 2 +- tests/xfs/123 | 2 +- tests/xfs/124 | 4 ++-- tests/xfs/125 | 4 ++-- tests/xfs/126 | 4 ++-- tests/xfs/130 | 2 +- tests/xfs/235 | 2 +- 24 files changed, 41 insertions(+), 41 deletions(-) diff --git a/tests/xfs/083 b/tests/xfs/083 index a3f32cb7..14a36416 100755 --- a/tests/xfs/083 +++ b/tests/xfs/083 @@ -44,7 +44,7 @@ scratch_repair() { FSCK_LOG="${tmp}-fuzz-${fsck_pass}.log" echo "++ fsck pass ${fsck_pass}" > "${FSCK_LOG}" - _scratch_xfs_repair >> "${FSCK_LOG}" 2>&1 + _repair_scratch_fs >> "${FSCK_LOG}" 2>&1 res=$? if [ "${res}" -eq 0 ]; then echo "++ allegedly fixed, reverify" >> "${FSCK_LOG}" @@ -105,7 +105,7 @@ echo "+ populate fs image" >> $seqres.full _scratch_populate >> $seqres.full echo "+ check fs" >> $seqres.full -_scratch_xfs_repair >> $seqres.full 2>&1 || _fail "should pass initial fsck" +_repair_scratch_fs >> $seqres.full 2>&1 || _fail "should pass initial fsck" echo "++ corrupt image" >> $seqres.full _scratch_xfs_db -x -c blockget -c "blocktrash ${FUZZ_ARGS}" >> $seqres.full 2>&1 @@ -129,7 +129,7 @@ done echo "+ fsck loop returns ${fsck_loop_ret}" >> $seqres.full echo "++ check fs for round 2" >> $seqres.full -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 ROUND2_LOG="${tmp}-round2-${fsck_pass}.log" echo "++ mount image (2)" >> $ROUND2_LOG @@ -150,7 +150,7 @@ umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1 cat "$ROUND2_LOG" >> $seqres.full echo "++ check fs (2)" >> $seqres.full -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 egrep -q '(did not fix|makes no progress)' $seqres.full && echo "xfs_repair failed" | tee -a $seqres.full if [ "$(wc -l < "$ROUND2_LOG")" -ne 8 ]; then diff --git a/tests/xfs/085 b/tests/xfs/085 index 560b5a24..5d898088 100755 --- a/tests/xfs/085 +++ b/tests/xfs/085 @@ -75,7 +75,7 @@ echo "+ mount image" _try_scratch_mount 2>/dev/null && _fail "mount should not succeed" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/086 b/tests/xfs/086 index f94c26b4..f4cf950d 100755 --- a/tests/xfs/086 +++ b/tests/xfs/086 @@ -86,7 +86,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount @@ -109,7 +109,7 @@ done umount "${SCRATCH_MNT}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount diff --git a/tests/xfs/087 b/tests/xfs/087 index 967791dd..e7b06e09 100755 --- a/tests/xfs/087 +++ b/tests/xfs/087 @@ -86,7 +86,7 @@ fi echo "broken: ${broken}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/088 b/tests/xfs/088 index 62360ca8..42a186be 100755 --- a/tests/xfs/088 +++ b/tests/xfs/088 @@ -86,7 +86,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount @@ -109,7 +109,7 @@ done umount "${SCRATCH_MNT}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount diff --git a/tests/xfs/089 b/tests/xfs/089 index 79167a57..7d8af7ce 100755 --- a/tests/xfs/089 +++ b/tests/xfs/089 @@ -86,7 +86,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount @@ -110,7 +110,7 @@ done umount "${SCRATCH_MNT}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount diff --git a/tests/xfs/091 b/tests/xfs/091 index db6bb0b2..5fa98328 100755 --- a/tests/xfs/091 +++ b/tests/xfs/091 @@ -86,7 +86,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount @@ -110,7 +110,7 @@ done umount "${SCRATCH_MNT}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image" _scratch_mount diff --git a/tests/xfs/093 b/tests/xfs/093 index 3bdbff4d..9a61cc3e 100755 --- a/tests/xfs/093 +++ b/tests/xfs/093 @@ -86,7 +86,7 @@ fi echo "broken: ${broken}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/097 b/tests/xfs/097 index f8ea4676..98648c9e 100755 --- a/tests/xfs/097 +++ b/tests/xfs/097 @@ -88,7 +88,7 @@ fi echo "broken: ${broken}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/099 b/tests/xfs/099 index 0cf19682..9a1408b8 100755 --- a/tests/xfs/099 +++ b/tests/xfs/099 @@ -74,8 +74,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/100 b/tests/xfs/100 index 44d175cc..277f26ec 100755 --- a/tests/xfs/100 +++ b/tests/xfs/100 @@ -79,8 +79,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/101 b/tests/xfs/101 index 023cc349..6eb303ad 100755 --- a/tests/xfs/101 +++ b/tests/xfs/101 @@ -74,8 +74,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/102 b/tests/xfs/102 index 907b8592..23326ecf 100755 --- a/tests/xfs/102 +++ b/tests/xfs/102 @@ -79,8 +79,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/105 b/tests/xfs/105 index bb7e93e1..7aeee7f0 100755 --- a/tests/xfs/105 +++ b/tests/xfs/105 @@ -79,8 +79,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/112 b/tests/xfs/112 index cf0a36d0..085f21ee 100755 --- a/tests/xfs/112 +++ b/tests/xfs/112 @@ -79,11 +79,11 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 if [ $? -eq 2 ]; then _scratch_mount umount "${SCRATCH_MNT}" - _scratch_xfs_repair >> $seqres.full 2>&1 + _repair_scratch_fs >> $seqres.full 2>&1 fi echo "+ mount image (2)" diff --git a/tests/xfs/113 b/tests/xfs/113 index 3ab3cf5e..3dc51381 100755 --- a/tests/xfs/113 +++ b/tests/xfs/113 @@ -79,8 +79,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/117 b/tests/xfs/117 index 15765a56..d3f4675f 100755 --- a/tests/xfs/117 +++ b/tests/xfs/117 @@ -88,7 +88,7 @@ fi echo "broken: ${broken}" echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/120 b/tests/xfs/120 index 9fcce9ee..1f594ebc 100755 --- a/tests/xfs/120 +++ b/tests/xfs/120 @@ -74,7 +74,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/123 b/tests/xfs/123 index a7fae5f6..ced453bd 100755 --- a/tests/xfs/123 +++ b/tests/xfs/123 @@ -69,7 +69,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/124 b/tests/xfs/124 index f4b24dd6..50faa66b 100755 --- a/tests/xfs/124 +++ b/tests/xfs/124 @@ -78,8 +78,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/125 b/tests/xfs/125 index 3bdf73c4..c9ee2cf3 100755 --- a/tests/xfs/125 +++ b/tests/xfs/125 @@ -78,8 +78,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/126 b/tests/xfs/126 index 3f069c16..0ca0670c 100755 --- a/tests/xfs/126 +++ b/tests/xfs/126 @@ -83,8 +83,8 @@ if _try_scratch_mount >> $seqres.full 2>&1; then fi echo "+ repair fs" -_scratch_xfs_repair >> $seqres.full 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/130 b/tests/xfs/130 index b4404c5d..7ff565c6 100755 --- a/tests/xfs/130 +++ b/tests/xfs/130 @@ -71,7 +71,7 @@ _scratch_unmount >> $seqres.full 2>&1 echo "+ repair fs" _disable_dmesg_check _repair_scratch_fs >> "$seqres.full" 2>&1 -_scratch_xfs_repair >> "$seqres.full" 2>&1 +_repair_scratch_fs >> "$seqres.full" 2>&1 echo "+ mount image (2)" _scratch_mount diff --git a/tests/xfs/235 b/tests/xfs/235 index 553a3bc8..fe3a2cd0 100755 --- a/tests/xfs/235 +++ b/tests/xfs/235 @@ -72,7 +72,7 @@ fi echo "+ repair fs" _disable_dmesg_check _repair_scratch_fs >> "$seqres.full" 2>&1 -_scratch_xfs_repair >> $seqres.full 2>&1 +_repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount From patchwork Wed May 12 02:02:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93DD7C433B4 for ; Wed, 12 May 2021 02:02:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65DE1611CE for ; Wed, 12 May 2021 02:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbhELCDM (ORCPT ); Tue, 11 May 2021 22:03:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:49698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbhELCDM (ORCPT ); Tue, 11 May 2021 22:03:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE1A761166; Wed, 12 May 2021 02:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784925; bh=Yu+eAjhxeMKVLsBYZVl6EusGwPVpt+1jAIWovF6dlvQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=BoZK0JeoB//EkdE6JEl3MjJZ4gtP+YajmXzTIhmhIpsxa27HhiEylZiqs8TV5ABo4 wYPB6Uv5HEDp1hWJ0SlWRt2P9rXkaPM+dhPXAGtHUl2g8yMg1PIb4EEcmq69wKnn9t p6CjjPqMQ2O55/DpPJ8TjWFumvpxc4HM1La3YTaX8a47vTUi9eMoeae2ORaTgln5XL Y2Gz5hw9T+UL6HiSLaSTlbBGaqpr/4zaTGSrc9LK+U5+YrEa8uyQtyfs1j+cn08qdM RCkiHU4m/Vk8y+uMbWZ2yCYGzO4q5yViPV64QypdWywpEfAFtWipHXB85xRpR49nJW TfYaRh1kolefA== Subject: [PATCH 4/8] xfs/117: fix fragility in this fuzz test From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:02:02 -0700 Message-ID: <162078492228.3302755.2845906763358077143.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 This fuzz test has some fragility problems -- it doesn't do anything to guarantee that the inodes that it checks for EFSCORRUPTED are the same ones that it fuzzed, and it doesn't explicitly try to avoid victimizing inodes in the same chunk as the root directory. As a result, this test fails annoyingly frequently. Fix both of these problems and get rid of the confusingly named TESTDIR variable. Signed-off-by: Darrick J. Wong --- tests/xfs/117 | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/tests/xfs/117 b/tests/xfs/117 index d3f4675f..32be525f 100755 --- a/tests/xfs/117 +++ b/tests/xfs/117 @@ -39,8 +39,7 @@ _require_xfs_db_blocktrash_z_command test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3" rm -f $seqres.full -TESTDIR="${SCRATCH_MNT}/scratchdir" -TESTFILE="${TESTDIR}/testfile" +victimdir="${SCRATCH_MNT}/scratchdir" echo "+ create scratch fs" _scratch_mkfs_xfs > /dev/null @@ -50,37 +49,49 @@ _scratch_mount blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" echo "+ make some files" -mkdir -p "${TESTDIR}" -for x in `seq 1 1024`; do - touch "${SCRATCH_MNT}/junk.${x}" - inode="$(stat -c '%i' "${SCRATCH_MNT}/junk.${x}")" - if [ "$x" -gt 512 ] && [ "$((inode % 64))" -eq 0 ]; then - mv "${SCRATCH_MNT}/junk.${x}" "${TESTFILE}.1" - break - fi +mkdir -p "$victimdir" + +rootdir="$(stat -c '%i' "$SCRATCH_MNT")" +rootchunk=$(( rootdir / 64 )) + +# First we create some dummy file so that the victim files don't get created +# in the same inode chunk as the root directory, because a corrupt inode in +# the root chunk causes mount to fail. +for ((i = 0; i < 256; i++)); do + fname="$SCRATCH_MNT/dummy.$i" + touch "$fname" + ino="$(stat -c '%i' "$fname")" + ichunk=$(( ino / 64 )) + test "$ichunk" -gt "$rootchunk" && break done -for x in `seq 2 64`; do - touch "${TESTFILE}.${x}" + +# Now create some victim files +inos=() +for ((i = 0; i < 64; i++)); do + fname="$victimdir/test.$i" + touch "$fname" + inos+=("$(stat -c '%i' "$fname")") done -inode="$(stat -c '%i' "${TESTFILE}.1")" +echo "First victim inode is: " >> $seqres.full +stat -c '%i' "$fname" >> $seqres.full umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail" echo "+ corrupt image" -seq "${inode}" "$((inode + 63))" | while read ino; do +for ino in "${inos[@]}"; do _scratch_xfs_db -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1 done echo "+ mount image && modify files" broken=1 if _try_scratch_mount >> $seqres.full 2>&1; then - - for x in `seq 1 64`; do - stat "${TESTFILE}.${x}" >> $seqres.full 2>&1 + for ((i = 0; i < 64; i++)); do + fname="$victimdir/test.$i" + stat "$fname" &>> $seqres.full test $? -eq 0 && broken=0 - touch "${TESTFILE}.${x}" >> $seqres.full 2>&1 + touch "$fname" &>> $seqres.full test $? -eq 0 && broken=0 done umount "${SCRATCH_MNT}" From patchwork Wed May 12 02:02:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 832D3C433B4 for ; Wed, 12 May 2021 02:02:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39027611CE for ; Wed, 12 May 2021 02:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbhELCDS (ORCPT ); Tue, 11 May 2021 22:03:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:49854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbhELCDS (ORCPT ); Tue, 11 May 2021 22:03:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B00761166; Wed, 12 May 2021 02:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784930; bh=Fq8RAKDaHHM2N1AM49LV4Ew8DIzwMHKadaKU08rm+qI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=g7XCoikK/MteShw/DpBzniG28t2A911OdSFJI+jVOBq/QpL8h+YigQSfDmZH50cVd Nygbgfai42uvzYyhJLmKSJ7P++fgVOLOO5ETjSmP8RJRrdwnuXuYLgb4wxs0jZia9X Ek9zwgr05CwYhU7dqHniF1GPKnlEyTo5n9FALN7O3Hfpsy24YbmzLweF3thHLaN5uO P1bTnomTb1e/M17wLw7riX6iJMm5BYjvqbpbq9Ay/XG5sqaut6ggt9yx0O3/R1A0oy EY2PFqCynOnF+shyvNVtkTwtDgtDIdT465abkV0n82deBr0AJqLseGp/G+sUL6ApT7 t+mp2EtV3M6JQ== Subject: [PATCH 5/8] common: always pass -f to $DUMP_COMPRESSOR From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:02:08 -0700 Message-ID: <162078492804.3302755.5107477157116858438.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 test runner gave us the name of a program to use to compress dumps, always pass -f to overwrite older compressed images, like the documentation says we do. This prevents the test suite from stalling on "foo.md.gz exists, overwrite?" prompts. Signed-off-by: Darrick J. Wong --- common/rc | 2 +- common/xfs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 919028ef..b18cf61e 100644 --- a/common/rc +++ b/common/rc @@ -628,7 +628,7 @@ _ext4_metadump() test -n "$E2IMAGE_PROG" || _fail "e2image not installed" $E2IMAGE_PROG -Q "$device" "$dumpfile" [ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] && - $DUMP_COMPRESSOR "$dumpfile" &>> "$seqres.full" + $DUMP_COMPRESSOR -f "$dumpfile" &>> "$seqres.full" } _test_mkfs() diff --git a/common/xfs b/common/xfs index 49bd6c31..add33008 100644 --- a/common/xfs +++ b/common/xfs @@ -503,7 +503,7 @@ _xfs_metadump() { $XFS_METADUMP_PROG $options "$device" "$metadump" res=$? [ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] && - $DUMP_COMPRESSOR "$metadump" &> /dev/null + $DUMP_COMPRESSOR -f "$metadump" &> /dev/null return $res } From patchwork Wed May 12 02:02:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADFB7C433ED for ; Wed, 12 May 2021 02:02:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CF22611CE for ; Wed, 12 May 2021 02:02:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbhELCDX (ORCPT ); Tue, 11 May 2021 22:03:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbhELCDX (ORCPT ); Tue, 11 May 2021 22:03:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 32C6C61166; Wed, 12 May 2021 02:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784936; bh=mE5ivfG8vEAiCRZ9NyOijjIZJYeU0iTNZIEIJw7nbJs=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=BREhx1TUkwzarL8wYkpVSRKcNCUFyMRwbi//b2JIsoJmiJweJ9NHUln1pZNSL0J0s 6bkJpXQcwfTIGdscjmncsflN4LZxNae4AKwoXGUWAkaeRQfjzcz8XWJvmqc7dMeTGp G9LSwLTi+4qeVgD+dX8YCgV5lMA5J5kd8K+uT1euqzXKCx3qQq4CRxtC8YW1Xcdfoi YGINACqkNhV+1h92Jw7etJexL6ag0uYvgZPXX8PgVkaW5s3pIKjnqeagbTY3oSuSfU Aq0onynXycq7hNh1TEUxkxG3es5jkEECRZbYpXQxm8JgiCh8bP7db2cKwrfh9dQzS2 pKZJ2NdhOhWUg== Subject: [PATCH 6/8] fsx/fsstress: round blocksize properly From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:02:13 -0700 Message-ID: <162078493359.3302755.12041933173157506087.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 The block sizes reported by stat and DIOINFO aren't required to be powers of two. This can happen on an XFS filesystem with a realtime extent size that isn't a power of two; on such filesystems, certain IO calls will fail due to alignment issues. Fix that by providing rounding helpers that work for all sizes. Signed-off-by: Darrick J. Wong --- ltp/fsstress.c | 24 ++++++++++++------------ ltp/fsx.c | 22 +++++++++++----------- src/global.h | 13 +++++++++++++ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/ltp/fsstress.c b/ltp/fsstress.c index e7cd0eae..b4ddf5e2 100644 --- a/ltp/fsstress.c +++ b/ltp/fsstress.c @@ -2140,7 +2140,7 @@ do_aio_rw(int opno, long r, int flags) " fallback to stat()\n", procid, opno, f.path, st, errno); diob.d_mem = diob.d_miniosz = stb.st_blksize; - diob.d_maxiosz = INT_MAX & ~(diob.d_miniosz - 1); + diob.d_maxiosz = rounddown_64(INT_MAX, diob.d_miniosz); } dio_env = getenv("XFS_DIO_MIN"); if (dio_env) @@ -2608,7 +2608,7 @@ clonerange_f( /* Calculate offsets */ len = (random() % FILELEN_MAX) + 1; - len &= ~(stat1.st_blksize - 1); + len = rounddown_64(len, stat1.st_blksize); if (len == 0) len = stat1.st_blksize; if (len > stat1.st_size) @@ -2620,7 +2620,7 @@ clonerange_f( else off1 = (off64_t)(lr % MIN(stat1.st_size - len, MAXFSIZE)); off1 %= maxfsize; - off1 &= ~(stat1.st_blksize - 1); + off1 = rounddown_64(off1, stat1.st_blksize); /* * If srcfile == destfile, randomly generate destination ranges @@ -2631,7 +2631,7 @@ clonerange_f( lr = ((int64_t)random() << 32) + random(); off2 = (off64_t)(lr % max_off2); off2 %= maxfsize; - off2 &= ~(stat2.st_blksize - 1); + off2 = rounddown_64(off2, stat2.st_blksize); } while (stat1.st_ino == stat2.st_ino && llabs(off2 - off1) < len); /* Clone data blocks */ @@ -2968,7 +2968,7 @@ deduperange_f( /* Never try to dedupe more than half of the src file. */ len = (random() % FILELEN_MAX) + 1; - len &= ~(stat[0].st_blksize - 1); + len = rounddown_64(len, stat[0].st_blksize); if (len == 0) len = stat[0].st_blksize / 2; if (len > stat[0].st_size / 2) @@ -2981,7 +2981,7 @@ deduperange_f( else off[0] = (off64_t)(lr % MIN(stat[0].st_size - len, MAXFSIZE)); off[0] %= maxfsize; - off[0] &= ~(stat[0].st_blksize - 1); + off[0] = rounddown_64(off[0], stat[0].st_blksize); /* * If srcfile == destfile[i], randomly generate destination ranges @@ -2997,7 +2997,7 @@ deduperange_f( else off[i] = (off64_t)(lr % MIN(stat[i].st_size - len, MAXFSIZE)); off[i] %= maxfsize; - off[i] &= ~(stat[i].st_blksize - 1); + off[i] = rounddown_64(off[i], stat[i].st_blksize); } while (stat[0].st_ino == stat[i].st_ino && llabs(off[i] - off[0]) < len && tries++ < 10); @@ -3406,7 +3406,7 @@ dread_f(int opno, long r) " fallback to stat()\n", procid, opno, f.path, st, errno); diob.d_mem = diob.d_miniosz = stb.st_blksize; - diob.d_maxiosz = INT_MAX & ~(diob.d_miniosz - 1); + diob.d_maxiosz = rounddown_64(INT_MAX, diob.d_miniosz); } dio_env = getenv("XFS_DIO_MIN"); @@ -3483,7 +3483,7 @@ dwrite_f(int opno, long r) " %s%s return %d, fallback to stat()\n", procid, opno, f.path, st, errno); diob.d_mem = diob.d_miniosz = stb.st_blksize; - diob.d_maxiosz = INT_MAX & ~(diob.d_miniosz - 1); + diob.d_maxiosz = rounddown_64(INT_MAX, diob.d_miniosz); } dio_env = getenv("XFS_DIO_MIN"); @@ -3579,8 +3579,8 @@ do_fallocate(int opno, long r, int mode) */ if ((mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)) && (opno % 2)) { - off = ((off + stb.st_blksize - 1) & ~(stb.st_blksize - 1)); - len = ((len + stb.st_blksize - 1) & ~(stb.st_blksize - 1)); + off = roundup_64(off, stb.st_blksize); + len = roundup_64(len, stb.st_blksize); } mode |= FALLOC_FL_KEEP_SIZE & random(); e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0; @@ -4186,7 +4186,7 @@ do_mmap(int opno, long r, int prot) lr = ((int64_t)random() << 32) + random(); off = (off64_t)(lr % stb.st_size); - off &= (off64_t)(~(sysconf(_SC_PAGE_SIZE) - 1)); + off = rounddown_64(off, sysconf(_SC_PAGE_SIZE)); len = (size_t)(random() % MIN(stb.st_size - off, FILELEN_MAX)) + 1; flags = (random() % 2) ? MAP_SHARED : MAP_PRIVATE; diff --git a/ltp/fsx.c b/ltp/fsx.c index cd0bae55..16e75c40 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -203,7 +203,7 @@ static void *round_ptr_up(void *ptr, unsigned long align, unsigned long offset) { unsigned long ret = (unsigned long)ptr; - ret = ((ret + align - 1) & ~(align - 1)); + ret = roundup_64(ret, align); ret += offset; return (void *)ret; } @@ -1948,12 +1948,12 @@ static void generate_dest_range(bool bdy_align, TRIM_OFF_LEN(*src_offset, *size, file_size); if (bdy_align) { - *src_offset -= *src_offset % readbdy; + *src_offset = rounddown_64(*src_offset, readbdy); if (o_direct) - *size -= *size % readbdy; + *size = rounddown_64(*size, readbdy); } else { - *src_offset = *src_offset & ~(block_size - 1); - *size = *size & ~(block_size - 1); + *src_offset = rounddown_64(*src_offset, block_size); + *size = rounddown_64(*size, block_size); } do { @@ -1964,9 +1964,9 @@ static void generate_dest_range(bool bdy_align, *dst_offset = random(); TRIM_OFF(*dst_offset, max_range_end); if (bdy_align) - *dst_offset -= *dst_offset % writebdy; + *dst_offset = rounddown_64(*dst_offset, writebdy); else - *dst_offset = *dst_offset & ~(block_size - 1); + *dst_offset = rounddown_64(*dst_offset, block_size); } while (range_overlaps(*src_offset, *dst_offset, *size) || *dst_offset + *size > max_range_end); } @@ -2156,8 +2156,8 @@ test(void) break; case OP_COLLAPSE_RANGE: TRIM_OFF_LEN(offset, size, file_size - 1); - offset = offset & ~(block_size - 1); - size = size & ~(block_size - 1); + offset = rounddown_64(offset, block_size); + size = rounddown_64(size, block_size); if (size == 0) { log4(OP_COLLAPSE_RANGE, offset, size, FL_SKIPPED); goto out; @@ -2167,8 +2167,8 @@ test(void) case OP_INSERT_RANGE: TRIM_OFF(offset, file_size); TRIM_LEN(file_size, size, maxfilelen); - offset = offset & ~(block_size - 1); - size = size & ~(block_size - 1); + offset = rounddown_64(offset, block_size); + size = rounddown_64(size, block_size); if (size == 0) { log4(OP_INSERT_RANGE, offset, size, FL_SKIPPED); goto out; diff --git a/src/global.h b/src/global.h index e5e46234..b4407099 100644 --- a/src/global.h +++ b/src/global.h @@ -171,4 +171,17 @@ #include #endif +static inline unsigned long long +rounddown_64(unsigned long long x, unsigned int y) +{ + x /= y; + return x * y; +} + +static inline unsigned long long +roundup_64(unsigned long long x, unsigned int y) +{ + return rounddown_64(x + y - 1, y); +} + #endif /* GLOBAL_H */ From patchwork Wed May 12 02:02:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72187C433ED for ; Wed, 12 May 2021 02:02:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DECE611BD for ; Wed, 12 May 2021 02:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230111AbhELCD3 (ORCPT ); Tue, 11 May 2021 22:03:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:50126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbhELCD3 (ORCPT ); Tue, 11 May 2021 22:03:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD91F610EA; Wed, 12 May 2021 02:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784942; bh=1e3afn9sSKWBbmLz1TL3wtUwNUoeI9Lu2TmAcGoddhI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=e9oxzNm0AzL91rmW+JKPD8+8wG+dn+5hjNl5MV+7kNm/Jd3Sn9gDWY+BYsjTJKEwu kCpFTCfzRrxu5OHr1hoQN7v3AfBSIn1aTe5OWUXnXiOXD2MMlbjAY2tdFRss7l1E8i sBklf54tn0OSiCJwq9+9R3UoZ3o01DxuRc/AYmS95VqCId5cD6/+l5CUjr30aFReQN ZbW9GH46RXnvl6+bdUbqcsbp0nHPbaIKBL7wjEqfKNsUbv7OG1Lwsp8VRBdnmVh13E bkSIumM6htXZJ3QDk7BLlvP1PkN7s8wXU+DrjfcBPrRslNq7Hl38NJra7PS3TWfY0y d0vf50o8vUB6Q== Subject: [PATCH 7/8] fsx: fix backwards parameters in complaint about overly long copy From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:02:19 -0700 Message-ID: <162078493928.3302755.17832088383743982289.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 fsx encounters a situation where copy_file_range reports that it copied more than it was asked to, we report this as a failure. Unfortunately, the parameters to the print function are backwards, leading to this bogus complaint about a short copy: do_copy_range: asked 28672, copied 24576?? When we really asked to copy 24k but 28k was copied instead. Signed-off-by: Darrick J. Wong --- ltp/fsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 16e75c40..12c2cc33 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -1662,7 +1662,7 @@ do_copy_range(unsigned offset, unsigned length, unsigned dest) prt("copy range: 0x%x to 0x%x at 0x%x\n", offset, offset + length, dest); prt("do_copy_range: asked %u, copied %u??\n", - nr, olen); + olen, nr); report_failure(161); } else if (nr > 0) olen -= nr; From patchwork Wed May 12 02:02:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12252541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8BE7C43461 for ; Wed, 12 May 2021 02:02:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE31861166 for ; Wed, 12 May 2021 02:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbhELCDf (ORCPT ); Tue, 11 May 2021 22:03:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:50298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbhELCDf (ORCPT ); Tue, 11 May 2021 22:03:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7FED1610EA; Wed, 12 May 2021 02:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620784947; bh=E3fp73kEkXlao2VJ4FMiNW7ea9D46vQUKj9v0tATdcQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=lkl7ny98wESpBHSLfOC7d7ZnD32ZqHKuEnS9E/a421tWoWvN1myttmn6QJgJVE9IC Z+PYSBV9YFeZmGMyncVOqU+u4XOVn6b9UipKPFL4A0V+qXQQH11K7k5QdoHknXd/8M yZtRyzWzX205oTx4phzWThFM0xdDOhKXpvS4BZqqCkNPCYq80DdC3bfwUdoWIzUUJz bKTfnjXblDKktrBz9Tb0CPfA/g2bzkSWyeZqV+kjfabjHXiJ/rzOlEjti6pyqryyDD ahaas7gaZ7CujQjmVH/alZs9V9Astys4K5ASorNHPfVUqsQimqri9bwp1l23DgCett ap2Nic1br+3pg== Subject: [PATCH 8/8] xfs/178: fix mkfs success test From: "Darrick J. Wong" To: djwong@kernel.org, guaneryu@gmail.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Tue, 11 May 2021 19:02:24 -0700 Message-ID: <162078494495.3302755.13327851823592717788.stgit@magnolia> In-Reply-To: <162078489963.3302755.9219127595550889655.stgit@magnolia> References: <162078489963.3302755.9219127595550889655.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 Fix the obviously incorrect code here that wants to fail the test if mkfs doesn't succeed. The return value ("$?") is always the status of the /last/ command in the pipe. Change the checker to _notrun so that we don't leave the scratch check files around. Signed-off-by: Darrick J. Wong --- tests/xfs/178 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/xfs/178 b/tests/xfs/178 index a24ef50c..bf72e640 100755 --- a/tests/xfs/178 +++ b/tests/xfs/178 @@ -57,8 +57,8 @@ _supported_fs xfs # fix filesystem, new mkfs.xfs will be fine. _require_scratch -_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs \ - || _fail "mkfs failed!" +_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs +test "${PIPESTATUS[0]}" -eq 0 || _notrun "mkfs failed!" # By executing the followint tmp file, will get on the mkfs options stored in # variables