Skip to contentSkip to conversation

Log Attribute Replay Test

PATCH In review Catherine Hoang 3 participants 6 messages Aug 25, 2021 – Aug 26, 2021

lore
Share & tools
lore
#0 lore raw

v4 cover Log Attribute Replay Test

Hi all,

I am currently working with Allison on logged attributes.

This patch adds a test to exercise the log attribute error inject and log replay. Attributes are added in increasing sizes up to 64k, and the error inject is used to replay them from the log.

Questions and feedback are appreciated!

Catherine

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

 tests/xfs/540     |  96 ++++++++++++++++++++++++++++++++++
 tests/xfs/540.out | 130 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+)
 create mode 100755 tests/xfs/540
 create mode 100644 tests/xfs/540.out
Signature · 1 line
2.25.1
#1 lore raw

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

From: Allison Henderson <[email protected]>

This patch adds a test to exercise the log attribute error inject and log replay. Attributes are added in increaseing sizes up to 64k, and the error inject is used to replay them from the log

---
 tests/xfs/540     |  96 ++++++++++++++++++++++++++++++++++
 tests/xfs/540.out | 130 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+)
 create mode 100755 tests/xfs/540
 create mode 100644 tests/xfs/540.out
tests/xfs/540 new file +96 -0
new file mode 100755
index 00000000..3b05b38b
@@ -0,0 +1,96 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 540
+#
+# Log attribute replay test
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+# get standard environment, filters and checks
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+	echo "*** unmount"
+	_scratch_unmount 2>/dev/null
+	rm -f $tmp.*
+	echo 0 > /sys/fs/xfs/debug/larp
+}
+
+_test_attr_replay()
+{
+	attr_name=$1
+	attr_value=$2
+	touch $testfile.1
+
+	echo "Inject error"
+	_scratch_inject_error "larp"
+
+	echo "Set attribute"
+	echo "$attr_value" | ${ATTR_PROG} -s "$attr_name" $testfile.1 | \
+			    _filter_scratch
+
+	echo "FS should be shut down, touch will fail"
+	touch $testfile.1
+
+	echo "Remount to replay log"
+	_scratch_inject_logprint >> $seqres.full
+
+	echo "FS should be online, touch should succeed"
+	touch $testfile.1
+
+	echo "Verify attr recovery"
+	_getfattr --absolute-names $testfile.1 | _filter_scratch
+}
+
+
+# real QA test starts here
+_supported_fs xfs
+
+_require_scratch
+_require_attrs
+_require_xfs_io_error_injection "larp"
+_require_xfs_sysfs debug/larp
+
+# turn on log attributes
+echo 1 > /sys/fs/xfs/debug/larp
+
+rm -f $seqres.full
+_scratch_unmount >/dev/null 2>&1
+
+#attributes of increaseing sizes
+attr16="0123456789ABCDEFG"
+attr64="$attr16$attr16$attr16$attr16"
+attr256="$attr64$attr64$attr64$attr64"
+attr1k="$attr256$attr256$attr256$attr256"
+attr4k="$attr1k$attr1k$attr1k$attr1k"
+attr8k="$attr4k$attr4k$attr4k$attr4k"
+attr32k="$attr8k$attr8k$attr8k$attr8k"
+attr64k="$attr32k$attr32k"
+
+echo "*** mkfs"
+_scratch_mkfs_xfs >/dev/null
+
+echo "*** mount FS"
+_scratch_mount
+
+testfile=$SCRATCH_MNT/testfile
+echo "*** make test file 1"
+
+_test_attr_replay "attr_name1" $attr16
+_test_attr_replay "attr_name2" $attr64
+_test_attr_replay "attr_name3" $attr256
+_test_attr_replay "attr_name4" $attr1k
+_test_attr_replay "attr_name5" $attr4k
+_test_attr_replay "attr_name6" $attr8k
+_test_attr_replay "attr_name7" $attr32k
+_test_attr_replay "attr_name8" $attr64k
+
+echo "*** done"
+status=0
+exit
tests/xfs/540.out new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

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

Quoted 9 lines · Catherine Hoang

From: Allison Henderson <[email protected]>

This patch adds a test to exercise the log attribute error inject and log replay. Attributes are added in increaseing sizes up to 64k, and the error inject is used to replay them from the log

Yay, [your] first post! :D

Quoted 51 lines
---
 tests/xfs/540     |  96 ++++++++++++++++++++++++++++++++++
 tests/xfs/540.out | 130 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+)
 create mode 100755 tests/xfs/540
 create mode 100644 tests/xfs/540.out
tests/xfs/540 new file +38 -0
new file mode 100755
index 00000000..3b05b38b
@@ -0,0 +1,96 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 540
+#
+# Log attribute replay test
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+# get standard environment, filters and checks
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+	echo "*** unmount"
+	_scratch_unmount 2>/dev/null
+	rm -f $tmp.*
+	echo 0 > /sys/fs/xfs/debug/larp
+}
+
+_test_attr_replay()
+{
+	attr_name=$1
+	attr_value=$2
+	touch $testfile.1
+
+	echo "Inject error"
+	_scratch_inject_error "larp"
+
+	echo "Set attribute"
+	echo "$attr_value" | ${ATTR_PROG} -s "$attr_name" $testfile.1 | \
+			    _filter_scratch
+
+	echo "FS should be shut down, touch will fail"

tests/xfs/540 line 48

Quoted 10 lines
tests/xfs/540 new file +10 -0
+	touch $testfile.1
+
+	echo "Remount to replay log"
+	_scratch_inject_logprint >> $seqres.full
+
+	echo "FS should be online, touch should succeed"
+	touch $testfile.1
+
+	echo "Verify attr recovery"
+	_getfattr --absolute-names $testfile.1 | _filter_scratch

Shouldn't we check the value of the extended attrs too?

Quoted 5 lines
tests/xfs/540 new file +5 -0
+}
+
+
+# real QA test starts here
+_supported_fs xfs

tests/xfs/540 line 63

Quoted 10 lines
tests/xfs/540 new file +10 -0
+
+_require_scratch
+_require_attrs
+_require_xfs_io_error_injection "larp"
+_require_xfs_sysfs debug/larp
+
+# turn on log attributes
+echo 1 > /sys/fs/xfs/debug/larp
+
+rm -f $seqres.full

No need to do this anymore; _begin_fstest takes care of this now.

tests/xfs/540 line 67

Quoted 4 lines
tests/xfs/540 new file +4 -0
+_scratch_unmount >/dev/null 2>&1
+
+#attributes of increaseing sizes
+attr16="0123456789ABCDEFG"

"attr16" is seventeen bytes long.

tests/xfs/540 line 72

Quoted 5 lines
tests/xfs/540 new file +5 -0
+attr64="$attr16$attr16$attr16$attr16"
+attr256="$attr64$attr64$attr64$attr64"
+attr1k="$attr256$attr256$attr256$attr256"
+attr4k="$attr1k$attr1k$attr1k$attr1k"
+attr8k="$attr4k$attr4k$attr4k$attr4k"

This is 17k long...

tests/xfs/540 line 73

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr32k="$attr8k$attr8k$attr8k$attr8k"

...which makes this 68k long...

tests/xfs/540 line 74

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr64k="$attr32k$attr32k"

...and this 136K long?

I'm curious, what are the contents of user.attr_name8?

OH, I see, attr clamps the value length to 64k, so I guess the oversize buffers don't matter.

--D

Quoted 28 lines
tests/xfs/540 new file +22 -0
+
+echo "*** mkfs"
+_scratch_mkfs_xfs >/dev/null
+
+echo "*** mount FS"
+_scratch_mount
+
+testfile=$SCRATCH_MNT/testfile
+echo "*** make test file 1"
+
+_test_attr_replay "attr_name1" $attr16
+_test_attr_replay "attr_name2" $attr64
+_test_attr_replay "attr_name3" $attr256
+_test_attr_replay "attr_name4" $attr1k
+_test_attr_replay "attr_name5" $attr4k
+_test_attr_replay "attr_name6" $attr8k
+_test_attr_replay "attr_name7" $attr32k
+_test_attr_replay "attr_name8" $attr64k
+
+echo "*** done"
+status=0
+exit
tests/xfs/540.out new file +0 -0
new file mode 100644
index 00000000..c1b178a0

tests/xfs/540.out line 10

Quoted 10 lines
tests/xfs/540.out new file +10 -0
@@ -0,0 +1,130 @@
+QA output created by 540
+*** mkfs
+*** mount FS
+*** make test file 1
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name1" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error

The error messages need to be filtered too, because SCRATCH_MNT is definitely not /mnt/scratch here. ;)

--D

Quoted 123 lines
tests/xfs/540.out new file +120 -0
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name2" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name3" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name4" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name5" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name6" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name7" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name8" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+user.attr_name8
+
+*** done
+*** unmount
Signature · 1 line
2.25.1
#3 lore raw

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

Quoted 68 lines · Darrick J. Wong
Quoted 9 lines · Catherine Hoang

From: Allison Henderson <[email protected]>

This patch adds a test to exercise the log attribute error inject and log replay. Attributes are added in increaseing sizes up to 64k, and the error inject is used to replay them from the log

Yay, [your] first post! :D

Quoted 55 lines
---
  tests/xfs/540     |  96 ++++++++++++++++++++++++++++++++++
  tests/xfs/540.out | 130 ++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 226 insertions(+)

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

tests/xfs/540 new file +42 -0
new file mode 100755
index 00000000..3b05b38b
@@ -0,0 +1,96 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 540
+#
+# Log attribute replay test
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+# get standard environment, filters and checks
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+	echo "*** unmount"
+	_scratch_unmount 2>/dev/null
+	rm -f $tmp.*
+	echo 0 > /sys/fs/xfs/debug/larp
+}
+
+_test_attr_replay()
+{
+	attr_name=$1
+	attr_value=$2
+	touch $testfile.1
+
+	echo "Inject error"
+	_scratch_inject_error "larp"
+
+	echo "Set attribute"
+	echo "$attr_value" | ${ATTR_PROG} -s "$attr_name" $testfile.1 | \
+			    _filter_scratch
+
+	echo "FS should be shut down, touch will fail"
+	touch $testfile.1
+
+	echo "Remount to replay log"
+	_scratch_inject_logprint >> $seqres.full
Quoted 8 lines

tests/xfs/540 line 48

Quoted 6 lines
tests/xfs/540 new file +6 -0
+
+	echo "FS should be online, touch should succeed"
+	touch $testfile.1
+
+	echo "Verify attr recovery"
+	_getfattr --absolute-names $testfile.1 | _filter_scratch

Shouldn't we check the value of the extended attrs too?

I think the first time I did this years ago, I questioned if people would really want to see a 110k .out file, and stopped with just the names.

Looking back at it now, maybe we could drop the value and the expected value in separate files, and diff the files, and then the test case could just check to make sure the diff output comes back clean?

Quoted 19 lines
Quoted 6 lines
tests/xfs/540 new file +5 -0
+}
+
+
+# real QA test starts here
+_supported_fs xfs

tests/xfs/540 line 63

Quoted 10 lines
tests/xfs/540 new file +10 -0
+
+_require_scratch
+_require_attrs
+_require_xfs_io_error_injection "larp"
+_require_xfs_sysfs debug/larp
+
+# turn on log attributes
+echo 1 > /sys/fs/xfs/debug/larp
+
+rm -f $seqres.full

No need to do this anymore; _begin_fstest takes care of this now.

Quoted 4 lines

tests/xfs/540 line 67

Quoted 4 lines
tests/xfs/540 new file +4 -0
+_scratch_unmount >/dev/null 2>&1
+
+#attributes of increaseing sizes
+attr16="0123456789ABCDEFG"

Yes, we need to drop the G off this line :-)

Quoted 8 lines

"attr16" is seventeen bytes long.

tests/xfs/540 line 72

Quoted 5 lines
tests/xfs/540 new file +5 -0
+attr64="$attr16$attr16$attr16$attr16"
+attr256="$attr64$attr64$attr64$attr64"
+attr1k="$attr256$attr256$attr256$attr256"
+attr4k="$attr1k$attr1k$attr1k$attr1k"
+attr8k="$attr4k$attr4k$attr4k$attr4k"

I think I must have meant to do a 16k in here. Lets replace attr8k and attr32k with:

attr8k="$attr4k$attr4k"
attr16k="$attr8k$attr8k"
attr32k="$attr16k$attr16k"

I think that's easier to look at too. Then we can add another replay test for the attr16k as well.

Quoted 51 lines

This is 17k long...

tests/xfs/540 line 73

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr32k="$attr8k$attr8k$attr8k$attr8k"

...which makes this 68k long...

tests/xfs/540 line 74

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr64k="$attr32k$attr32k"

...and this 136K long?

I'm curious, what are the contents of user.attr_name8?

OH, I see, attr clamps the value length to 64k, so I guess the oversize buffers don't matter.

--D

Quoted 33 lines
tests/xfs/540 new file +22 -0
+
+echo "*** mkfs"
+_scratch_mkfs_xfs >/dev/null
+
+echo "*** mount FS"
+_scratch_mount
+
+testfile=$SCRATCH_MNT/testfile
+echo "*** make test file 1"
+
+_test_attr_replay "attr_name1" $attr16
+_test_attr_replay "attr_name2" $attr64
+_test_attr_replay "attr_name3" $attr256
+_test_attr_replay "attr_name4" $attr1k
+_test_attr_replay "attr_name5" $attr4k
+_test_attr_replay "attr_name6" $attr8k
+_test_attr_replay "attr_name7" $attr32k
+_test_attr_replay "attr_name8" $attr64k
+
+echo "*** done"
+status=0
+exit
tests/xfs/540.out new file +5 -0
new file mode 100644
index 00000000..c1b178a0
@@ -0,0 +1,130 @@
+QA output created by 540
+*** mkfs
+*** mount FS
+*** make test file 1
+Inject error
Quoted 8 lines

tests/xfs/540.out line 10

Quoted 5 lines
tests/xfs/540.out new file +5 -0
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name1" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error

The error messages need to be filtered too, because SCRATCH_MNT is definitely not /mnt/scratch here. ;)

Ok, so we need to add "| _filter_scratch" to all the touch commands in _test_attr_replay

Thanks for the reviews!
Allison

Quoted 126 lines

--D

Quoted 123 lines
tests/xfs/540.out new file +120 -0
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name2" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name3" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name4" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name5" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name6" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name7" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name8" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+user.attr_name8
+
+*** done
+*** unmount
Signature · 1 line
2.25.1
#4 lore raw

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

Quoted 79 lines · Allison Henderson
Quoted 68 lines · Darrick J. Wong
Quoted 9 lines · Catherine Hoang

From: Allison Henderson <[email protected]>

This patch adds a test to exercise the log attribute error inject and log replay. Attributes are added in increaseing sizes up to 64k, and the error inject is used to replay them from the log

Yay, [your] first post! :D

Quoted 55 lines
---
  tests/xfs/540     |  96 ++++++++++++++++++++++++++++++++++
  tests/xfs/540.out | 130 ++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 226 insertions(+)

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

tests/xfs/540 new file +42 -0
new file mode 100755
index 00000000..3b05b38b
@@ -0,0 +1,96 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 540
+#
+# Log attribute replay test
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+# get standard environment, filters and checks
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+	echo "*** unmount"
+	_scratch_unmount 2>/dev/null
+	rm -f $tmp.*
+	echo 0 > /sys/fs/xfs/debug/larp
+}
+
+_test_attr_replay()
+{
+	attr_name=$1
+	attr_value=$2
+	touch $testfile.1
+
+	echo "Inject error"
+	_scratch_inject_error "larp"
+
+	echo "Set attribute"
+	echo "$attr_value" | ${ATTR_PROG} -s "$attr_name" $testfile.1 | \
+			    _filter_scratch
+
+	echo "FS should be shut down, touch will fail"
+	touch $testfile.1
+
+	echo "Remount to replay log"
+	_scratch_inject_logprint >> $seqres.full
Quoted 8 lines

tests/xfs/540 line 48

Quoted 6 lines
tests/xfs/540 new file +6 -0
+
+	echo "FS should be online, touch should succeed"
+	touch $testfile.1
+
+	echo "Verify attr recovery"
+	_getfattr --absolute-names $testfile.1 | _filter_scratch

Shouldn't we check the value of the extended attrs too?

Quoted 6 lines

I think the first time I did this years ago, I questioned if people would really want to see a 110k .out file, and stopped with just the names.

Looking back at it now, maybe we could drop the value and the expected value in separate files, and diff the files, and then the test case could just check to make sure the diff output comes back clean?

$ATTR_PROG -g attr_nameX fubar.1 | md5sum

would be a more compact way of encoding exact byte sequence output in the .out file.

--D

Quoted 234 lines
Quoted 19 lines
Quoted 6 lines
tests/xfs/540 new file +5 -0
+}
+
+
+# real QA test starts here
+_supported_fs xfs

tests/xfs/540 line 63

Quoted 10 lines
tests/xfs/540 new file +10 -0
+
+_require_scratch
+_require_attrs
+_require_xfs_io_error_injection "larp"
+_require_xfs_sysfs debug/larp
+
+# turn on log attributes
+echo 1 > /sys/fs/xfs/debug/larp
+
+rm -f $seqres.full

No need to do this anymore; _begin_fstest takes care of this now.

Quoted 4 lines

tests/xfs/540 line 67

Quoted 4 lines
tests/xfs/540 new file +4 -0
+_scratch_unmount >/dev/null 2>&1
+
+#attributes of increaseing sizes
+attr16="0123456789ABCDEFG"

Yes, we need to drop the G off this line :-)

Quoted 8 lines

"attr16" is seventeen bytes long.

tests/xfs/540 line 72

Quoted 5 lines
tests/xfs/540 new file +5 -0
+attr64="$attr16$attr16$attr16$attr16"
+attr256="$attr64$attr64$attr64$attr64"
+attr1k="$attr256$attr256$attr256$attr256"
+attr4k="$attr1k$attr1k$attr1k$attr1k"
+attr8k="$attr4k$attr4k$attr4k$attr4k"

I think I must have meant to do a 16k in here. Lets replace attr8k and attr32k with:

attr8k="$attr4k$attr4k"
attr16k="$attr8k$attr8k"
attr32k="$attr16k$attr16k"

I think that's easier to look at too. Then we can add another replay test for the attr16k as well.

Quoted 51 lines

This is 17k long...

tests/xfs/540 line 73

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr32k="$attr8k$attr8k$attr8k$attr8k"

...which makes this 68k long...

tests/xfs/540 line 74

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr64k="$attr32k$attr32k"

...and this 136K long?

I'm curious, what are the contents of user.attr_name8?

OH, I see, attr clamps the value length to 64k, so I guess the oversize buffers don't matter.

--D

Quoted 33 lines
tests/xfs/540 new file +22 -0
+
+echo "*** mkfs"
+_scratch_mkfs_xfs >/dev/null
+
+echo "*** mount FS"
+_scratch_mount
+
+testfile=$SCRATCH_MNT/testfile
+echo "*** make test file 1"
+
+_test_attr_replay "attr_name1" $attr16
+_test_attr_replay "attr_name2" $attr64
+_test_attr_replay "attr_name3" $attr256
+_test_attr_replay "attr_name4" $attr1k
+_test_attr_replay "attr_name5" $attr4k
+_test_attr_replay "attr_name6" $attr8k
+_test_attr_replay "attr_name7" $attr32k
+_test_attr_replay "attr_name8" $attr64k
+
+echo "*** done"
+status=0
+exit
tests/xfs/540.out new file +5 -0
new file mode 100644
index 00000000..c1b178a0
@@ -0,0 +1,130 @@
+QA output created by 540
+*** mkfs
+*** mount FS
+*** make test file 1
+Inject error
Quoted 8 lines

tests/xfs/540.out line 10

Quoted 5 lines
tests/xfs/540.out new file +5 -0
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name1" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error

The error messages need to be filtered too, because SCRATCH_MNT is definitely not /mnt/scratch here. ;)

Ok, so we need to add "| _filter_scratch" to all the touch commands in _test_attr_replay

Thanks for the reviews!
Allison

Quoted 126 lines

--D

Quoted 123 lines
tests/xfs/540.out new file +120 -0
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name2" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name3" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name4" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name5" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name6" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name7" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name8" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+user.attr_name8
+
+*** done
+*** unmount
Signature · 1 line
2.25.1
#5 lore raw

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

Quoted 87 lines · Darrick J. Wong
Quoted 79 lines · Allison Henderson
Quoted 68 lines · Darrick J. Wong
Quoted 9 lines · Catherine Hoang

From: Allison Henderson <[email protected]>

This patch adds a test to exercise the log attribute error inject and log replay. Attributes are added in increaseing sizes up to 64k, and the error inject is used to replay them from the log

Yay, [your] first post! :D

Quoted 55 lines
---
   tests/xfs/540     |  96 ++++++++++++++++++++++++++++++++++
   tests/xfs/540.out | 130 ++++++++++++++++++++++++++++++++++++++++++++++
   2 files changed, 226 insertions(+)

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

tests/xfs/540 new file +42 -0
new file mode 100755
index 00000000..3b05b38b
@@ -0,0 +1,96 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test 540
+#
+# Log attribute replay test
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+# get standard environment, filters and checks
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+	echo "*** unmount"
+	_scratch_unmount 2>/dev/null
+	rm -f $tmp.*
+	echo 0 > /sys/fs/xfs/debug/larp
+}
+
+_test_attr_replay()
+{
+	attr_name=$1
+	attr_value=$2
+	touch $testfile.1
+
+	echo "Inject error"
+	_scratch_inject_error "larp"
+
+	echo "Set attribute"
+	echo "$attr_value" | ${ATTR_PROG} -s "$attr_name" $testfile.1 | \
+			    _filter_scratch
+
+	echo "FS should be shut down, touch will fail"
+	touch $testfile.1
+
+	echo "Remount to replay log"
+	_scratch_inject_logprint >> $seqres.full
Quoted 8 lines

tests/xfs/540 line 48

Quoted 6 lines
tests/xfs/540 new file +6 -0
+
+	echo "FS should be online, touch should succeed"
+	touch $testfile.1
+
+	echo "Verify attr recovery"
+	_getfattr --absolute-names $testfile.1 | _filter_scratch

Shouldn't we check the value of the extended attrs too?

Quoted 6 lines

I think the first time I did this years ago, I questioned if people would really want to see a 110k .out file, and stopped with just the names.

Looking back at it now, maybe we could drop the value and the expected value in separate files, and diff the files, and then the test case could just check to make sure the diff output comes back clean?

Quoted 6 lines

$ATTR_PROG -g attr_nameX fubar.1 | md5sum

would be a more compact way of encoding exact byte sequence output in the .out file.

--D

Ok, that sounds good then

Allison

Quoted 235 lines
Quoted 235 lines
Quoted 20 lines
Quoted 7 lines
tests/xfs/540 new file +5 -0
+}
+
+
+# real QA test starts here
+_supported_fs xfs

tests/xfs/540 line 63

Quoted 10 lines
tests/xfs/540 new file +10 -0
+
+_require_scratch
+_require_attrs
+_require_xfs_io_error_injection "larp"
+_require_xfs_sysfs debug/larp
+
+# turn on log attributes
+echo 1 > /sys/fs/xfs/debug/larp
+
+rm -f $seqres.full

No need to do this anymore; _begin_fstest takes care of this now.

Quoted 4 lines

tests/xfs/540 line 67

Quoted 4 lines
tests/xfs/540 new file +4 -0
+_scratch_unmount >/dev/null 2>&1
+
+#attributes of increaseing sizes
+attr16="0123456789ABCDEFG"

Yes, we need to drop the G off this line :-)

Quoted 8 lines

"attr16" is seventeen bytes long.

tests/xfs/540 line 72

Quoted 5 lines
tests/xfs/540 new file +5 -0
+attr64="$attr16$attr16$attr16$attr16"
+attr256="$attr64$attr64$attr64$attr64"
+attr1k="$attr256$attr256$attr256$attr256"
+attr4k="$attr1k$attr1k$attr1k$attr1k"
+attr8k="$attr4k$attr4k$attr4k$attr4k"

I think I must have meant to do a 16k in here. Lets replace attr8k and attr32k with:

attr8k="$attr4k$attr4k"
attr16k="$attr8k$attr8k"
attr32k="$attr16k$attr16k"

I think that's easier to look at too. Then we can add another replay test for the attr16k as well.

Quoted 51 lines

This is 17k long...

tests/xfs/540 line 73

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr32k="$attr8k$attr8k$attr8k$attr8k"

...which makes this 68k long...

tests/xfs/540 line 74

Quoted 1 line
tests/xfs/540 new file +1 -0
+attr64k="$attr32k$attr32k"

...and this 136K long?

I'm curious, what are the contents of user.attr_name8?

OH, I see, attr clamps the value length to 64k, so I guess the oversize buffers don't matter.

--D

Quoted 33 lines
tests/xfs/540 new file +22 -0
+
+echo "*** mkfs"
+_scratch_mkfs_xfs >/dev/null
+
+echo "*** mount FS"
+_scratch_mount
+
+testfile=$SCRATCH_MNT/testfile
+echo "*** make test file 1"
+
+_test_attr_replay "attr_name1" $attr16
+_test_attr_replay "attr_name2" $attr64
+_test_attr_replay "attr_name3" $attr256
+_test_attr_replay "attr_name4" $attr1k
+_test_attr_replay "attr_name5" $attr4k
+_test_attr_replay "attr_name6" $attr8k
+_test_attr_replay "attr_name7" $attr32k
+_test_attr_replay "attr_name8" $attr64k
+
+echo "*** done"
+status=0
+exit
tests/xfs/540.out new file +5 -0
new file mode 100644
index 00000000..c1b178a0
@@ -0,0 +1,130 @@
+QA output created by 540
+*** mkfs
+*** mount FS
+*** make test file 1
+Inject error
Quoted 8 lines

tests/xfs/540.out line 10

Quoted 5 lines
tests/xfs/540.out new file +5 -0
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name1" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error

The error messages need to be filtered too, because SCRATCH_MNT is definitely not /mnt/scratch here. ;)

Ok, so we need to add "| _filter_scratch" to all the touch commands in _test_attr_replay

Thanks for the reviews!
Allison

Quoted 126 lines

--D

Quoted 123 lines
tests/xfs/540.out new file +120 -0
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name2" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name3" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name4" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name5" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name6" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name7" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+
+Inject error
+Set attribute
+attr_set: Input/output error
+Could not set "attr_name8" for /mnt/scratch/testfile.1
+FS should be shut down, touch will fail
+touch: cannot touch '/mnt/scratch/testfile.1': Input/output error
+Remount to replay log
+FS should be online, touch should succeed
+Verify attr recovery
+# file: SCRATCH_MNT/testfile.1
+user.attr_name1
+user.attr_name2
+user.attr_name3
+user.attr_name4
+user.attr_name5
+user.attr_name6
+user.attr_name7
+user.attr_name8
+
+*** done
+*** unmount
Signature · 1 line
2.25.1