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. Signed-off-by: Pavel Reichl <preichl@xxxxxxxxxx> --- 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 diff --git a/tests/generic/609 b/tests/generic/609 new file mode 100755 index 00000000..2feb37a2 --- /dev/null +++ b/tests/generic/609 @@ -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 diff --git a/tests/generic/609.out b/tests/generic/609.out new file mode 100644 index 00000000..f85988af --- /dev/null +++ b/tests/generic/609.out @@ -0,0 +1 @@ +QA output created by 609 diff --git a/tests/generic/group b/tests/generic/group index aa969bcb..6fa83c13 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -611,3 +611,4 @@ 606 auto attr quick dax 607 auto attr quick dax 608 auto attr quick dax +609 auto attr quick -- 2.26.2