: generic: add test for boundary in xfs_attr_shortform_verify
v2 cover : generic: add test for boundary in xfs_attr_shortform_verify
Add test for XFS bug that corrupted metadata if extended attribute name of length 1 was used.
Pavel Reichl (1):
generic: add test for boundary in xfs_attr_shortform_verify
tests/generic/609 | 66 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 1 + tests/generic/group | 1 + 3 files changed, 68 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.out
Signature · 1 line
2.26.2
PATCH v2 1/1 generic: add test for boundary in xfs_attr_shortform_verify
Add a regression test to check that the boundary test for the fixed-offset parts of xfs_attr_sf_entry in xfs_attr_shortform_verify is not off by one.
This can be shown by:
touch file
setfattr -n user.a file
With help from Zorro. Thanks very much.
--- tests/generic/609 | 66 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 1 + tests/generic/group | 1 + 3 files changed, 68 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.out
tests/generic/609 new file +66 -0
@@ -0,0 +1,66 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 609 +# +# Verify that metadata won't get corrupted when extended attribute +# name of size one is set. +# +# This test excercises the problem fixed in kernel with commit +# xfs: fix boundary test in xfs_attr_shortform_verify + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +_supported_fs generic +_supported_os Linux +_require_scratch +_require_attrs + +TESTFILE="${SCRATCH_MNT}/testfile" + +_scratch_mkfs > /dev/null 2>&1 + +_scratch_mount + +touch "${TESTFILE}" + +"${SETFATTR_PROG}" -n user.a "${TESTFILE}" + +# Make sure that changes are written to disk +echo 3 > /proc/sys/vm/drop_caches +sleep 3 + +if [ ! _check_scratch_fs ] +then + echo error detected in filesystem + exit +fi + +_scratch_unmount + +status=0 +exit
tests/generic/609.out new file +1 -0
@@ -0,0 +1 @@ +QA output created by 609
tests/generic/group +1 -0
@@ -611,3 +611,4 @@ 606 auto attr quick dax 607 auto attr quick dax 608 auto attr quick dax +609 auto attr quick
Signature · 1 line
2.26.2
Re: [PATCH v2 1/1] generic: add test for boundary in xfs_attr_shortform_verify
Quoted 26 lines · Pavel Reichl
Add a regression test to check that the boundary test for the fixed-offset parts of
xfs_attr_sf_entryinxfs_attr_shortform_verifyis not off by one.This can be shown by:
touch file
setfattr -n user.a fileWith help from Zorro. Thanks very much.
Signed-off-by Pavel Reichl <[email protected]>--- tests/generic/609 | 66 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 1 + tests/generic/group | 1 + 3 files changed, 68 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.outtests/generic/609 new file +0
-0
tests/generic/609 line 10
Quoted 10 lines
tests/generic/609 new file +10
-0@@ -0,0 +1,66 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 609 +# +# Verify that metadata won't get corrupted when extended attribute +# name of size one is set. +# +# This test excercises the problem fixed in kernel with commit
^^ exercises?
tests/generic/609 line 11
Quoted 1 line
tests/generic/609 new file +1
-0+# xfs: fix boundary test in xfs_attr_shortform_verify
As this patch has been merged, specify the commit id might be better:)
f4020438fab0 ("xfs: fix boundary test in xfs_attr_shortform_verify")
Quoted 40 lines
tests/generic/609 new file +40
-0+ +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +_supported_fs generic +_supported_os Linux +_require_scratch +_require_attrs + +TESTFILE="${SCRATCH_MNT}/testfile" + +_scratch_mkfs > /dev/null 2>&1 + +_scratch_mount + +touch "${TESTFILE}" + +"${SETFATTR_PROG}" -n user.a "${TESTFILE}"
tests/generic/609 line 61
Quoted 10 lines
tests/generic/609 new file +10
-0+ +# Make sure that changes are written to disk +echo 3 > /proc/sys/vm/drop_caches +sleep 3 + +if [ ! _check_scratch_fs ] +then + echo error detected in filesystem + exit +fi
_check_scratch_fs prints error output if it fails, that will break golden file and cause failure, so don't need to use the "if .... fi" to check that.
tests/generic/609 line 66
Quoted 5 lines
tests/generic/609 new file +5
-0+ +_scratch_unmount + +status=0 +exit
I'd like write this case something like below, just for reference:)
_scratch_mkfs > $seqres.full 2>&1_scratch_mount
localfile=${SCRATCH_MNT}/testfile
touch $localfile
${SETFATTR_PROG} -n user.a $localfile
# Make sure that changes are written to disk
echo 3 > /proc/sys/vm/drop_caches
sleep 3
# If the target bug isn't fixed, getfattr fails ${GETFATTR_PROG} --absolute-names -n user.a $localfile | _filter_scratch
# Make sure the filesystem isn't corrupted manually _scratch_unmount_check_scrach_fs
status=0
exit
Quoted 19 lines
tests/generic/609.out new file +1
-0@@ -0,0 +1 @@ +QA output created by 609tests/generic/group +1
-0@@ -611,3 +611,4 @@ 606 auto attr quick dax 607 auto attr quick dax 608 auto attr quick dax +609 auto attr quickSignature · 1 line
2.26.2
Re: [PATCH v2 1/1] generic: add test for boundary in xfs_attr_shortform_verify
Quoted 2 lines · Zorro Lang
Quoted 1 line
+# This test excercises the problem fixed in kernel with commit
^^ exercises?
Hi,
I 'took' this phrase from 'tests/generic/086', would:
'This test verifies the problem fixed in kernel with commit...' work better for you?
Thanks!