public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] Add delayed attributes test
@ 2019-08-09 21:38 Allison Collins
  2019-08-09 21:38 ` [PATCH v1 1/1] xfstests: Add Delayed Attribute test Allison Collins
  0 siblings, 1 reply; 4+ messages in thread
From: Allison Collins @ 2019-08-09 21:38 UTC (permalink / raw)
  To: linux-xfs

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

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/1] xfstests: Add Delayed Attribute test
  2019-08-09 21:38 [PATCH v1 0/1] Add delayed attributes test Allison Collins
@ 2019-08-09 21:38 ` Allison Collins
  2019-08-12 16:51   ` Darrick J. Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Allison Collins @ 2019-08-09 21:38 UTC (permalink / raw)
  To: linux-xfs

This patch adds a test to exercise the delayed attribute error
inject and log replay

Signed-off-by: Allison Collins <allison.henderson@oracle.com>
---
 tests/xfs/512     | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/512.out |  18 ++++++++++
 tests/xfs/group   |   1 +
 3 files changed, 121 insertions(+)

diff --git a/tests/xfs/512 b/tests/xfs/512
new file mode 100644
index 0000000..957525c
--- /dev/null
+++ b/tests/xfs/512
@@ -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
diff --git a/tests/xfs/512.out b/tests/xfs/512.out
new file mode 100644
index 0000000..71bff79
--- /dev/null
+++ b/tests/xfs/512.out
@@ -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
diff --git a/tests/xfs/group b/tests/xfs/group
index a7ad300..a9dab7c 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -509,3 +509,4 @@
 509 auto ioctl
 510 auto ioctl quick
 511 auto quick quota
+512 auto quick attr
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] xfstests: Add Delayed Attribute test
  2019-08-09 21:38 ` [PATCH v1 1/1] xfstests: Add Delayed Attribute test Allison Collins
@ 2019-08-12 16:51   ` Darrick J. Wong
  2019-08-13  0:52     ` Allison Collins
  0 siblings, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2019-08-12 16:51 UTC (permalink / raw)
  To: Allison Collins; +Cc: linux-xfs

On Fri, Aug 09, 2019 at 02:38:29PM -0700, Allison Collins wrote:
> This patch adds a test to exercise the delayed attribute error
> inject and log replay
> 
> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> ---
>  tests/xfs/512     | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/512.out |  18 ++++++++++
>  tests/xfs/group   |   1 +
>  3 files changed, 121 insertions(+)
> 
> diff --git a/tests/xfs/512 b/tests/xfs/512
> new file mode 100644
> index 0000000..957525c
> --- /dev/null
> +++ b/tests/xfs/512
> @@ -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;" \

When does $tmp show up in the ATTR_PROG output?

Also, _filter_scratch should do most of this filtering for you, right?

> +		$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"

I think _scratch_mkfs_xfs does the _fail for you already, right?

(Or was it _scratch_mkfs?)

> +
> +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

Can we try attr recovery with a 64k value too?

--D

> +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
> diff --git a/tests/xfs/512.out b/tests/xfs/512.out
> new file mode 100644
> index 0000000..71bff79
> --- /dev/null
> +++ b/tests/xfs/512.out
> @@ -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
> diff --git a/tests/xfs/group b/tests/xfs/group
> index a7ad300..a9dab7c 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -509,3 +509,4 @@
>  509 auto ioctl
>  510 auto ioctl quick
>  511 auto quick quota
> +512 auto quick attr
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] xfstests: Add Delayed Attribute test
  2019-08-12 16:51   ` Darrick J. Wong
@ 2019-08-13  0:52     ` Allison Collins
  0 siblings, 0 replies; 4+ messages in thread
From: Allison Collins @ 2019-08-13  0:52 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs



On 8/12/19 9:51 AM, Darrick J. Wong wrote:
> On Fri, Aug 09, 2019 at 02:38:29PM -0700, Allison Collins wrote:
>> This patch adds a test to exercise the delayed attribute error
>> inject and log replay
>>
>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>> ---
>>   tests/xfs/512     | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   tests/xfs/512.out |  18 ++++++++++
>>   tests/xfs/group   |   1 +
>>   3 files changed, 121 insertions(+)
>>
>> diff --git a/tests/xfs/512 b/tests/xfs/512
>> new file mode 100644
>> index 0000000..957525c
>> --- /dev/null
>> +++ b/tests/xfs/512
>> @@ -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;" \
> 
> When does $tmp show up in the ATTR_PROG output?

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 :-)

> 
> Also, _filter_scratch should do most of this filtering for you, right?
> 
>> +		$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"
> 
> I think _scratch_mkfs_xfs does the _fail for you already, right?
I think so, I can probably trim that off

> 
> (Or was it _scratch_mkfs?)
> 
>> +
>> +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
> 
> Can we try attr recovery with a 64k value too?

Sure, I'll find some larger attrs to include here.

Thx!
Allison

> 
> --D
> 
>> +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
>> diff --git a/tests/xfs/512.out b/tests/xfs/512.out
>> new file mode 100644
>> index 0000000..71bff79
>> --- /dev/null
>> +++ b/tests/xfs/512.out
>> @@ -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
>> diff --git a/tests/xfs/group b/tests/xfs/group
>> index a7ad300..a9dab7c 100644
>> --- a/tests/xfs/group
>> +++ b/tests/xfs/group
>> @@ -509,3 +509,4 @@
>>   509 auto ioctl
>>   510 auto ioctl quick
>>   511 auto quick quota
>> +512 auto quick attr
>> -- 
>> 2.7.4
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-13  0:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-09 21:38 [PATCH v1 0/1] Add delayed attributes test Allison Collins
2019-08-09 21:38 ` [PATCH v1 1/1] xfstests: Add Delayed Attribute test Allison Collins
2019-08-12 16:51   ` Darrick J. Wong
2019-08-13  0:52     ` Allison Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox