Skip to contentSkip to conversation

xfstests: add log attribute replay test

PATCH In review Catherine Hoang 5 participants 15 messages Feb 23, 2022 – May 7, 2022

lore
Share & tools
lore
#0 lore raw

v7 cover xfstests: add log attribute replay test

Hi all,

This patch aims to provide better test coverage for Allison’s delayed attribute set. 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.

The following cases are covered in this test:
- empty, add/remove inline attr (64 bytes)
- empty, add/remove internal attr (1kB)
- empty, add/remove remote attr (64kB)
- inline, add/remove inline attr (64 bytes)
- inline, add/remove internal attr (1kB)
- inline, add/remove remote attr (64kB)
- extent, add/remove internal attr (1kB)
- extent, add multiple internal attr (inject error on split operation)
- extent, add multiple internal attr (inject error on transition to node)
- extent, add/remove remote attr (64kB)
- btree, add/remove multiple internal (1kB)
- btree, add/remove remote attr (64kB)
- overwrite shortform attr
- overwrite leaf attr
- overwrite node attr

Running these tests require the corresponding kernel and xfsprogs changes that add the new error tags da_leaf_split and attr_leaf_to_node.

v6->v7:
- Rename larp_leaf_to_node to attr_leaf_to_node
- Check that the larp knob is writable
- Cleanup files that were created during testing

Suggestions and feedback are appreciated!

Catherine

Allison Henderson (1):
xfstests: Add Log Attribute Replay test

 tests/xfs/543     | 176 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/543.out | 149 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 325 insertions(+)
 create mode 100755 tests/xfs/543
 create mode 100644 tests/xfs/543.out
Signature · 1 line
2.25.1
#1 lore raw

PATCH v7 1/1 xfstests: Add Log Attribute Replay test

From: Allison Henderson <[email protected]>

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.

---
 tests/xfs/543     | 176 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/543.out | 149 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 325 insertions(+)
 create mode 100755 tests/xfs/543
 create mode 100644 tests/xfs/543.out
tests/xfs/543 new file +176 -0
new file mode 100755
index 00000000..06f16f21
@@ -0,0 +1,176 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 543
+#
+# 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.* $testdir
+	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 -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+
+	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_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
+create_test_file sf_file 2 $attr64
+test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+
+# replace leaf
+create_test_file leaf_file 2 $attr1k
+test_attr_replay leaf_file "attr_name2" $attr1k "s" "larp"
+
+# replace node
+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" $attr1k "s" "larp"
+
+echo "*** done"
+status=0
+exit
tests/xfs/543.out new file +149 -0

149 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v7 1/1] xfstests: Add Log Attribute Replay test

Quoted 9 lines · Catherine Hoang

From: Allison Henderson <[email protected]>

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.

This looks good to me, though I can't give an rvb as a co-author. We'll need to get the kernel/user space features merged before the test can run though. It seems Darrick has found a bug in generic/467, so we'll need to get that weeded out before the rest can follow. We'll chat more in our meeting today.

In the meantime, I encourgage reviews for the testcase since we will eventually need it.

Thanks all!
Allison

Quoted 344 lines
---
  tests/xfs/543     | 176 ++++++++++++++++++++++++++++++++++++++++++++++
  tests/xfs/543.out | 149 +++++++++++++++++++++++++++++++++++++++
  2 files changed, 325 insertions(+)

create mode 100755 tests/xfs/543
create mode 100644 tests/xfs/543.out

tests/xfs/543 new file +176 -0
new file mode 100755
index 00000000..06f16f21
@@ -0,0 +1,176 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 543
+#
+# 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.* $testdir
+	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 -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+
+	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_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
+create_test_file sf_file 2 $attr64
+test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+
+# replace leaf
+create_test_file leaf_file 2 $attr1k
+test_attr_replay leaf_file "attr_name2" $attr1k "s" "larp"
+
+# replace node
+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" $attr1k "s" "larp"
+
+echo "*** done"
+status=0
+exit
tests/xfs/543.out new file +149 -0
new file mode 100644
index 00000000..1c74e795
@@ -0,0 +1,149 @@
+QA output created by 543
+*** 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
+21d850f99c43cc13abbe34838a8a3c8a  -
+
+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_get: No data available
+Could not get "attr_name" for SCRATCH_MNT/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
+2ff89c2935debc431745ec791be5421a  -
+
+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_get: No data available
+Could not get "attr_name" for SCRATCH_MNT/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
+5d24b314242c52176c98ac4bd685da8b  -
+
+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_get: No data available
+Could not get "attr_name" for SCRATCH_MNT/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
+5a7b559a70d8e92b4f3c6f7158eead08  -
+
+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
+attr_get: No data available
+Could not get "attr_name2" for SCRATCH_MNT/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
+5717d5e66c70be6bdb00ecbaca0b7749  -
+
+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
+attr_get: No data available
+Could not get "attr_name2" for SCRATCH_MNT/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
+5c929964efd1b243aa8cceb6524f4810  -
+
+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
+attr_get: No data available
+Could not get "attr_name2" for SCRATCH_MNT/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
+51ccb5cdfc9082060f0f94a8a108fea0  -
+
+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
+attr_get: No data available
+Could not get "attr_name2" for SCRATCH_MNT/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
+8d530bbe852d8bca83b131d5b3e497f5  -
+
+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
+5d77c4d3831a35bcbbd6e7677119ce9a  -
+
+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
+6707ec2431e4dbea20e17da0816520bb  -
+
+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
+attr_get: No data available
+Could not get "attr_name2" for SCRATCH_MNT/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
+767ebca3e4a6d24170857364f2bf2a3c  -
+
+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
+attr_get: No data available
+Could not get "attr_name2" for SCRATCH_MNT/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
+fd84ddec89237e6d34a1703639efaebf  -
+
+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
+attr_get: No data available
+Could not get "attr_name2" for SCRATCH_MNT/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
+34aaa49662bafb46c76e377454685071  -
+
+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
+664e95ec28830ffb367c0950026e0d21  -
+
+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
+bb37a78ce26472eeb711e3559933db42  -
+
+*** done
#3 lore raw

Re: [PATCH v7 1/1] xfstests: Add Log Attribute Replay test

In reply to Catherine Hoang
Quoted 33 lines · Catherine Hoang

From: Allison Henderson <[email protected]>

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.

---
 tests/xfs/543     | 176 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/543.out | 149 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 325 insertions(+)
 create mode 100755 tests/xfs/543
 create mode 100644 tests/xfs/543.out
tests/xfs/543 new file +11 -0
new file mode 100755
index 00000000..06f16f21
@@ -0,0 +1,176 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 543
+#
+# Log attribute replay test
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+

tests/xfs/543 line 21

Quoted 10 lines
tests/xfs/543 new file +10 -0
+# get standard environment, filters and checks
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+	rm -rf $tmp.* $testdir
+	test -w /sys/fs/xfs/debug/larp && \
+		echo 0 > /sys/fs/xfs/debug/larp

This is problematic - I set larp=1 before I start running fstests so all tests exercise the LARP paths. This will turn off LARP unconditionally, so after this runs nothing will exercise the LARP paths, even if that's what I want the tests to do.

Also, this does not replicate what the generic _cleanup() function does.

Also, no need to remove $testdir - it's on the scratch device.

Also, don't call things "testdir" because "test directory" has specific meaning - i.e. the *test device mount* - and this is too easy to confuse when reading the test code.

Quoted 46 lines
tests/xfs/543 new file +46 -0
+}
+
+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 -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+
+	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
+}

tests/xfs/543 line 77

Quoted 10 lines
tests/xfs/543 new file +10 -0
+
+# real QA test starts here
+_supported_fs xfs
+
+_require_scratch
+_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

These go first, before any code.

tests/xfs/543 line 78

Quoted 1 line
tests/xfs/543 new file +1 -0
+test -w /sys/fs/xfs/debug/larp || _notrun "larp knob not writable"

When is the sysfs not writeable?

tests/xfs/543 line 81

Quoted 2 lines
tests/xfs/543 new file +2 -0
+# turn on log attributes
+echo 1 > /sys/fs/xfs/debug/larp

Needs to store the previous value so it can be restored at cleanup.

Quoted 5 lines
tests/xfs/543 new file +5 -0
+attr16="0123456789ABCDEF"
+attr64="$attr16$attr16$attr16$attr16"
+attr256="$attr64$attr64$attr64$attr64"
+attr1k="$attr256$attr256$attr256$attr256"
+attr4k="$attr1k$attr1k$attr1k$attr1k"

tests/xfs/543 line 97

Quoted 10 lines
tests/xfs/543 new file +10 -0
+attr8k="$attr4k$attr4k"
+attr16k="$attr8k$attr8k"
+attr32k="$attr16k$attr16k"
+attr64k="$attr32k$attr32k"
+
+echo "*** mkfs"
+_scratch_mkfs >/dev/null
+
+echo "*** mount FS"
+_scratch_mount

There's no need for echo lines like this in the golden output - it's obvious what failed from the diff...

tests/xfs/543 line 100

Quoted 2 lines
tests/xfs/543 new file +2 -0
+testdir=$SCRATCH_MNT/testdir
+mkdir $testdir

Why not just use $SCRATCH_MNT directly?

Quoted 5 lines
tests/xfs/543 new file +5 -0
+
+# 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"

tests/xfs/543 line 115

Quoted 10 lines
tests/xfs/543 new file +10 -0
+
+# 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"

single attr insert/remove. OK.

tests/xfs/543 line 120

Quoted 5 lines
tests/xfs/543 new file +5 -0
+
+# 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"

...

Insert/remove of a second attr and the format
conversions they cause. OK.

Doesn't check that the first xattr is retained and uncorrupted anywhere.

tests/xfs/543 line 162

Quoted 3 lines
tests/xfs/543 new file +3 -0
+# replace shortform
+create_test_file sf_file 2 $attr64
+test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"

This only replaces with same size. We also need coverage of replace with smaller size and larger size, as well as replace causing sf -> leaf and sf -> remote attr format conversions.

tests/xfs/543 line 166

Quoted 3 lines
tests/xfs/543 new file +3 -0
+# replace leaf
+create_test_file leaf_file 2 $attr1k
+test_attr_replay leaf_file "attr_name2" $attr1k "s" "larp"

Need replace causing leaf -> sf (smaller) and well as leaf -> remote attr (larger). Also leaf w/ remote attr -> sf (much smaller!).

tests/xfs/543 line 172

Quoted 5 lines
tests/xfs/543 new file +5 -0
+# replace node
+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" $attr1k "s" "larp"

Need node -> leaf, node -> sf and node w/ remote attr -> sf

tests/xfs/543.out line 6

Quoted 9 lines
tests/xfs/543.out new file +6 -0
@@ -0,0 +1,149 @@
+QA output created by 543
+*** 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

We don't really need to capture the error injection errors, all we care about is that the recovered md5sum matches the expected md5sum:

tests/xfs/543.out line 7

Quoted 1 line
tests/xfs/543.out new file +1 -0
+21d850f99c43cc13abbe34838a8a3c8a  -

That's the recovered md5sum, what was the expected md5sum of the original attr value that we stored? i.e. how do we validate taht we got the correct attr value?

tests/xfs/543.out line 14

Quoted 7 lines
tests/xfs/543.out new file +7 -0
+
+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_get: No data available
+Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file1
+d41d8cd98f00b204e9800998ecf8427e  -

Why do we have md5sum output for an attr that does not exist? We should be capturing the ENODATA error here, as that is the correct response after recovery of a remove operation.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#4 lore raw

PATCH 1/1 xfs/larp: Make test failures debuggable

In reply to Catherine Hoang

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

 tests/xfs/600     |  20 +++++-----
 tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +11 -9
index 252cdf27..84704646 100755
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp
 }
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
 
 	echo ""
 }
@@ -157,19 +159,19 @@ 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
+# replace shortform with different value
 create_test_file sf_file 2 $attr64
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"
 
 echo "*** done"
 status=0
tests/xfs/600.out +74 -35

220 lines not on this page · raw message

Signature · 2 lines
Dave Chinner
[email protected]
Reviewed-by on v1 1/1
#5 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

Quoted 69 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

 tests/xfs/600     |  20 +++++-----
 tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 7 lines
tests/xfs/600 +1 -1
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Please save the old value, then write it back in the _cleanup function.

<slightly ot rant>

These sysfs knobs are a pain because they all reset to defaults if xfs.ko gets cycled. I know, I know, at least Dave and Ted don't do modular kernels and so never see this happen, but I do. I bet Dave also hasn't ever run xfs/434 or xfs/436, which might be why I'm the only one seeing dquot leaks with 5.19-next.

(I might be able to lift the xfs-as-module requirement if "echo 1 > /sys/kernel/slab/*/validate" does what I think it might, since all we want to do is look for slab leaks, and those tests rmmod/modprobe as a brute force way of making the slab debug code check for leaks.)

In case anyone's wondering, a solution to the knobs getting unset after an rmmod/modprobe cycle is to add a file /etc/udev/rules.d/99-fstester.rules containing:

ACTION=="add|change", SUBSYSTEM=="module", DEVPATH=="/module/${module}", RUN+="/bin/sh -c \"echo ${value} > ${knob}\""

which should be enough to keep LARP turned on.

<end rant>

Anyway, since this is a proposed test, I say that with this applied and the debug knob bits fixed, the whole thing is

--D

Quoted 267 lines
tests/xfs/600 +10 -8
 }
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
 
 	echo ""
 }
@@ -157,19 +159,19 @@ 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
+# replace shortform with different value
 create_test_file sf_file 2 $attr64
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"
 
 echo "*** done"
 status=0
tests/xfs/600.out +74 -35
index 96b1d7d9..fe25ea3e 100644
@@ -4,146 +4,185 @@ QA output created by 600
 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
-21d850f99c43cc13abbe34838a8a3c8a  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file1
+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
-2ff89c2935debc431745ec791be5421a  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file2
+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
-5d24b314242c52176c98ac4bd685da8b  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file3
+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
-5a7b559a70d8e92b4f3c6f7158eead08  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file1
+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
-5717d5e66c70be6bdb00ecbaca0b7749  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file2
+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
-5c929964efd1b243aa8cceb6524f4810  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file3
+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
-51ccb5cdfc9082060f0f94a8a108fea0  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file1
+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
-8d530bbe852d8bca83b131d5b3e497f5  -
+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
-5d77c4d3831a35bcbbd6e7677119ce9a  -
+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
-6707ec2431e4dbea20e17da0816520bb  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file4
+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
-767ebca3e4a6d24170857364f2bf2a3c  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file1
+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
-fd84ddec89237e6d34a1703639efaebf  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file2
+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
-34aaa49662bafb46c76e377454685071  -
+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
-664e95ec28830ffb367c0950026e0d21  -
+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
-bb37a78ce26472eeb711e3559933db42  -
+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
Signature · 2 lines
Dave Chinner
[email protected]
#6 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

Quoted 80 lines · Darrick J. Wong
Quoted 69 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

 tests/xfs/600     |  20 +++++-----
 tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 7 lines
tests/xfs/600 +1 -1
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Quoted 1 line

Please save the old value, then write it back in the _cleanup function.

Ok, I'm going to do that when I merge it, if Catherine wouldn't like to do more changes in a V8 patch. If this case still need more changes, please tell me in time, and then it might have to wait the fstests release after next, if too late.

Thanks,
Zorro

Quoted 298 lines

<slightly ot rant>

These sysfs knobs are a pain because they all reset to defaults if xfs.ko gets cycled. I know, I know, at least Dave and Ted don't do modular kernels and so never see this happen, but I do. I bet Dave also hasn't ever run xfs/434 or xfs/436, which might be why I'm the only one seeing dquot leaks with 5.19-next.

(I might be able to lift the xfs-as-module requirement if "echo 1 > /sys/kernel/slab/*/validate" does what I think it might, since all we want to do is look for slab leaks, and those tests rmmod/modprobe as a brute force way of making the slab debug code check for leaks.)

In case anyone's wondering, a solution to the knobs getting unset after an rmmod/modprobe cycle is to add a file /etc/udev/rules.d/99-fstester.rules containing:

ACTION=="add|change", SUBSYSTEM=="module", DEVPATH=="/module/${module}", RUN+="/bin/sh -c \"echo ${value} > ${knob}\""

which should be enough to keep LARP turned on.

<end rant>

Anyway, since this is a proposed test, I say that with this applied and the debug knob bits fixed, the whole thing is

--D

Quoted 267 lines
tests/xfs/600 +10 -8
 }
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
 
 	echo ""
 }
@@ -157,19 +159,19 @@ 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
+# replace shortform with different value
 create_test_file sf_file 2 $attr64
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"
 
 echo "*** done"
 status=0
tests/xfs/600.out +74 -35
index 96b1d7d9..fe25ea3e 100644
@@ -4,146 +4,185 @@ QA output created by 600
 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
-21d850f99c43cc13abbe34838a8a3c8a  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file1
+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
-2ff89c2935debc431745ec791be5421a  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file2
+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
-5d24b314242c52176c98ac4bd685da8b  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file3
+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
-5a7b559a70d8e92b4f3c6f7158eead08  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file1
+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
-5717d5e66c70be6bdb00ecbaca0b7749  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file2
+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
-5c929964efd1b243aa8cceb6524f4810  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file3
+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
-51ccb5cdfc9082060f0f94a8a108fea0  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file1
+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
-8d530bbe852d8bca83b131d5b3e497f5  -
+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
-5d77c4d3831a35bcbbd6e7677119ce9a  -
+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
-6707ec2431e4dbea20e17da0816520bb  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file4
+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
-767ebca3e4a6d24170857364f2bf2a3c  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file1
+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
-fd84ddec89237e6d34a1703639efaebf  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file2
+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
-34aaa49662bafb46c76e377454685071  -
+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
-664e95ec28830ffb367c0950026e0d21  -
+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
-bb37a78ce26472eeb711e3559933db42  -
+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
Signature · 2 lines
Dave Chinner
[email protected]
#7 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

Quoted 85 lines · Zorro Lang
Quoted 80 lines · Darrick J. Wong
Quoted 69 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

tests/xfs/600 | 20 +++++-----
tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------

2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 7 lines
tests/xfs/600 +1 -1
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Quoted 1 line

Please save the old value, then write it back in the _cleanup function.

Quoted 7 lines

Ok, I'm going to do that when I merge it, if Catherine wouldn't like to do more changes in a V8 patch. If this case still need more changes, please tell me in time, and then it might have to wait the fstests release after next, if too late.

Thanks,
Zorro

Based on Dave’s feedback, it looks like the patch will need a few more changes before it’s ready.

Catherine

Quoted 300 lines
Quoted 299 lines

<slightly ot rant>

These sysfs knobs are a pain because they all reset to defaults if xfs.ko gets cycled. I know, I know, at least Dave and Ted don't do modular kernels and so never see this happen, but I do. I bet Dave also hasn't ever run xfs/434 or xfs/436, which might be why I'm the only one seeing dquot leaks with 5.19-next.

(I might be able to lift the xfs-as-module requirement if "echo 1 > /sys/kernel/slab/*/validate" does what I think it might, since all we want to do is look for slab leaks, and those tests rmmod/modprobe as a brute force way of making the slab debug code check for leaks.)

In case anyone's wondering, a solution to the knobs getting unset after an rmmod/modprobe cycle is to add a file /etc/udev/rules.d/99-fstester.rules containing:

ACTION=="add|change", SUBSYSTEM=="module", DEVPATH=="/module/${module}", RUN+="/bin/sh -c \"echo ${value} > ${knob}\""

which should be enough to keep LARP turned on.

<end rant>

Anyway, since this is a proposed test, I say that with this applied and the debug knob bits fixed, the whole thing is

--D

Quoted 267 lines
tests/xfs/600 +3 -1
 }
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
 
 	echo ""
 }
@@ -157,19 +159,19 @@ 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"

tests/xfs/600 +1 -1
-# replace shortform
+# replace shortform with different value

create_test_file sf_file 2 $attr64

tests/xfs/600 +5 -5
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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
tests/xfs/600 +1 -1
-test_attr_replay node_file "attr_name2" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"

echo "*** done"
status=0

tests/xfs/600.out +0 -0
index 96b1d7d9..fe25ea3e 100644
@@ -4,146 +4,185 @@ QA output created by 600

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 -21d850f99c43cc13abbe34838a8a3c8a -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file1
+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 -2ff89c2935debc431745ec791be5421a -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file2
+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 -5d24b314242c52176c98ac4bd685da8b -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file3
+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 -5a7b559a70d8e92b4f3c6f7158eead08 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file1
+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 -5717d5e66c70be6bdb00ecbaca0b7749 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file2
+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 -5c929964efd1b243aa8cceb6524f4810 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file3
+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 -51ccb5cdfc9082060f0f94a8a108fea0 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file1
+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 -8d530bbe852d8bca83b131d5b3e497f5 -

tests/xfs/600.out +5 -0
+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 -5d77c4d3831a35bcbbd6e7677119ce9a -

tests/xfs/600.out +5 -0
+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 -6707ec2431e4dbea20e17da0816520bb -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file4
+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 -767ebca3e4a6d24170857364f2bf2a3c -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file1
+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

tests/xfs/600.out +3 -1
-fd84ddec89237e6d34a1703639efaebf  -
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file2
+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 -34aaa49662bafb46c76e377454685071 -

tests/xfs/600.out +3 -0
+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 -664e95ec28830ffb367c0950026e0d21 -

tests/xfs/600.out +4 -0
+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

tests/xfs/600.out +3 -1
-bb37a78ce26472eeb711e3559933db42  -
+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

Signature · 2 lines
Dave Chinner
[email protected]
#8 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

Quoted 90 lines · Catherine Hoang
Quoted 90 lines · Zorro Lang
Quoted 80 lines · Darrick J. Wong
Quoted 69 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

tests/xfs/600 | 20 +++++-----
tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------

2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 7 lines
tests/xfs/600 +1 -1
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Quoted 1 line

Please save the old value, then write it back in the _cleanup function.

Ok, I'm going to do that when I merge it, if Catherine wouldn't like to do more changes in a V8 patch. If this case still need more changes, please tell me in time, and then it might have to wait the fstests release after next, if too late.

Quoted 5 lines
Quoted 2 lines

Thanks,
Zorro

Based on Dave’s feedback, it looks like the patch will need a few more changes before it’s ready.

Great, that would be really helpful if you'd like to rebase this patch to fstests for-next branch. And how about combine Dave's patch with your patch? I don't think it's worth merging two seperated patches for one signle new case. What does Dave think?

I just merged below two patchset[1] into xfs-5.18-fixes-1, then tried to test this case (with you and Dave's patch). But it always failed as [2]. Please make sure it works as expected with those kernel patches still reviewing, I can't be sure I have the testing environment to guarantee that. Or I'd like to push this case after I see its target kernel patchset be merged by xfs-linux at first.

Thanks,
Zorro

[1]
[PATCH v29 00/15] xfs: Log Attribute Replay
[PATCH 00/10 v2] xfs: LARP - clean up xfs_attr_set_iter state machine

[2] out.bad output:
*** 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
xfs_logprint: unknown log operation type (1246)
Bad data in log
mount: /mnt/scratch: mount(2) system call failed: Structure needs cleaning.

Quoted 303 lines

Catherine

Quoted 300 lines
Quoted 299 lines

<slightly ot rant>

These sysfs knobs are a pain because they all reset to defaults if xfs.ko gets cycled. I know, I know, at least Dave and Ted don't do modular kernels and so never see this happen, but I do. I bet Dave also hasn't ever run xfs/434 or xfs/436, which might be why I'm the only one seeing dquot leaks with 5.19-next.

(I might be able to lift the xfs-as-module requirement if "echo 1 > /sys/kernel/slab/*/validate" does what I think it might, since all we want to do is look for slab leaks, and those tests rmmod/modprobe as a brute force way of making the slab debug code check for leaks.)

In case anyone's wondering, a solution to the knobs getting unset after an rmmod/modprobe cycle is to add a file /etc/udev/rules.d/99-fstester.rules containing:

ACTION=="add|change", SUBSYSTEM=="module", DEVPATH=="/module/${module}", RUN+="/bin/sh -c \"echo ${value} > ${knob}\""

which should be enough to keep LARP turned on.

<end rant>

Anyway, since this is a proposed test, I say that with this applied and the debug knob bits fixed, the whole thing is

--D

Quoted 267 lines
tests/xfs/600 +3 -1
 }
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
 
 	echo ""
 }
@@ -157,19 +159,19 @@ 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"

tests/xfs/600 +1 -1
-# replace shortform
+# replace shortform with different value

create_test_file sf_file 2 $attr64

tests/xfs/600 +5 -5
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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
tests/xfs/600 +1 -1
-test_attr_replay node_file "attr_name2" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"

echo "*** done"
status=0

