Add delayed attributes test
cover Add delayed attributes test
This patch adds a quick test to excersize the delayed attribute error inject and log replay.
Allison Collins (1):
xfstests: Add Delayed Attribute test
tests/xfs/512 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/512.out | 18 ++++++++++ tests/xfs/group | 1 + 3 files changed, 121 insertions(+) create mode 100644 tests/xfs/512 create mode 100644 tests/xfs/512.out
Signature · 1 line
2.7.4
PATCH 1/1 xfstests: Add Delayed Attribute test
This patch adds a test to exercise the delayed attribute error inject and log replay
--- tests/xfs/512 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/512.out | 18 ++++++++++ tests/xfs/group | 1 + 3 files changed, 121 insertions(+)
tests/xfs/512 new file +102 -0
@@ -0,0 +1,102 @@ +#! /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 + +_attr() +{ + ${ATTR_PROG} $* 2>$tmp.err >$tmp.out + exit=$? + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.out + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.err 1>&2 + return $exit +} + +do_getfattr() +{ + _getfattr $* 2>$tmp.err >$tmp.out + exit=$? + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.out + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.err 1>&2 + return $exit +} + +# real QA test starts here +_supported_fs xfs +_supported_os Linux + +_require_scratch +_require_attrs +_require_xfs_io_error_injection "delayed_attr" + +rm -f $seqres.full +_scratch_unmount >/dev/null 2>&1 + +echo "*** mkfs" +_scratch_mkfs_xfs >/dev/null \ + || _fail "mkfs failed" + +echo "*** mount FS" +_scratch_mount + +testfile=$SCRATCH_MNT/testfile +echo "*** make test file 1" + +touch $testfile.1 + +echo "Inject error" +_scratch_inject_error "delayed_attr" + +echo "Set attribute" +echo "attr_value" | _attr -s "attr_name" $testfile.1 >/dev/null + +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" +do_getfattr --absolute-names $testfile.1 + +echo "*** done" +exit
tests/xfs/512.out new file +18 -0
@@ -0,0 +1,18 @@ +QA output created by 512 +*** mkfs +*** mount FS +*** make test file 1 +Inject error +Set attribute +attr_set: Input/output error +Could not set "attr_name" for <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: <TESTFILE>.1 +user.attr_name + +*** done +*** unmount
tests/xfs/group +1 -0
@@ -509,3 +509,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +512 auto quick attr
Signature · 1 line
2.7.4
Re: [PATCH v1 1/1] xfstests: Add Delayed Attribute test
Quoted 42 lines · Allison Collins
This patch adds a test to exercise the delayed attribute error inject and log replay
Signed-off-by Allison Collins <[email protected]>--- tests/xfs/512 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/512.out | 18 ++++++++++ tests/xfs/group | 1 + 3 files changed, 121 insertions(+)tests/xfs/512 new file +26
-0@@ -0,0 +1,102 @@ +#! /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.*
tests/xfs/512 line 36
Quoted 10 lines
tests/xfs/512 new file +10
-0+} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_attr() +{ + ${ATTR_PROG} $* 2>$tmp.err >$tmp.out + exit=$? + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \
When does $tmp show up in the ATTR_PROG output?
Also, _filter_scratch should do most of this filtering for you, right?
Quoted 27 lines
tests/xfs/512 new file +27
-0+ $tmp.out + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.err 1>&2 + return $exit +} + +do_getfattr() +{ + _getfattr $* 2>$tmp.err >$tmp.out + exit=$? + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.out + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.err 1>&2 + return $exit +} + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +
tests/xfs/512 line 73
Quoted 10 lines
tests/xfs/512 new file +10
-0+_require_scratch +_require_attrs +_require_xfs_io_error_injection "delayed_attr" + +rm -f $seqres.full +_scratch_unmount >/dev/null 2>&1 + +echo "*** mkfs" +_scratch_mkfs_xfs >/dev/null \ + || _fail "mkfs failed"
I think _scratch_mkfs_xfs does the _fail for you already, right?
(Or was it _scratch_mkfs?)
Quoted 4 lines
tests/xfs/512 new file +4
-0+ +echo "*** mount FS" +_scratch_mount +
tests/xfs/512 line 87
Quoted 10 lines
tests/xfs/512 new file +10
-0+testfile=$SCRATCH_MNT/testfile +echo "*** make test file 1" + +touch $testfile.1 + +echo "Inject error" +_scratch_inject_error "delayed_attr" + +echo "Set attribute" +echo "attr_value" | _attr -s "attr_name" $testfile.1 >/dev/null
Can we try attr recovery with a 64k value too?
--D
Quoted 50 lines
tests/xfs/512 new file +14
-0+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" +do_getfattr --absolute-names $testfile.1 + +echo "*** done" +exittests/xfs/512.out new file +18
-0@@ -0,0 +1,18 @@ +QA output created by 512 +*** mkfs +*** mount FS +*** make test file 1 +Inject error +Set attribute +attr_set: Input/output error +Could not set "attr_name" for <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: <TESTFILE>.1 +user.attr_name + +*** done +*** unmounttests/xfs/group +1
-0@@ -509,3 +509,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +512 auto quick attrSignature · 1 line
2.7.4
Re: [PATCH v1 1/1] xfstests: Add Delayed Attribute test
Quoted 47 lines · Darrick J. Wong
Quoted 46 lines · Allison Collins
This patch adds a test to exercise the delayed attribute error inject and log replay
Signed-off-by Allison Collins <[email protected]>--- tests/xfs/512 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/512.out | 18 ++++++++++ tests/xfs/group | 1 + 3 files changed, 121 insertions(+)tests/xfs/512 new file +30
-0@@ -0,0 +1,102 @@ +#! /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 + +_attr()
Quoted 8 lines
tests/xfs/512 line 36
Quoted 6 lines
tests/xfs/512 new file +6
-0+{ + ${ATTR_PROG} $* 2>$tmp.err >$tmp.out + exit=$? + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \When does $tmp show up in the
ATTR_PROGoutput?
I dont think it does in this case, I had started out with xfs/021 and gutted most of it. So this part can probably come out. Maybe I can get away with just using the _filter_scratch as you suggest :-)
Quoted 34 lines
Also,
_filter_scratchshould do most of this filtering for you, right?Quoted 31 lines
tests/xfs/512 new file +31
-0+ $tmp.out + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.err 1>&2 + return $exit +} + +do_getfattr() +{ + _getfattr $* 2>$tmp.err >$tmp.out + exit=$? + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.out + sed \ + -e "s#$SCRATCH_MNT[^ .:]*#<TESTFILE>#g" \ + -e "s#$tmp[^ :]*#<TMPFILE>#g;" \ + $tmp.err 1>&2 + return $exit +} + +# real QA test starts here +_supported_fs xfs +_supported_os Linux + +_require_scratch +_require_attrs +_require_xfs_io_error_injection "delayed_attr" +
Quoted 8 lines
tests/xfs/512 line 73
Quoted 6 lines
tests/xfs/512 new file +6
-0+rm -f $seqres.full +_scratch_unmount >/dev/null 2>&1 + +echo "*** mkfs" +_scratch_mkfs_xfs >/dev/null \ + || _fail "mkfs failed"I think
_scratch_mkfs_xfsdoes the_failfor you already, right?
I think so, I can probably trim that off
Quoted 19 lines
(Or was it
_scratch_mkfs?)Quoted 4 lines
tests/xfs/512 new file +4
-0+ +echo "*** mount FS" +_scratch_mount +tests/xfs/512 line 87
Quoted 10 lines
tests/xfs/512 new file +10
-0+testfile=$SCRATCH_MNT/testfile +echo "*** make test file 1" + +touch $testfile.1 + +echo "Inject error" +_scratch_inject_error "delayed_attr" + +echo "Set attribute" +echo "attr_value" | _attr -s "attr_name" $testfile.1 >/dev/nullCan we try attr recovery with a 64k value too?
Sure, I'll find some larger attrs to include here.
Thx!
Allison
Quoted 53 lines
--D
Quoted 50 lines
tests/xfs/512 new file +14
-0+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" +do_getfattr --absolute-names $testfile.1 + +echo "*** done" +exittests/xfs/512.out new file +18
-0@@ -0,0 +1,18 @@ +QA output created by 512 +*** mkfs +*** mount FS +*** make test file 1 +Inject error +Set attribute +attr_set: Input/output error +Could not set "attr_name" for <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: <TESTFILE>.1 +user.attr_name + +*** done +*** unmounttests/xfs/group +1
-0@@ -509,3 +509,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +512 auto quick attrSignature · 1 line
2.7.4