* [PATCH v3 0/1] generic: add test for boundary in xfs_attr_shortform_verify
@ 2020-09-12 10:19 Pavel Reichl
2020-09-12 10:19 ` [PATCH v3 1/1] " Pavel Reichl
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Reichl @ 2020-09-12 10:19 UTC (permalink / raw)
To: fstests; +Cc: zlang
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 | 63 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/609.out | 4 +++
tests/generic/group | 1 +
3 files changed, 68 insertions(+)
create mode 100755 tests/generic/609
create mode 100644 tests/generic/609.out
--
2.26.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/1] generic: add test for boundary in xfs_attr_shortform_verify
2020-09-12 10:19 [PATCH v3 0/1] generic: add test for boundary in xfs_attr_shortform_verify Pavel Reichl
@ 2020-09-12 10:19 ` Pavel Reichl
2020-09-12 12:31 ` Zorro Lang
2020-09-13 16:36 ` Eryu Guan
0 siblings, 2 replies; 5+ messages in thread
From: Pavel Reichl @ 2020-09-12 10:19 UTC (permalink / raw)
To: fstests; +Cc: zlang
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@redhat.com>
---
tests/generic/609 | 63 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/609.out | 4 +++
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..f048b2ba
--- /dev/null
+++ b/tests/generic/609
@@ -0,0 +1,63 @@
+#! /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 verifies the problem fixed in kernel with commit
+# f4020438fab0 ("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
+
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount
+
+localfile="${SCRATCH_MNT}/testfile"
+
+touch "${localfile}"
+"${SETFATTR_PROG}" -n user.a "${localfile}"
+
+# Make sure that changes are written to disk
+echo 3 > /proc/sys/vm/drop_caches
+sleep 3
+
+# If the target bug isn't fixed, getfattr fails
+${GETFATTR_PROG} --absolute-names -n user.a $localfile | _filter_scratch
+
+# Make sure the filesystem isn't corrupted manually
+_scratch_unmount
+_check_scratch_fs
+
+status=0
+exit
diff --git a/tests/generic/609.out b/tests/generic/609.out
new file mode 100644
index 00000000..d4ae152d
--- /dev/null
+++ b/tests/generic/609.out
@@ -0,0 +1,4 @@
+QA output created by 609
+# file: SCRATCH_MNT/testfile
+user.a=""
+
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/1] generic: add test for boundary in xfs_attr_shortform_verify
2020-09-12 10:19 ` [PATCH v3 1/1] " Pavel Reichl
@ 2020-09-12 12:31 ` Zorro Lang
2020-09-12 13:34 ` Zorro Lang
2020-09-13 16:36 ` Eryu Guan
1 sibling, 1 reply; 5+ messages in thread
From: Zorro Lang @ 2020-09-12 12:31 UTC (permalink / raw)
To: Pavel Reichl; +Cc: fstests
On Sat, Sep 12, 2020 at 12:19:53PM +0200, Pavel Reichl wrote:
> 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@redhat.com>
> ---
This looks good to me, if you don't tend to replace "drop cache" with "cycle
mount" as Darrick suggested :) Both ways good to me, as you wish.
Reviewed-by: Zorro Lang <zlang@redhat.com>
Thanks,
Zorro
> tests/generic/609 | 63 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/609.out | 4 +++
> 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..f048b2ba
> --- /dev/null
> +++ b/tests/generic/609
> @@ -0,0 +1,63 @@
> +#! /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 verifies the problem fixed in kernel with commit
> +# f4020438fab0 ("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
> +
> +_scratch_mkfs > $seqres.full 2>&1
> +_scratch_mount
> +
> +localfile="${SCRATCH_MNT}/testfile"
> +
> +touch "${localfile}"
> +"${SETFATTR_PROG}" -n user.a "${localfile}"
> +
> +# Make sure that changes are written to disk
> +echo 3 > /proc/sys/vm/drop_caches
> +sleep 3
> +
> +# If the target bug isn't fixed, getfattr fails
> +${GETFATTR_PROG} --absolute-names -n user.a $localfile | _filter_scratch
> +
> +# Make sure the filesystem isn't corrupted manually
> +_scratch_unmount
> +_check_scratch_fs
> +
> +status=0
> +exit
> diff --git a/tests/generic/609.out b/tests/generic/609.out
> new file mode 100644
> index 00000000..d4ae152d
> --- /dev/null
> +++ b/tests/generic/609.out
> @@ -0,0 +1,4 @@
> +QA output created by 609
> +# file: SCRATCH_MNT/testfile
> +user.a=""
> +
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/1] generic: add test for boundary in xfs_attr_shortform_verify
2020-09-12 12:31 ` Zorro Lang
@ 2020-09-12 13:34 ` Zorro Lang
0 siblings, 0 replies; 5+ messages in thread
From: Zorro Lang @ 2020-09-12 13:34 UTC (permalink / raw)
To: Pavel Reichl, fstests
On Sat, Sep 12, 2020 at 08:31:34PM +0800, Zorro Lang wrote:
> On Sat, Sep 12, 2020 at 12:19:53PM +0200, Pavel Reichl wrote:
> > 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@redhat.com>
> > ---
>
> This looks good to me, if you don't tend to replace "drop cache" with "cycle
> mount" as Darrick suggested :) Both ways good to me, as you wish.
Oh, a tiny problem when I tried to merge this patch:
Applying: generic: add test for boundary in xfs_attr_shortform_verify
.git/rebase-apply/patch:87: new blank line at EOF.
+
>
> Reviewed-by: Zorro Lang <zlang@redhat.com>
>
> Thanks,
> Zorro
>
> > tests/generic/609 | 63 +++++++++++++++++++++++++++++++++++++++++++
> > tests/generic/609.out | 4 +++
> > 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..f048b2ba
> > --- /dev/null
> > +++ b/tests/generic/609
> > @@ -0,0 +1,63 @@
> > +#! /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 verifies the problem fixed in kernel with commit
> > +# f4020438fab0 ("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
> > +
> > +_scratch_mkfs > $seqres.full 2>&1
> > +_scratch_mount
> > +
> > +localfile="${SCRATCH_MNT}/testfile"
> > +
> > +touch "${localfile}"
> > +"${SETFATTR_PROG}" -n user.a "${localfile}"
> > +
> > +# Make sure that changes are written to disk
> > +echo 3 > /proc/sys/vm/drop_caches
> > +sleep 3
> > +
> > +# If the target bug isn't fixed, getfattr fails
> > +${GETFATTR_PROG} --absolute-names -n user.a $localfile | _filter_scratch
> > +
> > +# Make sure the filesystem isn't corrupted manually
> > +_scratch_unmount
> > +_check_scratch_fs
> > +
> > +status=0
> > +exit
> > diff --git a/tests/generic/609.out b/tests/generic/609.out
> > new file mode 100644
> > index 00000000..d4ae152d
> > --- /dev/null
> > +++ b/tests/generic/609.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 609
> > +# file: SCRATCH_MNT/testfile
> > +user.a=""
> > +
> > 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
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/1] generic: add test for boundary in xfs_attr_shortform_verify
2020-09-12 10:19 ` [PATCH v3 1/1] " Pavel Reichl
2020-09-12 12:31 ` Zorro Lang
@ 2020-09-13 16:36 ` Eryu Guan
1 sibling, 0 replies; 5+ messages in thread
From: Eryu Guan @ 2020-09-13 16:36 UTC (permalink / raw)
To: Pavel Reichl; +Cc: fstests, zlang
On Sat, Sep 12, 2020 at 12:19:53PM +0200, Pavel Reichl wrote:
> 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@redhat.com>
> ---
> tests/generic/609 | 63 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/609.out | 4 +++
> 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..f048b2ba
> --- /dev/null
> +++ b/tests/generic/609
> @@ -0,0 +1,63 @@
> +#! /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 verifies the problem fixed in kernel with commit
> +# f4020438fab0 ("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
> +
> +_scratch_mkfs > $seqres.full 2>&1
> +_scratch_mount
> +
> +localfile="${SCRATCH_MNT}/testfile"
> +
> +touch "${localfile}"
> +"${SETFATTR_PROG}" -n user.a "${localfile}"
> +
> +# Make sure that changes are written to disk
> +echo 3 > /proc/sys/vm/drop_caches
> +sleep 3
If _scratch_cycle_mount also works, I'd prefer it over a system-wide
drop cache.
And is "sleep 3" really needed?
> +
> +# If the target bug isn't fixed, getfattr fails
> +${GETFATTR_PROG} --absolute-names -n user.a $localfile | _filter_scratch
> +
> +# Make sure the filesystem isn't corrupted manually
> +_scratch_unmount
> +_check_scratch_fs
The test harness will do fsck by default after test, so there's no need
to _check_scratch_fs manually.
Thanks,
Eryu
> +
> +status=0
> +exit
> diff --git a/tests/generic/609.out b/tests/generic/609.out
> new file mode 100644
> index 00000000..d4ae152d
> --- /dev/null
> +++ b/tests/generic/609.out
> @@ -0,0 +1,4 @@
> +QA output created by 609
> +# file: SCRATCH_MNT/testfile
> +user.a=""
> +
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-13 16:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-12 10:19 [PATCH v3 0/1] generic: add test for boundary in xfs_attr_shortform_verify Pavel Reichl
2020-09-12 10:19 ` [PATCH v3 1/1] " Pavel Reichl
2020-09-12 12:31 ` Zorro Lang
2020-09-12 13:34 ` Zorro Lang
2020-09-13 16:36 ` Eryu Guan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox