: generic: add test for boundary in xfs_attr_shortform_verify
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 | 64 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 73 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.out
Signature · 1 line
2.26.2
PATCH 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 | 64 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 73 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.out
tests/generic/609 new file +64 -0
@@ -0,0 +1,64 @@ +#! /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. + +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" + +echo "+ create scratch fs" +_scratch_mkfs > /dev/null 2>&1 + +echo "+ mount fs image" +_scratch_mount + +echo "+ make test file" +touch "${TESTFILE}" + +echo "+ set file attributes" +"${SETFATTR_PROG}" -n user.a "${TESTFILE}" + +echo 3 > /proc/sys/vm/drop_caches +sleep 3 + +echo "+ get file attributes" +"${GETFATTR_PROG}" --absolute-names -n user.a "${TESTFILE}" | grep "user.a" + +echo "+ umount fs image" +umount "${SCRATCH_MNT}" + +status=0 +exit
tests/generic/609.out new file +8 -0
@@ -0,0 +1,8 @@ +QA output created by 609 ++ create scratch fs ++ mount fs image ++ make test file ++ set file attributes ++ get file attributes +user.a="" ++ umount fs image
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
Signature · 1 line
2.26.2
Re: [PATCH 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 | 64 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 73 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.outtests/generic/609 new file +0
-0
tests/generic/609 line 8
Quoted 8 lines
tests/generic/609 new file +8
-0@@ -0,0 +1,64 @@ +#! /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.
You can specify this case cover which upstream fix(commit).
Quoted 27 lines
tests/generic/609 new file +27
-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
tests/generic/609 line 45
Quoted 10 lines
tests/generic/609 new file +10
-0+_supported_os Linux +_require_scratch +_require_attrs + +TESTFILE="${SCRATCH_MNT}/testfile" + +echo "+ create scratch fs" +_scratch_mkfs > /dev/null 2>&1 + +echo "+ mount fs image"
I don't think such detailed log output for each of step are needed, but you can keep it if you'd like that :)
tests/generic/609 line 55
Quoted 10 lines
tests/generic/609 new file +10
-0+_scratch_mount + +echo "+ make test file" +touch "${TESTFILE}" + +echo "+ set file attributes" +"${SETFATTR_PROG}" -n user.a "${TESTFILE}" + +echo 3 > /proc/sys/vm/drop_caches +sleep 3
I think you'd better to add a comment to explain why these two lines are needed.
tests/generic/609 line 58
Quoted 3 lines
tests/generic/609 new file +3
-0+ +echo "+ get file attributes" +"${GETFATTR_PROG}" --absolute-names -n user.a "${TESTFILE}" | grep "user.a"
From my testing, this step already can trigger an error if the bug isn't fixed. But due to this's a test for fs corruption, maybe a manual filesystem checking (_check_scratch_fs) is better at the end?
tests/generic/609 line 61
Quoted 3 lines
tests/generic/609 new file +3
-0+ +echo "+ umount fs image" +umount "${SCRATCH_MNT}"
Use _scratch_unmount to umount SCRATCH_DEV
Quoted 29 lines
tests/generic/609 new file +3
-0+ +status=0 +exittests/generic/609.out new file +8
-0@@ -0,0 +1,8 @@ +QA output created by 609 ++ create scratch fs ++ mount fs image ++ make test file ++ set file attributes ++ get file attributes +user.a="" ++ umount fs imagetests/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 attrSignature · 1 line
2.26.2
Re: [PATCH 1/1] generic: add test for boundary in xfs_attr_shortform_verify
Quoted 79 lines · Zorro Lang
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 | 64 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 73 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.outtests/generic/609 new file +0
-0tests/generic/609 line 8
Quoted 8 lines
tests/generic/609 new file +8
-0@@ -0,0 +1,64 @@ +#! /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.You can specify this case cover which upstream fix(commit).
Quoted 27 lines
tests/generic/609 new file +27
-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 generictests/generic/609 line 45
Quoted 10 lines
tests/generic/609 new file +10
-0+_supported_os Linux +_require_scratch +_require_attrs + +TESTFILE="${SCRATCH_MNT}/testfile" + +echo "+ create scratch fs" +_scratch_mkfs > /dev/null 2>&1 + +echo "+ mount fs image"I don't think such detailed log output for each of step are needed, but you can keep it if you'd like that :)
Quoted 12 lines
tests/generic/609 line 55
Quoted 10 lines
tests/generic/609 new file +10
-0+_scratch_mount + +echo "+ make test file" +touch "${TESTFILE}" + +echo "+ set file attributes" +"${SETFATTR_PROG}" -n user.a "${TESTFILE}" + +echo 3 > /proc/sys/vm/drop_caches +sleep 3I think you'd better to add a comment to explain why these two lines are needed.
Does _scratch_cycle_mount trigger it too?
Quoted 32 lines
tests/generic/609 line 58
Quoted 3 lines
tests/generic/609 new file +3
-0+ +echo "+ get file attributes" +"${GETFATTR_PROG}" --absolute-names -n user.a "${TESTFILE}" | grep "user.a"From my testing, this step already can trigger an error if the bug isn't fixed. But due to this's a test for fs corruption, maybe a manual filesystem checking (
_check_scratch_fs) is better at the end?tests/generic/609 line 61
Quoted 3 lines
tests/generic/609 new file +3
-0+ +echo "+ umount fs image" +umount "${SCRATCH_MNT}"Use
_scratch_unmountto umountSCRATCH_DEVQuoted 18 lines
tests/generic/609 new file +3
-0+ +status=0 +exittests/generic/609.out new file +8
-0@@ -0,0 +1,8 @@ +QA output created by 609 ++ create scratch fs ++ mount fs image ++ make test file ++ set file attributes ++ get file attributes +user.a="" ++ umount fs imagetests/generic/group +0
-0
Quoted 8 lines
tests/generic/group line 614
Quoted 8 lines
index
aa969bcb..66bfb9dd100644tests/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
"auto quick attr"? Assuming this test runs in under 30s and doesn't crash the kernel, right?
--D
Quoted 4 lines
Quoted 3 lines
Signature · 1 line
2.26.2
Re: [PATCH 1/1] generic: add test for boundary in xfs_attr_shortform_verify
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
608 auto attr quick dax
+609 auto attr"auto quick attr"? Assuming this test runs in under 30s and doesn't crash the kernel, right?
Yes, it runs about 3-4 seconds (~the sleep call), it does not crash the kernel.
OK, I will add the quick group, I wasn't sure about the time limits.
Thanks.
Re: [PATCH 1/1] generic: add test for boundary in xfs_attr_shortform_verify
In reply to Darrick J. WongQuoted 93 lines · Darrick J. Wong
Quoted 79 lines · Zorro Lang
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 | 64 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 73 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.outtests/generic/609 new file +0
-0tests/generic/609 line 8
Quoted 8 lines
tests/generic/609 new file +8
-0@@ -0,0 +1,64 @@ +#! /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.You can specify this case cover which upstream fix(commit).
Quoted 27 lines
tests/generic/609 new file +27
-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 generictests/generic/609 line 45
Quoted 10 lines
tests/generic/609 new file +10
-0+_supported_os Linux +_require_scratch +_require_attrs + +TESTFILE="${SCRATCH_MNT}/testfile" + +echo "+ create scratch fs" +_scratch_mkfs > /dev/null 2>&1 + +echo "+ mount fs image"I don't think such detailed log output for each of step are needed, but you can keep it if you'd like that :)
Quoted 12 lines
tests/generic/609 line 55
Quoted 10 lines
tests/generic/609 new file +10
-0+_scratch_mount + +echo "+ make test file" +touch "${TESTFILE}" + +echo "+ set file attributes" +"${SETFATTR_PROG}" -n user.a "${TESTFILE}" + +echo 3 > /proc/sys/vm/drop_caches +sleep 3I think you'd better to add a comment to explain why these two lines are needed.
Quoted 1 line
Does
_scratch_cycle_mounttrigger it too?
Yes, cycle mount can make sure this change ondisk 100% :)
Quoted 52 lines
Quoted 33 lines
tests/generic/609 line 58
Quoted 4 lines
tests/generic/609 new file +3
-0+ +echo "+ get file attributes" +"${GETFATTR_PROG}" --absolute-names -n user.a "${TESTFILE}" | grep "user.a"From my testing, this step already can trigger an error if the bug isn't fixed. But due to this's a test for fs corruption, maybe a manual filesystem checking (
_check_scratch_fs) is better at the end?tests/generic/609 line 61
Quoted 3 lines
tests/generic/609 new file +3
-0+ +echo "+ umount fs image" +umount "${SCRATCH_MNT}"Use
_scratch_unmountto umountSCRATCH_DEVQuoted 18 lines
tests/generic/609 new file +3
-0+ +status=0 +exittests/generic/609.out new file +8
-0@@ -0,0 +1,8 @@ +QA output created by 609 ++ create scratch fs ++ mount fs image ++ make test file ++ set file attributes ++ get file attributes +user.a="" ++ umount fs imagetests/generic/group +0
-0Quoted 8 lines
tests/generic/group line 614
Quoted 8 lines
index
aa969bcb..66bfb9dd100644tests/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"auto quick attr"? Assuming this test runs in under 30s and doesn't crash the kernel, right?
--D
Quoted 4 lines
Quoted 3 lines
Signature · 1 line
2.26.2
Re: [PATCH 1/1] generic: add test for boundary in xfs_attr_shortform_verify
In reply to Zorro LangHi,
thanks for the comments. I tried to address them all in version 2 of this patch.
Thanks.
Pavel