@@ -2116,6 +2116,9 @@ _require_xfs_io_command()
rm -f $testcopy > /dev/null 2>&1
param_checked="$param"
;;
+ "delayed_attr")
+ testio=`$XFS_IO_PROG -x -c "delayed_attr" $TEST_DIR 2>&1`
+ ;;
"falloc" )
testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
param_checked="$param"
@@ -262,6 +262,13 @@ _require_projid32bit()
|| _notrun "mkfs.xfs doesn't have projid32bit feature"
}
+_require_delattr()
+{
+ echo "_require_delattr"
+ _scratch_mkfs_xfs_supported -n delattr >/dev/null 2>&1 \
+ || _notrun "mkfs.xfs doesn't have delattr feature"
+}
+
_require_projid16bit()
{
_scratch_mkfs_xfs_supported -i projid32bit=0 >/dev/null 2>&1 \
new file mode 100755
@@ -0,0 +1,101 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved.
+#
+# FS QA Test No. 512
+#
+# Delayed attr log replay test
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=0 # success is the default!
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+. ./common/inject
+
+_cleanup()
+{
+ echo "*** unmount"
+ _scratch_unmount 2>/dev/null
+ rm -f $tmp.*
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_test_attr_replay()
+{
+ attr_name=$1
+ attr_value=$2
+ touch $testfile.1
+
+ echo "Inject error"
+ _scratch_inject_error "delayed_attr"
+
+ 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
+_supported_os Linux
+
+_require_scratch
+_require_attrs
+_require_xfs_io_error_injection "delayed_attr"
+_require_delattr
+
+# turn on delayed attributes
+MKFS_OPTIONS="-n delattr"
+
+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"
+exit
new file mode 100644
@@ -0,0 +1,131 @@
+QA output created by 512
+_require_delattr
+*** 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
+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
@@ -509,3 +509,4 @@
509 auto ioctl
510 auto ioctl quick
511 auto quick quota
+512 auto quick attr
This patch adds a test to exercise the delayed 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 Signed-off-by: Allison Collins <allison.henderson@oracle.com> --- common/rc | 3 ++ common/xfs | 7 +++ tests/xfs/512 | 101 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/512.out | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 5 files changed, 243 insertions(+)