tests/xfs/600.out +0 -0
index 96b1d7d9..fe25ea3e 100644
@@ -4,146 +4,185 @@ QA output created by 600

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 -21d850f99c43cc13abbe34838a8a3c8a -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file1
+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 -2ff89c2935debc431745ec791be5421a -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file2
+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 -5d24b314242c52176c98ac4bd685da8b -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file3
+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 -5a7b559a70d8e92b4f3c6f7158eead08 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file1
+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 -5717d5e66c70be6bdb00ecbaca0b7749 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file2
+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 -5c929964efd1b243aa8cceb6524f4810 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file3
+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 -51ccb5cdfc9082060f0f94a8a108fea0 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file1
+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 -8d530bbe852d8bca83b131d5b3e497f5 -

tests/xfs/600.out +5 -0
+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 -5d77c4d3831a35bcbbd6e7677119ce9a -

tests/xfs/600.out +5 -0
+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 -6707ec2431e4dbea20e17da0816520bb -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file4
+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 -767ebca3e4a6d24170857364f2bf2a3c -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file1
+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

tests/xfs/600.out +3 -1
-fd84ddec89237e6d34a1703639efaebf  -
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file2
+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 -34aaa49662bafb46c76e377454685071 -

tests/xfs/600.out +3 -0
+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 -664e95ec28830ffb367c0950026e0d21 -

tests/xfs/600.out +4 -0
+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

tests/xfs/600.out +3 -1
-bb37a78ce26472eeb711e3559933db42  -
+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

Signature · 2 lines
Dave Chinner
[email protected]
#9 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

Quoted 75 lines · Zorro Lang
Quoted 74 lines · Catherine Hoang
Quoted 74 lines · Zorro Lang
Quoted 71 lines · Darrick J. Wong
Quoted 70 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

tests/xfs/600 | 20 +++++-----
tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------

2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 6 lines
tests/xfs/600 +1 -1
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Yes, I did point that out.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Please save the old value, then write it back in the _cleanup function.

Ok, I'm going to do that when I merge it,

No, please don't. I don't want random changes added to the test on commit right now as I'm still actively working on it. I've said twice now that this needs fixing (3 if you count this mention) and that the test coverage also needs improving. If someone is still working on the tests, then why make more work for everyone by making unnecessary, unreviewed changes on commit?

Quoted 10 lines
Quoted 10 lines
Quoted 7 lines

if Catherine wouldn't like to do
more changes in a V8 patch. If this case still need more changes, please tell me in time, and then it might have to wait the fstests release after next, if too late.

Thanks,
Zorro

Based on Dave’s feedback, it looks like the patch will need a few more changes before it’s ready.

That doesn't mean it can't be merged. It is a pain for mulitple people to collaborate on a test that isn't merged because the test number is not set in stone and chosing numbers always conflicts with other tests under development. Getting the test merged early makes knocking all the problems out of the test (and the code it is testing!) much, much easier.

Quoted 6 lines

Great, that would be really helpful if you'd like to rebase this patch to fstests for-next branch. And how about combine Dave's patch with your patch? I don't think it's worth merging two seperated patches for one signle new case. What does Dave think?

I just merged below two patchset[1] into xfs-5.18-fixes-1, then tried to test this case (with you and Dave's patch). But it always failed as [2].

You built a broken kernel as it has none of the dependencies and bug fixes that had already been committed to for-next for the new functionality to work correctly. I posted a V3 patchset last night and a published a git branch with all the kernel changes that you can use for testing if you want.

Quoted 2 lines

Please make sure it works
as expected with those kernel patches still reviewing,

I did - the failures you see are expected from what you were testing. i.e. the test ran just fine, the kernel code you were running is buggy and you didn't update xfsprogs so logprint supported the new log types, hence the test (correctly) reported failures.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#10 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

Quoted 110 lines · Dave Chinner
Quoted 75 lines · Zorro Lang
Quoted 74 lines · Catherine Hoang
Quoted 74 lines · Zorro Lang
Quoted 71 lines · Darrick J. Wong
Quoted 70 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

tests/xfs/600 | 20 +++++-----
tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------

2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 6 lines
tests/xfs/600 +1 -1
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Yes, I did point that out.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Please save the old value, then write it back in the _cleanup function.

Ok, I'm going to do that when I merge it,

No, please don't. I don't want random changes added to the test on commit right now as I'm still actively working on it. I've said twice now that this needs fixing (3 if you count this mention) and that the test coverage also needs improving. If someone is still working on the tests, then why make more work for everyone by making unnecessary, unreviewed changes on commit?

Quoted 10 lines
Quoted 10 lines
Quoted 7 lines

if Catherine wouldn't like to do
more changes in a V8 patch. If this case still need more changes, please tell me in time, and then it might have to wait the fstests release after next, if too late.

Thanks,
Zorro

Based on Dave’s feedback, it looks like the patch will need a few more changes before it’s ready.

Quoted 6 lines

That doesn't mean it can't be merged. It is a pain for mulitple people to collaborate on a test that isn't merged because the test number is not set in stone and chosing numbers always conflicts with other tests under development. Getting the test merged early makes knocking all the problems out of the test (and the code it is testing!) much, much easier.

Oh, I thought you're hurry to hope this test be merged, so I tried to help it to catch the fstests release of this Sunday. If it's not such hurry, let's back to the regular review workflow, I'll merge this test case *immediately* when I saw a clear RVB on it from you. Then it'll catch the latest fstests release after that (not guarantee this weekend). Hope that help.

Thanks,
Zorro

Quoted 30 lines
Quoted 7 lines

Great, that would be really helpful if you'd like to rebase this patch to fstests for-next branch. And how about combine Dave's patch with your patch? I don't think it's worth merging two seperated patches for one signle new case. What does Dave think?

I just merged below two patchset[1] into xfs-5.18-fixes-1, then tried to test this case (with you and Dave's patch). But it always failed as [2].

You built a broken kernel as it has none of the dependencies and bug fixes that had already been committed to for-next for the new functionality to work correctly. I posted a V3 patchset last night and a published a git branch with all the kernel changes that you can use for testing if you want.

Quoted 2 lines

Please make sure it works
as expected with those kernel patches still reviewing,

I did - the failures you see are expected from what you were testing. i.e. the test ran just fine, the kernel code you were running is buggy and you didn't update xfsprogs so logprint supported the new log types, hence the test (correctly) reported failures.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#11 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

In reply to Zorro Lang
Quoted 160 lines · Zorro Lang
Quoted 127 lines · Catherine Hoang
Quoted 127 lines · Zorro Lang
Quoted 113 lines · Darrick J. Wong
Quoted 102 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and
attribute values. This adds variable path names to the md5sum, so
there's no way to tell if the md5sum is actually correct for the
given attribute value that is returned as it's not constant from
test to test. Hence we can't actually say that the output is correct
because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was
correct, but the md5sum output match was failing. Golden output
appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode
via a list operation to indicate their size, then dump the value of
the test attribute directly to md5sum. This means the md5sum for
the attributes using the same fixed values are all identical, so
it's easy to tell if the md5sum for a given test is correct. We also
check that all attributes that should be present after recovery are
still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an
identical value, hence there is no way to tell if recovery has
resulted in the original being left behind or the new attribute
being fully recovered because both have the same name and value.
When replacing the attribute value, use a different sized value so
it is trivial to determine that we've recovered the new attribute
value correctly.

Also, the test runs on the scratch device - there is no need to
remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and
leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the
test failures I was getting as I debugged the new LARP recovery
algorithm I've written. You'll need to massage the test number in
this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to
manage the larp sysfs knob, but we'll need to do those in the near
future.

Zorro, can you consider merging this test in the near future? We're
right at the point of merging the upstream kernel code and so really
need to start growing the test coverage of this feature, and this
test should simply not-run on kernels that don't have the feature
enabled....

Cheers,

Dave.
---

tests/xfs/600 | 20 +++++-----
tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++-
-----------------

2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 7 lines
tests/xfs/600 +1 -1
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Quoted 2 lines

Please save the old value, then write it back in the _cleanup function.

Ok, I'm going to do that when I merge it, if Catherine wouldn't like to do
more changes in a V8 patch. If this case still need more changes, please tell
me in time, and then it might have to wait the fstests release after next, if
too late.

Quoted 6 lines
Quoted 2 lines

Thanks,
Zorro

Based on Dave’s feedback, it looks like the patch will need a few more
changes before it’s ready.

Great, that would be really helpful if you'd like to rebase this patch to fstests
for-next branch. And how about combine Dave's patch with your patch? I don't think
it's worth merging two seperated patches for one signle new case. What does Dave think?

I just merged below two patchset[1] into xfs-5.18-fixes-1, then tried to test this case
(with you and Dave's patch). But it always failed as [2]. Please make sure it works
as expected with those kernel patches still reviewing, I can't be sure I have the
testing environment to guarantee that. Or I'd like to push this case after I see
its target kernel patchset be merged by xfs-linux at first.

Thanks,
Zorro

[1]
[PATCH v29 00/15] xfs: Log Attribute Replay
[PATCH 00/10 v2] xfs: LARP - clean up xfs_attr_set_iter state machine

Quoted 11 lines

[2] out.bad output:
*** 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
xfs_logprint: unknown log operation type (1246)
Bad data in log
mount: /mnt/scratch: mount(2) system call failed: Structure needs cleaning.

I think that happens when you dont have the corresponding xfsprogs updates. The userspace log print does not recognize the new log item.

Assuming you are running with an unpatched xfsprogs, I would have thought the lack of error injects might have stopped the test from running though?

Allison

Quoted 415 lines
Quoted 415 lines

Catherine

Quoted 414 lines
Quoted 414 lines

<slightly ot rant>

These sysfs knobs are a pain because they all reset to defaults if
xfs.ko gets cycled. I know, I know, at least Dave and Ted don't do
modular kernels and so never see this happen, but I do. I bet Dave also
hasn't ever run xfs/434 or xfs/436, which might be why I'm the only one
seeing dquot leaks with 5.19-next.

(I might be able to lift the xfs-as-module requirement if "echo 1 >
/sys/kernel/slab/*/validate" does what I think it might, since all we
want to do is look for slab leaks, and those tests rmmod/modprobe as a
brute force way of making the slab debug code check for leaks.)

In case anyone's wondering, a solution to the knobs getting unset after
an rmmod/modprobe cycle is to add a file /etc/udev/rules.d/99-fstester.rules containing:

ACTION=="add|change", SUBSYSTEM=="module", DEVPATH=="/module/${module}", RUN+="/bin/sh -c \"echo ${value}

Quoted 1 line

${knob}\""

which should be enough to keep LARP turned on.

<end rant>

Anyway, since this is a proposed test, I say that with this applied and
the debug knob bits fixed, the whole thing is

--D

Quoted 374 lines

}

tests/xfs/600 +0 -1
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 |

_filter_scratch

tests/xfs/600 +3 -0
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
	echo ""
}
tests/xfs/600 +0 -0
@@ -157,19 +159,19 @@ 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"

tests/xfs/600 +1 -1
-# replace shortform
+# replace shortform with different value

create_test_file sf_file 2 $attr64

tests/xfs/600 +5 -5
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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
tests/xfs/600 +1 -1
-test_attr_replay node_file "attr_name2" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"

echo "*** done"
status=0

tests/xfs/600.out +0 -0
index 96b1d7d9..fe25ea3e 100644
@@ -4,146 +4,185 @@ QA output created by 600

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 -21d850f99c43cc13abbe34838a8a3c8a -
+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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name" for

SCRATCH_MNT/testdir/empty_file1

tests/xfs/600.out +2 -0
+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 -2ff89c2935debc431745ec791be5421a -
+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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name" for

SCRATCH_MNT/testdir/empty_file2

tests/xfs/600.out +2 -0
+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 -5d24b314242c52176c98ac4bd685da8b -
+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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name" for

SCRATCH_MNT/testdir/empty_file3

tests/xfs/600.out +2 -0
+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 -5a7b559a70d8e92b4f3c6f7158eead08 - +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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name2" for

SCRATCH_MNT/testdir/inline_file1
+Attribute "attr_name1" has a 16 byte value for
SCRATCH_MNT/testdir/inline_file1

tests/xfs/600.out +2 -0
+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 -5717d5e66c70be6bdb00ecbaca0b7749 - +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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name2" for

SCRATCH_MNT/testdir/inline_file2
+Attribute "attr_name1" has a 16 byte value for
SCRATCH_MNT/testdir/inline_file2

tests/xfs/600.out +2 -0
+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 -5c929964efd1b243aa8cceb6524f4810 - +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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name2" for

SCRATCH_MNT/testdir/inline_file3
+Attribute "attr_name1" has a 16 byte value for
SCRATCH_MNT/testdir/inline_file3

tests/xfs/600.out +2 -0
+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 -51ccb5cdfc9082060f0f94a8a108fea0 - +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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name2" for

SCRATCH_MNT/testdir/extent_file1
+Attribute "attr_name1" has a 1024 byte value for
SCRATCH_MNT/testdir/extent_file1

tests/xfs/600.out +2 -0
+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 -8d530bbe852d8bca83b131d5b3e497f5 - +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 -5d77c4d3831a35bcbbd6e7677119ce9a - +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 -6707ec2431e4dbea20e17da0816520bb - +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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name2" for

SCRATCH_MNT/testdir/extent_file4
+Attribute "attr_name1" has a 1024 byte value for
SCRATCH_MNT/testdir/extent_file4

tests/xfs/600.out +2 -0
+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 -767ebca3e4a6d24170857364f2bf2a3c - +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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name2" for

SCRATCH_MNT/testdir/remote_file1 +Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +1 -1
-fd84ddec89237e6d34a1703639efaebf  -
+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

tests/xfs/600.out +0 -2
-attr_get: No data available
-Could not get "attr_name2" for

SCRATCH_MNT/testdir/remote_file2 +Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2

tests/xfs/600.out +2 -0
+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 -34aaa49662bafb46c76e377454685071 -
+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 -664e95ec28830ffb367c0950026e0d21 -
+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

tests/xfs/600.out +1 -1
-bb37a78ce26472eeb711e3559933db42  -
+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

Signature · 2 lines
Dave Chinner
[email protected]
#12 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

In reply to Darrick J. Wong
Quoted 7 lines · Darrick J. Wong
Quoted 6 lines · Dave Chinner

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Quoted 3 lines
Quoted 3 lines

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Quoted 30 lines
Quoted 20 lines

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Cheers,

Dave.
---

 tests/xfs/600     |  20 +++++-----
 tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +0 -0
index 252cdf27..84704646 100755

tests/xfs/600 _begin_fstest auto quick attr · line 21

Quoted 7 lines
tests/xfs/600 +1 -1
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp

Blergh, this ^^^^^^^^^ is going to need fixing too.

Quoted 1 line

Please save the old value, then write it back in the _cleanup function.

Yes, I know about this. I haven't done anything about it yet because I haven't decided yet whether it should stay or be removed. Getting the test and the code it tests working has been my focus so far.

I have a wrapper script that sets the knob for the entire of the fstests run (i.e. so all attr and recovery tests exercise the LARP functionality) and so I'm not sure that this test should twiddle the knob at all. i.e. right now it would be more useful to me for the test to check if the knob is not set to just _not_run the test, rather than turn it on and off and all that...

Indeed, we probably shouldn't be forcing everyone to test a brand new experimental feature that might be unstable and cause the test run to halt prematurely (e.g. because it crashes).

Quoted 5 lines

<slightly ot rant>

These sysfs knobs are a pain because they all reset to defaults if xfs.ko gets cycled. I know, I know, at least Dave and Ted don't do modular kernels and so never see this happen, but I do.

sysfs knobs get reset by reboots to load a new kernel, so the impact is identical - I have to reset the knob every time I load a new test kernel, just like you have to reset it every time you load a new module.

Quoted 3 lines

I bet Dave also
hasn't ever run xfs/434 or xfs/436, which might be why I'm the only one seeing dquot leaks with 5.19-next.

Yup, there are a bunch of tests that I never run because:

- scsi_debug requires modular kernel
- I always build with fatal XFS ASSERTs, so the tests that want non-fatal asserts don't run
- xfs/43[4-6] require a modular kernel
- xfs/490 requires CONFIG_XFS_DEBUG be turned off (I *never* do that)
- I generally don't have source code on my test machines, so api-violations.sh won't run (xfs/437)

And there's probably a few more in that list as well.

IMO, any test that depends on a specific debug config or test environment setup that aren't (or can't be) consistently used by the entire developer base should be discouraged precisely because it means different developers end up with different code coverage and might miss problems they really should know about.

Quoted 4 lines

(I might be able to lift the xfs-as-module requirement if "echo 1 > /sys/kernel/slab/*/validate" does what I think it might, since all we want to do is look for slab leaks, and those tests rmmod/modprobe as a brute force way of making the slab debug code check for leaks.)

Doesn't running fstests with KASAN enabled find those slab leaks?

Quoted 7 lines

In case anyone's wondering, a solution to the knobs getting unset after an rmmod/modprobe cycle is to add a file /etc/udev/rules.d/99-fstester.rules containing:

ACTION=="add|change", SUBSYSTEM=="module", DEVPATH=="/module/${module}", RUN+="/bin/sh -c \"echo ${value} > ${knob}\""

which should be enough to keep LARP turned on.

I don't want it turned on unconditionally - I have to test both the existing code path and the new LARP code path, so I'm constantly toggling the value between test runs.

Quoted 3 lines

Anyway, since this is a proposed test, I say that with this applied and the debug knob bits fixed, the whole thing is

Thanks!

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#13 lore raw

Re: [PATCH] xfs/larp: Make test failures debuggable

In reply to Dave Chinner
Quoted 49 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Quoted 5 lines

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Sure, due to LSF meeting, we have few of reviewed patches this week. I'll merge Catherine's "[PATCH v7 1/1] xfstests: Add Log Attribute Replay test"(with your RVB) into fstests for-next branch at first, then this patch ensued. I'll push it this weekend, after my basic testing pass. If you'd like to combine this patch with Catherine's patch into one patch, or you have more review points, feel free to tell me.

Thanks,
Zorro

Quoted 290 lines

Cheers,

Dave.
---

 tests/xfs/600     |  20 +++++-----
 tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +11 -9
index 252cdf27..84704646 100755
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp
 }
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
 
 	echo ""
 }
@@ -157,19 +159,19 @@ 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
+# replace shortform with different value
 create_test_file sf_file 2 $attr64
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"
 
 echo "*** done"
 status=0
tests/xfs/600.out +74 -35
index 96b1d7d9..fe25ea3e 100644
@@ -4,146 +4,185 @@ QA output created by 600
 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
-21d850f99c43cc13abbe34838a8a3c8a  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file1
+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
-2ff89c2935debc431745ec791be5421a  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file2
+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
-5d24b314242c52176c98ac4bd685da8b  -
+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_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file3
+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
-5a7b559a70d8e92b4f3c6f7158eead08  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file1
+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
-5717d5e66c70be6bdb00ecbaca0b7749  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file2
+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
-5c929964efd1b243aa8cceb6524f4810  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file3
+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
-51ccb5cdfc9082060f0f94a8a108fea0  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file1
+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
-8d530bbe852d8bca83b131d5b3e497f5  -
+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
-5d77c4d3831a35bcbbd6e7677119ce9a  -
+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
-6707ec2431e4dbea20e17da0816520bb  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file4
+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
-767ebca3e4a6d24170857364f2bf2a3c  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file1
+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
-fd84ddec89237e6d34a1703639efaebf  -
+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
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file2
+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
-34aaa49662bafb46c76e377454685071  -
+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
-664e95ec28830ffb367c0950026e0d21  -
+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
-bb37a78ce26472eeb711e3559933db42  -
+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
Signature · 2 lines
Dave Chinner
[email protected]
#14 lore raw

PATCH 1/1 xfs/larp: Make test failures debuggable

In reply to Dave Chinner
Quoted 57 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Md5sum output for attributes created combined program output and attribute values. This adds variable path names to the md5sum, so there's no way to tell if the md5sum is actually correct for the given attribute value that is returned as it's not constant from test to test. Hence we can't actually say that the output is correct because we can't reproduce exactly what we are hashing easily.

Indeed, the last attr test in series (node w/ replace) had an invalid md5sum. The attr value being produced after recovery was correct, but the md5sum output match was failing. Golden output appears to be wrong.

Fix this issue by seperately dumping all the attributes on the inode via a list operation to indicate their size, then dump the value of the test attribute directly to md5sum. This means the md5sum for the attributes using the same fixed values are all identical, so it's easy to tell if the md5sum for a given test is correct. We also check that all attributes that should be present after recovery are still there (e.g. checks recovery didn't trash innocent bystanders).

Further, the attribute replace tests replace an attribute with an identical value, hence there is no way to tell if recovery has resulted in the original being left behind or the new attribute being fully recovered because both have the same name and value. When replacing the attribute value, use a different sized value so it is trivial to determine that we've recovered the new attribute value correctly.

Also, the test runs on the scratch device - there is no need to remove the testdir in _cleanup. Doing so prevents post-mortem failure analysis because it burns the dead, broken corpse to ash and leaves no way of to determine cause of death.

---

Hi Catherine,

These are all the mods I needed to make to be able to understand the test failures I was getting as I debugged the new LARP recovery algorithm I've written. You'll need to massage the test number in this patch to apply it on top of your patch.

I haven't added any new test cases yet, nor have I done anything to manage the larp sysfs knob, but we'll need to do those in the near future.

Zorro, can you consider merging this test in the near future? We're right at the point of merging the upstream kernel code and so really need to start growing the test coverage of this feature, and this test should simply not-run on kernels that don't have the feature enabled....

Quoted 3 lines

Cheers,

Dave.

Looks good, thanks for the fixes

Quoted 285 lines

---

tests/xfs/600 | 20 +++++-----
tests/xfs/600.out | 109 ++++++++++++++++++++++++++++++++++++------------------

2 files changed, 85 insertions(+), 44 deletions(-)
tests/xfs/600 +4 -2
index 252cdf27..84704646 100755
@@ -16,7 +16,7 @@ _begin_fstest auto quick attr
 
 _cleanup()
 {
-	rm -rf $tmp.* $testdir
+	rm -rf $tmp.*
 	test -w /sys/fs/xfs/debug/larp && \
 		echo 0 > /sys/fs/xfs/debug/larp
 }
@@ -46,7 +46,9 @@ test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	{ $ATTR_PROG -g $attr_name $testfile | md5sum; } 2>&1 | _filter_scratch
+	$ATTR_PROG -l $testfile | _filter_scratch
+	echo -n "$attr_name: "
+	$ATTR_PROG -q -g $attr_name $testfile | md5sum;
 
 	echo ""
 }
