From patchwork Thu Jun 2 00:31:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867406 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 E7092C433EF for ; Thu, 2 Jun 2022 00:31:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbiFBAbh (ORCPT ); Wed, 1 Jun 2022 20:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232741AbiFBAbe (ORCPT ); Wed, 1 Jun 2022 20:31:34 -0400 Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CA22429B2CE for ; Wed, 1 Jun 2022 17:31:32 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id C336E5EC3CA for ; Thu, 2 Jun 2022 10:31:30 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkK-001b7J-T2 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:28 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkK-00CBb5-S0 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:28 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 1/8] xfstests: Add Log Attribute Replay test Date: Thu, 2 Jun 2022 10:31:19 +1000 Message-Id: <20220602003126.2903779-2-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=VuxAv86n c=1 sm=1 tr=0 ts=629804e3 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=yPCof4ZbAAAA:8 a=20KFwNOVAAAA:8 a=lm25FfwbgOogd9UTEy8A:9 a=Orf_PTIp1SF4mfLq:21 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Allison Henderson This patch adds tests to exercise the log attribute error inject and log replay. These tests aim to cover cases where attributes are added, removed, and overwritten in each format (shortform, leaf, node). Error inject is used to replay these operations from the log. dchinner: sanitise md5sum input to just attr values. dchinner: correct md5sums. dchinner: ensure replace tests use different values so recovery can determine the replace was replayed correctly. dchinner: don't remove corpse in _cleanup - scratch devices don't require cleanup, and if the test fails we want to leave the broken state for post-mortem analysis. dchinner: only run on v5 filesystems. Signed-off-by: Allison Henderson Signed-off-by: Catherine Hoang Signed-off-by: Dave Chinner --- tests/xfs/600 | 179 +++++++++++++++++++++++++++++++++++++++++++ tests/xfs/600.out | 188 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 367 insertions(+) create mode 100755 tests/xfs/600 create mode 100644 tests/xfs/600.out diff --git a/tests/xfs/600 b/tests/xfs/600 new file mode 100755 index 00000000..0ff41e13 --- /dev/null +++ b/tests/xfs/600 @@ -0,0 +1,179 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 600 +# +# Log attribute replay test +# +. ./common/preamble +_begin_fstest auto quick attr + +# get standard environment, filters and checks +. ./common/filter +. ./common/attr +. ./common/inject + +_cleanup() +{ + rm -rf $tmp.* + test -w /sys/fs/xfs/debug/larp && \ + echo 0 > /sys/fs/xfs/debug/larp +} + +test_attr_replay() +{ + testfile=$testdir/$1 + attr_name=$2 + attr_value=$3 + flag=$4 + error_tag=$5 + + # Inject error + _scratch_inject_error $error_tag + + # Set attribute + echo "$attr_value" | ${ATTR_PROG} -$flag "$attr_name" $testfile 2>&1 | \ + _filter_scratch + + # FS should be shut down, touch will fail + touch $testfile 2>&1 | _filter_scratch + + # Remount to replay log + _scratch_remount_dump_log >> $seqres.full + + # FS should be online, touch should succeed + touch $testfile + + # Verify attr recovery + $ATTR_PROG -l $testfile | _filter_scratch + echo -n "$attr_name: " + $ATTR_PROG -q -g $attr_name $testfile | md5sum; + + echo "" +} + +create_test_file() +{ + filename=$testdir/$1 + count=$2 + attr_value=$3 + + touch $filename + + for i in `seq $count` + do + $ATTR_PROG -s "attr_name$i" -V $attr_value $filename >> \ + $seqres.full + done +} + +# real QA test starts here +_supported_fs xfs + +_require_scratch +_require_scratch_xfs_crc +_require_attrs +_require_xfs_io_error_injection "larp" +_require_xfs_io_error_injection "da_leaf_split" +_require_xfs_io_error_injection "attr_leaf_to_node" +_require_xfs_sysfs debug/larp +test -w /sys/fs/xfs/debug/larp || _notrun "larp knob not writable" + +# turn on log attributes +echo 1 > /sys/fs/xfs/debug/larp + +attr16="0123456789ABCDEF" +attr64="$attr16$attr16$attr16$attr16" +attr256="$attr64$attr64$attr64$attr64" +attr1k="$attr256$attr256$attr256$attr256" +attr4k="$attr1k$attr1k$attr1k$attr1k" +attr8k="$attr4k$attr4k" +attr16k="$attr8k$attr8k" +attr32k="$attr16k$attr16k" +attr64k="$attr32k$attr32k" + +echo "*** mkfs" +_scratch_mkfs >/dev/null + +echo "*** mount FS" +_scratch_mount + +testdir=$SCRATCH_MNT/testdir +mkdir $testdir + +# empty, inline +create_test_file empty_file1 0 +test_attr_replay empty_file1 "attr_name" $attr64 "s" "larp" +test_attr_replay empty_file1 "attr_name" $attr64 "r" "larp" + +# empty, internal +create_test_file empty_file2 0 +test_attr_replay empty_file2 "attr_name" $attr1k "s" "larp" +test_attr_replay empty_file2 "attr_name" $attr1k "r" "larp" + +# empty, remote +create_test_file empty_file3 0 +test_attr_replay empty_file3 "attr_name" $attr64k "s" "larp" +test_attr_replay empty_file3 "attr_name" $attr64k "r" "larp" + +# inline, inline +create_test_file inline_file1 1 $attr16 +test_attr_replay inline_file1 "attr_name2" $attr64 "s" "larp" +test_attr_replay inline_file1 "attr_name2" $attr64 "r" "larp" + +# inline, internal +create_test_file inline_file2 1 $attr16 +test_attr_replay inline_file2 "attr_name2" $attr1k "s" "larp" +test_attr_replay inline_file2 "attr_name2" $attr1k "r" "larp" + +# inline, remote +create_test_file inline_file3 1 $attr16 +test_attr_replay inline_file3 "attr_name2" $attr64k "s" "larp" +test_attr_replay inline_file3 "attr_name2" $attr64k "r" "larp" + +# extent, internal +create_test_file extent_file1 1 $attr1k +test_attr_replay extent_file1 "attr_name2" $attr1k "s" "larp" +test_attr_replay extent_file1 "attr_name2" $attr1k "r" "larp" + +# extent, inject error on split +create_test_file extent_file2 3 $attr1k +test_attr_replay extent_file2 "attr_name4" $attr1k "s" "da_leaf_split" + +# extent, inject error on fork transition +create_test_file extent_file3 3 $attr1k +test_attr_replay extent_file3 "attr_name4" $attr1k "s" "attr_leaf_to_node" + +# extent, remote +create_test_file extent_file4 1 $attr1k +test_attr_replay extent_file4 "attr_name2" $attr64k "s" "larp" +test_attr_replay extent_file4 "attr_name2" $attr64k "r" "larp" + +# remote, internal +create_test_file remote_file1 1 $attr64k +test_attr_replay remote_file1 "attr_name2" $attr1k "s" "larp" +test_attr_replay remote_file1 "attr_name2" $attr1k "r" "larp" + +# remote, remote +create_test_file remote_file2 1 $attr64k +test_attr_replay remote_file2 "attr_name2" $attr64k "s" "larp" +test_attr_replay remote_file2 "attr_name2" $attr64k "r" "larp" + +# replace shortform with different value +create_test_file sf_file 2 $attr64 +test_attr_replay sf_file "attr_name2" $attr16 "s" "larp" + +# replace leaf with different value +create_test_file leaf_file 3 $attr1k +test_attr_replay leaf_file "attr_name2" $attr256 "s" "larp" + +# replace node with a different value +create_test_file node_file 1 $attr64k +$ATTR_PROG -s "attr_name2" -V $attr1k $testdir/node_file \ + >> $seqres.full +test_attr_replay node_file "attr_name2" $attr256 "s" "larp" + +echo "*** done" +status=0 +exit diff --git a/tests/xfs/600.out b/tests/xfs/600.out new file mode 100644 index 00000000..fe25ea3e --- /dev/null +++ b/tests/xfs/600.out @@ -0,0 +1,188 @@ +QA output created by 600 +*** mkfs +*** mount FS +attr_set: Input/output error +Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/empty_file1': Input/output error +Attribute "attr_name" has a 65 byte value for SCRATCH_MNT/testdir/empty_file1 +attr_name: cfbe2a33be4601d2b655d099a18378fc - + +attr_remove: Input/output error +Could not remove "attr_name" for SCRATCH_MNT/testdir/empty_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/empty_file1': Input/output error +attr_name: attr_get: No data available +Could not get "attr_name" for /mnt/scratch/testdir/empty_file1 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file2 +touch: cannot touch 'SCRATCH_MNT/testdir/empty_file2': Input/output error +Attribute "attr_name" has a 1025 byte value for SCRATCH_MNT/testdir/empty_file2 +attr_name: 9fd415c49d67afc4b78fad4055a3a376 - + +attr_remove: Input/output error +Could not remove "attr_name" for SCRATCH_MNT/testdir/empty_file2 +touch: cannot touch 'SCRATCH_MNT/testdir/empty_file2': Input/output error +attr_name: attr_get: No data available +Could not get "attr_name" for /mnt/scratch/testdir/empty_file2 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file3 +touch: cannot touch 'SCRATCH_MNT/testdir/empty_file3': Input/output error +Attribute "attr_name" has a 65536 byte value for SCRATCH_MNT/testdir/empty_file3 +attr_name: 7f6fd1b6d872108bd44bd143cbcdfa19 - + +attr_remove: Input/output error +Could not remove "attr_name" for SCRATCH_MNT/testdir/empty_file3 +touch: cannot touch 'SCRATCH_MNT/testdir/empty_file3': Input/output error +attr_name: attr_get: No data available +Could not get "attr_name" for /mnt/scratch/testdir/empty_file3 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error +Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1 +Attribute "attr_name2" has a 65 byte value for SCRATCH_MNT/testdir/inline_file1 +attr_name2: cfbe2a33be4601d2b655d099a18378fc - + +attr_remove: Input/output error +Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error +Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1 +attr_name2: attr_get: No data available +Could not get "attr_name2" for /mnt/scratch/testdir/inline_file1 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file2 +touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error +Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/inline_file2 +Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2 +attr_name2: 9fd415c49d67afc4b78fad4055a3a376 - + +attr_remove: Input/output error +Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file2 +touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error +Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2 +attr_name2: attr_get: No data available +Could not get "attr_name2" for /mnt/scratch/testdir/inline_file2 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file3 +touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error +Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/inline_file3 +Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3 +attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19 - + +attr_remove: Input/output error +Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file3 +touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error +Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3 +attr_name2: attr_get: No data available +Could not get "attr_name2" for /mnt/scratch/testdir/inline_file3 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error +Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file1 +Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1 +attr_name2: 9fd415c49d67afc4b78fad4055a3a376 - + +attr_remove: Input/output error +Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error +Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1 +attr_name2: attr_get: No data available +Could not get "attr_name2" for /mnt/scratch/testdir/extent_file1 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file2 +touch: cannot touch 'SCRATCH_MNT/testdir/extent_file2': Input/output error +Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file2 +Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2 +Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2 +Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2 +attr_name4: 9fd415c49d67afc4b78fad4055a3a376 - + +attr_set: Input/output error +Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file3 +touch: cannot touch 'SCRATCH_MNT/testdir/extent_file3': Input/output error +Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file3 +Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3 +Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3 +Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3 +attr_name4: 9fd415c49d67afc4b78fad4055a3a376 - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file4 +touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error +Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/extent_file4 +Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4 +attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19 - + +attr_remove: Input/output error +Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file4 +touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error +Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4 +attr_name2: attr_get: No data available +Could not get "attr_name2" for /mnt/scratch/testdir/extent_file4 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error +Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/remote_file1 +Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1 +attr_name2: 9fd415c49d67afc4b78fad4055a3a376 - + +attr_remove: Input/output error +Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file1 +touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error +Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1 +attr_name2: attr_get: No data available +Could not get "attr_name2" for /mnt/scratch/testdir/remote_file1 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file2 +touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error +Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2 +Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2 +attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19 - + +attr_remove: Input/output error +Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file2 +touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error +Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2 +attr_name2: attr_get: No data available +Could not get "attr_name2" for /mnt/scratch/testdir/remote_file2 +d41d8cd98f00b204e9800998ecf8427e - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/sf_file +touch: cannot touch 'SCRATCH_MNT/testdir/sf_file': Input/output error +Attribute "attr_name1" has a 64 byte value for SCRATCH_MNT/testdir/sf_file +Attribute "attr_name2" has a 17 byte value for SCRATCH_MNT/testdir/sf_file +attr_name2: 9a6eb1bc9da3c66a9b495dfe2fe8a756 - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/leaf_file +touch: cannot touch 'SCRATCH_MNT/testdir/leaf_file': Input/output error +Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/leaf_file +Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file +Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file +attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a - + +attr_set: Input/output error +Could not set "attr_name2" for SCRATCH_MNT/testdir/node_file +touch: cannot touch 'SCRATCH_MNT/testdir/node_file': Input/output error +Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/node_file +Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/node_file +attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a - + +*** done From patchwork Thu Jun 2 00:31:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867400 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 697B8C433EF for ; Thu, 2 Jun 2022 00:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232731AbiFBAbd (ORCPT ); Wed, 1 Jun 2022 20:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232707AbiFBAbc (ORCPT ); Wed, 1 Jun 2022 20:31:32 -0400 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F329B29B2CE for ; Wed, 1 Jun 2022 17:31:30 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 1D91910E704B for ; Thu, 2 Jun 2022 10:31:30 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkK-001b7K-U1 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:28 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkK-00CBb9-Sz for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:28 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 2/8] README: document _begin_fstests better Date: Thu, 2 Jun 2022 10:31:20 +1000 Message-Id: <20220602003126.2903779-3-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=deDjYVbe c=1 sm=1 tr=0 ts=629804e2 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=20KFwNOVAAAA:8 a=bvZIf4D7QRW2fNdc6ckA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner Because how it actually gets used by the fstests infrastructure has been undocumented and that has impact on how it should be set up. Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong --- README | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/README b/README index 7da66cb6..80d148be 100644 --- a/README +++ b/README @@ -368,19 +368,41 @@ Test script environment: 6. Test group membership: Each test can be associated with any number of groups for convenient selection of subsets of tests. Group names - can be any sequence of non-whitespace characters. Test authors - associate a test with groups by passing the names of those groups as - arguments to the _begin_fstest function. For example, the code: + must be human readable using only characters in the set [:alnum:_-]. - _begin_fstest auto quick subvol snapshot + Test authors associate a test with groups by passing the names of those + groups as arguments to the _begin_fstest function. While _begin_fstests + is a shell function that must be called at the start of a test to + initialise the test environment correctly, the the build infrastructure + also scans the test files for _begin_fstests invocations. It does this + to compile the group lists that are used to determine which tests to run + when `check` is executed. In other words, test files files must call + _begin_fstest with their intended groups or they will not be run. + + However, because the build infrastructure also uses _begin_fstests as + a defined keyword, addition restrictions are placed on how it must be + formatted: + + (a) It must be a single line with no multi-line continuations. + + (b) group names should be separated by spaces and not other whitespace + + (c) A '#' placed anywhere in the list, even in the middle of a group + name, will cause everything from the # to the end of the line to be + ignored. + + For example, the code: + + _begin_fstest auto quick subvol snapshot # metadata associates the current test with the "auto", "quick", "subvol", and - "snapshot" groups. It is not necessary to specify the "all" group - in the list because that group is computed at run time. + "snapshot" groups. Because "metadata" is after the "#" comment + delimiter, it is ignored by the build infrastructure and so it will not + be associated with that group. + + It is not necessary to specify the "all" group in the list because that + group is always computed at run time from the group lists. - The build process scans test files for _begin_fstest invocations and - compiles the group list from that information. In other words, test - files must call _begin_fstest or they will not be run. Verified output: From patchwork Thu Jun 2 00:31:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867405 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 0C67FCCA473 for ; Thu, 2 Jun 2022 00:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbiFBAbh (ORCPT ); Wed, 1 Jun 2022 20:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbiFBAbe (ORCPT ); Wed, 1 Jun 2022 20:31:34 -0400 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0901929B2CF for ; Wed, 1 Jun 2022 17:31:33 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 9F3B110E6FDF for ; Thu, 2 Jun 2022 10:31:30 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkK-001b7L-V0 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:28 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkK-00CBbD-U1 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:28 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 3/8] generic/081: don't run on DAX capable devices Date: Thu, 2 Jun 2022 10:31:21 +1000 Message-Id: <20220602003126.2903779-4-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=deDjYVbe c=1 sm=1 tr=0 ts=629804e2 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=20KFwNOVAAAA:8 a=ZX5orWydIAkmiaoJ8_sA:9 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner LVM/DM has conniptions when you try to use snapshots on a device that has DAX capability. It first sets up the underlying device as a DAX capable mapping (type 3 or DM_TYPE_DAX_BIO_BASED) but because snapshots require COW and shared mappings, it isn't supported on DAX capable devices. Hence creating the snapshot device fails because it requires a type 1 (DM_TYPE_BIO_BASED) device and DM can't change types on a loaded mapping. Hence we get this obscure error message in the log: device-mapper: ioctl: can't change device type (old=3 vs new=1) after initial table load. and these obscure, unhelpful error messages from the LVM command outputs: device-mapper: reload ioctl on (251:0) failed: Invalid argument Failed to suspend logical volume vg_081/base_081. Device vg_081-base_081-real (251:1) is used by another device. Failed to revert logical volume vg_081/base_081. Aborting. Manual intervention required. Failed to create snapshot How to turn off DAX capability is not documented in dmsetup or LVM man pages, nor is dax mentioned anywhere in Documentation/admin/device-mapper/ so I have no idea how to tell LVM/DM "don't try to enable DAX support!". As such, if the uderlying block device is dax capable, skip this test. Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong --- common/rc | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/common/rc b/common/rc index 2f31ca46..c334cfbf 100644 --- a/common/rc +++ b/common/rc @@ -2116,21 +2116,33 @@ _require_sane_bdev_flush() # Decide if the scratch filesystem is likely to be mounted in fsdax mode. # It goes 3 ways based on mount options:: # 1. "dax" or "dax=always" means always test using DAX -# 2. "dax=never" means we'll never use DAX +# 2. "dax=never" means we'll never use DAX. # 3. "dax=inode" or nothing means "use scratch dev capability" to # determine whether DAX is going to be used. # -# Returns 0 if DAX will be used, 1 if DAX is not going to be used. +# Case 2 and 3 basically mean the same thing for the purpose of +# _require_dm_target(). If the fs is not forcing the use of DAX, then DAX +# can only be enabled if the underlying block device supports it. +# +# Returns 0 if the filesytem will use DAX, 1 if it won't. __scratch_uses_fsdax() { local ops=$(_normalize_mount_options "$MOUNT_OPTIONS") echo $ops | egrep -qw "dax(=always| |$)" && return 0 - echo $ops | grep -qw "dax=never" && return 1 + return 1 +} +# Determine if the scratch device is DAX capable. Even if the fs is not +# using DAX, we still can't use certain device mapper targets if the block +# device is DAX capable. Hence the check needs to be separat from the FS +# capability. +__scratch_dev_has_dax() +{ local sysfs="/sys/block/$(_short_dev $SCRATCH_DEV)" test -e "${sysfs}/dax" && return 0 test "$(cat "${sysfs}/queue/dax" 2>/dev/null)" = "1" && return 0 + return 1 } @@ -2147,15 +2159,18 @@ _require_dm_target() _require_sane_bdev_flush $SCRATCH_DEV _require_command "$DMSETUP_PROG" dmsetup - if __scratch_uses_fsdax; then - case $target in - stripe|linear|log-writes) - ;; - *) - _notrun "Cannot run tests with DAX on $target devices." - ;; - esac - fi + case $target in + stripe|linear|log-writes) + ;; + *) + if __scratch_uses_fsdax; then + _notrun "Cannot run tests with fsdax on $target devices." + fi + if __scratch_dev_has_dax; then + _notrun "Cannot use $target devices on DAX capable block devices." + fi + ;; + esac modprobe dm-$target >/dev/null 2>&1 From patchwork Thu Jun 2 00:31:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867399 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 CF2C4C43334 for ; Thu, 2 Jun 2022 00:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232619AbiFBAbd (ORCPT ); Wed, 1 Jun 2022 20:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232731AbiFBAbc (ORCPT ); Wed, 1 Jun 2022 20:31:32 -0400 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F349129B2D0 for ; Wed, 1 Jun 2022 17:31:30 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 1F7D110E704D for ; Thu, 2 Jun 2022 10:31:30 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkL-001b7Q-01 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkK-00CBbH-Ux for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:28 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 4/8] generic/038: kill background threads on interrupt Date: Thu, 2 Jun 2022 10:31:22 +1000 Message-Id: <20220602003126.2903779-5-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=e9dl9Yl/ c=1 sm=1 tr=0 ts=629804e2 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=20KFwNOVAAAA:8 a=pGLkceISAAAA:8 a=MlRuX_47ZaTdqfiRnIwA:9 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner When I ctrl-c g/038, it either does nothing or it leaves processes running in the background. It is not cleaning up it's background processes correctly, so add kill vectors into the cleanup. Make sure we only kill in the cleanup trap if the background processes are running. Signed-off-by: Dave Chinner Reviewed-by: Amir Goldstein Reviewed-by: Darrick J. Wong --- tests/generic/038 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/generic/038 b/tests/generic/038 index c6cea94e..e9b49967 100755 --- a/tests/generic/038 +++ b/tests/generic/038 @@ -36,6 +36,10 @@ _begin_fstest auto stress trim # Override the default cleanup function. _cleanup() { + [ -n "${create_pids}" ] && kill ${create_pids[@]} + [ -n "${fallocate_pids}" ] && kill ${fallocate_pids[@]} + [ -n "${trim_pids}" ] && kill ${trim_pids[@]} + wait rm -fr $tmp } @@ -47,6 +51,8 @@ _supported_fs generic _require_scratch _require_xfs_io_command "falloc" +echo "Silence is golden" + # Keep allocating and deallocating 1G of data space with the goal of creating # and deleting 1 block group constantly. The intention is to race with the # fstrim loop below. @@ -113,7 +119,7 @@ create_files() done wait ${create_pids[@]} - + unset create_pids } _scratch_mkfs >>$seqres.full 2>&1 @@ -136,12 +142,8 @@ create_files "foobar" kill ${fallocate_pids[@]} kill ${trim_pids[@]} wait +unset fallocate_pids +unset trim_pids -# The fstests framework will now check for fs consistency with fsck. -# The trimming was racy and caused some btree nodes to get full of zeroes on -# disk, which obviously caused fs metadata corruption. The race often lead -# to missing free space entries in a block group's free space cache too. - -echo "Silence is golden" status=0 exit From patchwork Thu Jun 2 00:31:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867402 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 1A2D4CCA478 for ; Thu, 2 Jun 2022 00:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232708AbiFBAbf (ORCPT ); Wed, 1 Jun 2022 20:31:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232709AbiFBAbc (ORCPT ); Wed, 1 Jun 2022 20:31:32 -0400 Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F359929B2D3 for ; Wed, 1 Jun 2022 17:31:30 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 1EA5D5EC476 for ; Thu, 2 Jun 2022 10:31:30 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkL-001b7S-10 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkL-00CBbL-03 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 5/8] xfs/538: fix fsstress scaling Date: Thu, 2 Jun 2022 10:31:23 +1000 Message-Id: <20220602003126.2903779-6-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=VuxAv86n c=1 sm=1 tr=0 ts=629804e2 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=20KFwNOVAAAA:8 a=Qw95BkSvUeI-LC7-d4YA:9 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner _scale_fsstress_args() does time/load scaling of parameters. Doing it also in the test causes exponential scaling instead of linear scaling as the time/load parameters are meant to do. Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong --- tests/xfs/538 | 36 +++++++++++++++++------------------- tests/xfs/538.out | 3 +-- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/xfs/538 b/tests/xfs/538 index e0102f48..2b5e97e5 100755 --- a/tests/xfs/538 +++ b/tests/xfs/538 @@ -47,25 +47,23 @@ done echo "Inject bmap_alloc_minlen_extent error tag" _scratch_inject_error bmap_alloc_minlen_extent 1 -echo "Scale fsstress args" -args=$(_scale_fsstress_args -p $((LOAD_FACTOR * 75)) -n $((TIME_FACTOR * 1000))) - -echo "Execute fsstress in background" -$FSSTRESS_PROG -d $SCRATCH_MNT $args \ - -f bulkstat=0 \ - -f bulkstat1=0 \ - -f fiemap=0 \ - -f getattr=0 \ - -f getdents=0 \ - -f getfattr=0 \ - -f listfattr=0 \ - -f mread=0 \ - -f read=0 \ - -f readlink=0 \ - -f readv=0 \ - -f stat=0 \ - -f aread=0 \ - -f dread=0 > /dev/null 2>&1 +echo "Execute fsstress" +$FSSTRESS_PROG -d $SCRATCH_MNT \ + $(_scale_fsstress_args -p 75 -n 1000) \ + -f bulkstat=0 \ + -f bulkstat1=0 \ + -f fiemap=0 \ + -f getattr=0 \ + -f getdents=0 \ + -f getfattr=0 \ + -f listfattr=0 \ + -f mread=0 \ + -f read=0 \ + -f readlink=0 \ + -f readv=0 \ + -f stat=0 \ + -f aread=0 \ + -f dread=0 > /dev/null 2>&1 # success, all done status=0 diff --git a/tests/xfs/538.out b/tests/xfs/538.out index 85932c82..97ebc314 100644 --- a/tests/xfs/538.out +++ b/tests/xfs/538.out @@ -3,5 +3,4 @@ Format and mount fs Consume free space Create fragmented filesystem Inject bmap_alloc_minlen_extent error tag -Scale fsstress args -Execute fsstress in background +Execute fsstress From patchwork Thu Jun 2 00:31:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867404 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 A1D30C433EF for ; Thu, 2 Jun 2022 00:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232734AbiFBAbg (ORCPT ); Wed, 1 Jun 2022 20:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232733AbiFBAbd (ORCPT ); Wed, 1 Jun 2022 20:31:33 -0400 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C40729B2D0 for ; Wed, 1 Jun 2022 17:31:33 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 3F5BB10E6FEE for ; Thu, 2 Jun 2022 10:31:30 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkL-001b7U-2K for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkL-00CBbT-13 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 6/8] xfs/070: filter the bad sb magic number error Date: Thu, 2 Jun 2022 10:31:24 +1000 Message-Id: <20220602003126.2903779-7-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=VuxAv86n c=1 sm=1 tr=0 ts=629804e2 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=20KFwNOVAAAA:8 a=WSQDyuQb4SG-2VYXhFAA:9 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner Lastest XFS kernel makes the superblock bad magic number error message more meaningful, and that's being picked up by xfsprogs in very short order. And, of course, the error is output by xfs_repair, too, and it's been captured in the golden output of a test. Fix it by filtering the output back down to the old message. Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong --- common/repair | 1 + 1 file changed, 1 insertion(+) diff --git a/common/repair b/common/repair index 5a957f4e..463ef9db 100644 --- a/common/repair +++ b/common/repair @@ -90,6 +90,7 @@ s/(superblock) (\d+)/\1 AGNO/; s/(AG \#)(\d+)/\1AGNO/; s/(reset bad sb for ag) (\d+)/\1 AGNO/; s/(unknown block state, ag )(\d+)(, blocks? )(\d+)/\1AGNO\3AGBNO/; +s/^Superblock has (bad magic number) 0x.*/\1/; /^Note - quota info will be regenerated on next quota mount.$/ && next; print;' } From patchwork Thu Jun 2 00:31:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867401 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 B71D2CCA473 for ; Thu, 2 Jun 2022 00:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbiFBAbe (ORCPT ); Wed, 1 Jun 2022 20:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232708AbiFBAbc (ORCPT ); Wed, 1 Jun 2022 20:31:32 -0400 Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E773729B2C0 for ; Wed, 1 Jun 2022 17:31:30 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id D4DA85EC473 for ; Thu, 2 Jun 2022 10:31:29 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkL-001b7W-3C for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkL-00CBbY-2N for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 7/8] xfs/167: adjust runtime with TIME_FACTOR Date: Thu, 2 Jun 2022 10:31:25 +1000 Message-Id: <20220602003126.2903779-8-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=e9dl9Yl/ c=1 sm=1 tr=0 ts=629804e1 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=20KFwNOVAAAA:8 a=sEeDiNUY4z0xlJLUWFwA:9 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner xfs/167 takes between 6 and 10 minutes to run on my SSD based test machines. It's running 50 loops of a unwritten extent conversion test program whilst running a heavy fsstress workload in the background. This does not need to run for 10 minutes on every auto group regression test run. Shorten it to loop 5 * TIME_FACTOR so that normal runtime drops to something sane but can still be easily ramped up if soak/stress testing is being run. Signed-off-by: Dave Chinner Reviewed-by: Darrick J. Wong --- tests/xfs/167 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/xfs/167 b/tests/xfs/167 index 5f985010..15bb1854 100755 --- a/tests/xfs/167 +++ b/tests/xfs/167 @@ -47,13 +47,11 @@ _require_fs_space $SCRATCH_MNT 10485760 TEST_FILE=$SCRATCH_MNT/test_file TEST_PROG=$here/src/unwritten_sync -LOOPS=50 +LOOPS=$((5 * $TIME_FACTOR)) echo "*** test unwritten extent conversion under heavy I/O" - -workout - rm -f $TEST_FILE +workout $TEST_PROG $LOOPS $TEST_FILE echo " *** test done" From patchwork Thu Jun 2 00:31:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12867403 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 3FD8CCCA47A for ; Thu, 2 Jun 2022 00:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232732AbiFBAbg (ORCPT ); Wed, 1 Jun 2022 20:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbiFBAbe (ORCPT ); Wed, 1 Jun 2022 20:31:34 -0400 Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B67EF29B2C0 for ; Wed, 1 Jun 2022 17:31:32 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 2CE2B5EC465 for ; Thu, 2 Jun 2022 10:31:30 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1nwYkL-001b7f-40 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 Received: from dave by discord.disaster.area with local (Exim 4.95) (envelope-from ) id 1nwYkL-00CBbd-39 for fstests@vger.kernel.org; Thu, 02 Jun 2022 10:31:29 +1000 From: Dave Chinner To: fstests@vger.kernel.org Subject: [PATCH 8/8] xfs/189: systemd monitoring of /etc/fstab sucks Date: Thu, 2 Jun 2022 10:31:26 +1000 Message-Id: <20220602003126.2903779-9-david@fromorbit.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220602003126.2903779-1-david@fromorbit.com> References: <20220602003126.2903779-1-david@fromorbit.com> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=VuxAv86n c=1 sm=1 tr=0 ts=629804e2 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=JPEYwPQDsx4A:10 a=20KFwNOVAAAA:8 a=2qWbhfOqrkg1V0WdcQQA:9 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Dave Chinner On a recently upgraded system, xfs/189 still works just fine, but every test run after it now gets spammed from mount/systemd like so: xfs/189 [not run] noattr2 mount option not supported on /dev/vdc xfs/190 1s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. 1s xfs/192 3s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. 2s xfs/193 2s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. 2s xfs/194 1s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. This is because xfs/189 modifies /etc/fstab during the test, then restores it to it's original condition so there's nothing to update. However, systemd is sees that the mtime of /etc/fstab has changed, and assumes they sky has fallen and so everything must be reloaded from scratch to silence the unnecessary "hint". We can avoid this clumsiness by capturing the mtime of /etc/fstab before we modify it, and restore it afterwards and that means systemd doesn't even notice that we've being playing around with /etc/fstab. Signed-off-by: Dave Chinner --- tests/xfs/189 | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/tests/xfs/189 b/tests/xfs/189 index e601881a..6287a733 100755 --- a/tests/xfs/189 +++ b/tests/xfs/189 @@ -32,6 +32,27 @@ # # <---- Normal programming is resumed ----> # +# <---- Bbbzzzzzzztttt ----> +# +# < systemd enters the chat > +# +# xfs/189 [not run] noattr2 mount option not supported on /dev/vdc +# xfs/190 1s ... mount: (hint) your fstab has been modified, but systemd still uses +# the old version; use 'systemctl daemon-reload' to reload. +# 1s +# xfs/192 3s ... mount: (hint) your fstab has been modified, but systemd still uses +# the old version; use 'systemctl daemon-reload' to reload. +# +# So now mount/systemd sees that /etc/fstab has changed (because mtime changed) +# and so it now whines that it needs updating on every mount from this point +# onwards. Yes, that's totally obnoxious behaviour from mount/systemd but we +# have to work around it. +# +# Hence we save/restore the mtime of /etc/fstab around every modification we +# make so that any time /etc/fstab is checked in future it won't appear to have +# changed. +# +# < systemd leaves the chat > # . ./common/preamble _begin_fstest mount auto quick @@ -190,31 +211,46 @@ ENDL # Example fstab entry # /dev/sdb2 /mnt/scratch1 xfs defaults 0 0 # +# Note that to avoid systemd whinging about /etc/fstab being modified, we +# need to ensure the mtime of /etc/fstab does not change across all these +# modifications. +# _add_scratch_fstab() { + local mtime="$(stat -c %y /etc/fstab)" + # comment out any existing SCRATCH_DEV $SED_PROG -i "s;$SCRATCH_DEV;#$SCRATCH_DEV;" /etc/fstab # add our fstab entry echo "$SCRATCH_DEV $SCRATCH_MNT xfs defaults 0 0 # $tag" >> /etc/fstab + + touch -m --date="$mtime" /etc/fstab } _modify_scratch_fstab() { - opts=$1 + local opts=$1 + local mtime="$(stat -c %y /etc/fstab)" # modify our fstab entry that we added # modify opts by looking for last word which has non-space chars $SED_PROG -i "s; [^ ]* 0 0 # $tag; $opts 0 0 # $tag;" /etc/fstab + + touch -m --date="$mtime" /etc/fstab } _putback_scratch_fstab() { + local mtime="$(stat -c %y /etc/fstab)" + # uncomment out any existing SCRATCH_DEV $SED_PROG -i "s;#$SCRATCH_DEV;$SCRATCH_DEV;" /etc/fstab # remove the one we added at the end $SED_PROG -i "/# $tag/d" /etc/fstab + + touch -m --date="$mtime" /etc/fstab } # Import common functions.