@@ -157,19 +159,19 @@ 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"

tests/xfs/600 +1 -1
-# replace shortform
+# replace shortform with different value

create_test_file sf_file 2 $attr64

tests/xfs/600 +5 -5
-test_attr_replay sf_file "attr_name2" $attr64 "s" "larp"
+test_attr_replay sf_file "attr_name2" $attr16 "s" "larp"
 
-# replace leaf
-create_test_file leaf_file 2 $attr1k
-test_attr_replay leaf_file "attr_name2" $attr1k "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
+# 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
tests/xfs/600 +1 -1
-test_attr_replay node_file "attr_name2" $attr1k "s" "larp"
+test_attr_replay node_file "attr_name2" $attr256 "s" "larp"

echo "*** done"
status=0

tests/xfs/600.out +0 -0
index 96b1d7d9..fe25ea3e 100644
@@ -4,146 +4,185 @@ QA output created by 600

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 -21d850f99c43cc13abbe34838a8a3c8a -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file1
+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 -2ff89c2935debc431745ec791be5421a -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file2
+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 -5d24b314242c52176c98ac4bd685da8b -

tests/xfs/600.out +2 -0
+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

tests/xfs/600.out +2 -2
-attr_get: No data available
-Could not get "attr_name" for SCRATCH_MNT/testdir/empty_file3
+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 -5a7b559a70d8e92b4f3c6f7158eead08 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file1
+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 -5717d5e66c70be6bdb00ecbaca0b7749 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file2
+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 -5c929964efd1b243aa8cceb6524f4810 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/inline_file3
+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 -51ccb5cdfc9082060f0f94a8a108fea0 -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file1
+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 -8d530bbe852d8bca83b131d5b3e497f5 -

tests/xfs/600.out +5 -0
+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 -5d77c4d3831a35bcbbd6e7677119ce9a -

tests/xfs/600.out +5 -0
+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 -6707ec2431e4dbea20e17da0816520bb -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/extent_file4
+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 -767ebca3e4a6d24170857364f2bf2a3c -

tests/xfs/600.out +3 -0
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file1
+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

tests/xfs/600.out +3 -1
-fd84ddec89237e6d34a1703639efaebf  -
+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

tests/xfs/600.out +3 -2
-attr_get: No data available
-Could not get "attr_name2" for SCRATCH_MNT/testdir/remote_file2
+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 -34aaa49662bafb46c76e377454685071 -

tests/xfs/600.out +3 -0
+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 -664e95ec28830ffb367c0950026e0d21 -

tests/xfs/600.out +4 -0
+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

tests/xfs/600.out +3 -1
-bb37a78ce26472eeb711e3559933db42  -
+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

Signature · 2 lines
Dave Chinner
[email protected]