diff mbox series

[v3,1/1] xfs/018: fix LARP testing for small block sizes

Message ID 20220805005552.34449-1-catherine.hoang@oracle.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/1] xfs/018: fix LARP testing for small block sizes | expand

Commit Message

Catherine Hoang Aug. 5, 2022, 12:55 a.m. UTC
From: "Darrick J. Wong" <djwong@kernel.org>

Fix this test to work properly when the filesystem block size is less
than 4k.  Tripping the error injection points on shape changes in the
xattr structure must be done dynamically.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
---
 tests/xfs/018     | 15 ++++++++++-----
 tests/xfs/018.out | 43 ++-----------------------------------------
 2 files changed, 12 insertions(+), 46 deletions(-)

Comments

Darrick J. Wong Aug. 5, 2022, 4:32 a.m. UTC | #1
On Thu, Aug 04, 2022 at 05:55:52PM -0700, Catherine Hoang wrote:
> From: "Darrick J. Wong" <djwong@kernel.org>
> 
> Fix this test to work properly when the filesystem block size is less
> than 4k.  Tripping the error injection points on shape changes in the
> xattr structure must be done dynamically.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Hmm, this patch got its start with things that I wrote...

> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
> Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
> ---
>  tests/xfs/018     | 15 ++++++++++-----
>  tests/xfs/018.out | 43 ++-----------------------------------------
>  2 files changed, 12 insertions(+), 46 deletions(-)
> 
> diff --git a/tests/xfs/018 b/tests/xfs/018
> index 041a3b24..1b45edf4 100755
> --- a/tests/xfs/018
> +++ b/tests/xfs/018
> @@ -47,7 +47,8 @@ test_attr_replay()
>  	touch $testfile
>  
>  	# Verify attr recovery
> -	$ATTR_PROG -l $testfile | _filter_scratch
> +	$ATTR_PROG -l $testfile >> $seqres.full
> +	echo "Checking contents of $attr_name" >> $seqres.full
>  	echo -n "$attr_name: "
>  	$ATTR_PROG -q -g $attr_name $testfile 2> /dev/null | md5sum;
>  
> @@ -98,6 +99,10 @@ attr64k="$attr32k$attr32k"
>  echo "*** mkfs"
>  _scratch_mkfs >/dev/null
>  
> +blk_sz=$(_scratch_xfs_get_sb_field blocksize)
> +err_inj_attr_sz=$(( blk_sz / 3 - 50 ))
> +err_inj_attr_val=$(printf "A%.0s" $(seq $err_inj_attr_sz))

...though I think this particular strategy (using attr values that are
~1/3 the block size) is novel.  I wonder if this deserves a comment on
the calculation, though?

I think the idea here is that we want to build up exactly one attr leaf
block by setting user.attr_name[1-3]; and then the fourth one is
guaranteed to cause a split in the fileoff 0 leaf block, which is enough
to trip both the da_leaf_split and attr_leaf_to_node injectors?

The reason why we have the same userspace code but two different trip
points is that we're trying to test recovery from two different points
in the xattr state machine, right?  So the test code looks identical,
but we're testing two separate things, right?

Assuming that all three answers are yes, then I'm satisfied by this new
approach that is much simpler than the one I came up with:

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D


> +
>  echo "*** mount FS"
>  _scratch_mount
>  
> @@ -140,12 +145,12 @@ test_attr_replay extent_file1 "attr_name2" $attr1k "s" "larp"
>  test_attr_replay extent_file1 "attr_name2" $attr1k "r" "larp"
>  
>  # extent, inject error on split
> -create_test_file extent_file2 3 $attr1k
> -test_attr_replay extent_file2 "attr_name4" $attr1k "s" "da_leaf_split"
> +create_test_file extent_file2 3 $err_inj_attr_val
> +test_attr_replay extent_file2 "attr_name4" $attr256 "s" "da_leaf_split"
>  
>  # extent, inject error on fork transition
> -create_test_file extent_file3 3 $attr1k
> -test_attr_replay extent_file3 "attr_name4" $attr1k "s" "attr_leaf_to_node"
> +create_test_file extent_file3 3 $err_inj_attr_val
> +test_attr_replay extent_file3 "attr_name4" $attr256 "s" "attr_leaf_to_node"
>  
>  # extent, remote
>  create_test_file extent_file4 1 $attr1k
> diff --git a/tests/xfs/018.out b/tests/xfs/018.out
> index 022b0ca3..415ecd7a 100644
> --- a/tests/xfs/018.out
> +++ b/tests/xfs/018.out
> @@ -4,7 +4,6 @@ QA output created by 018
>  attr_set: Input/output error
>  Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file1
>  touch: cannot touch 'SCRATCH_MNT/testdir/empty_file1': Input/output error
> -Attribute "attr_name" has a 65 byte value for SCRATCH_MNT/testdir/empty_file1
>  attr_name: cfbe2a33be4601d2b655d099a18378fc  -
>  
>  attr_remove: Input/output error
> @@ -15,7 +14,6 @@ attr_name: d41d8cd98f00b204e9800998ecf8427e  -
>  attr_set: Input/output error
>  Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file2
>  touch: cannot touch 'SCRATCH_MNT/testdir/empty_file2': Input/output error
> -Attribute "attr_name" has a 1025 byte value for SCRATCH_MNT/testdir/empty_file2
>  attr_name: 9fd415c49d67afc4b78fad4055a3a376  -
>  
>  attr_remove: Input/output error
> @@ -26,7 +24,6 @@ attr_name: d41d8cd98f00b204e9800998ecf8427e  -
>  attr_set: Input/output error
>  Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file3
>  touch: cannot touch 'SCRATCH_MNT/testdir/empty_file3': Input/output error
> -Attribute "attr_name" has a 65536 byte value for SCRATCH_MNT/testdir/empty_file3
>  attr_name: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>  
>  attr_remove: Input/output error
> @@ -37,132 +34,96 @@ attr_name: d41d8cd98f00b204e9800998ecf8427e  -
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file1
>  touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error
> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1
> -Attribute "attr_name2" has a 65 byte value for SCRATCH_MNT/testdir/inline_file1
>  attr_name2: cfbe2a33be4601d2b655d099a18378fc  -
>  
>  attr_remove: Input/output error
>  Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file1
>  touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error
> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1
>  attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file2
>  touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error
> -Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/inline_file2
> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2
>  attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
>  
>  attr_remove: Input/output error
>  Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file2
>  touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error
> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2
>  attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file3
>  touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error
> -Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/inline_file3
> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3
>  attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>  
>  attr_remove: Input/output error
>  Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file3
>  touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error
> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3
>  attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file1
>  touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error
> -Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file1
> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1
>  attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
>  
>  attr_remove: Input/output error
>  Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file1
>  touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error
> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1
>  attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file2
>  touch: cannot touch 'SCRATCH_MNT/testdir/extent_file2': Input/output error
> -Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file2
> -Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
> -Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
> -attr_name4: 9fd415c49d67afc4b78fad4055a3a376  -
> +attr_name4: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file3
>  touch: cannot touch 'SCRATCH_MNT/testdir/extent_file3': Input/output error
> -Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file3
> -Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
> -Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
> -attr_name4: 9fd415c49d67afc4b78fad4055a3a376  -
> +attr_name4: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file4
>  touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error
> -Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/extent_file4
> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4
>  attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>  
>  attr_remove: Input/output error
>  Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file4
>  touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error
> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4
>  attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file1
>  touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error
> -Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/remote_file1
> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1
>  attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
>  
>  attr_remove: Input/output error
>  Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file1
>  touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error
> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1
>  attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file2
>  touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error
> -Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
>  attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>  
>  attr_remove: Input/output error
>  Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file2
>  touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error
> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
>  attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/sf_file
>  touch: cannot touch 'SCRATCH_MNT/testdir/sf_file': Input/output error
> -Attribute "attr_name1" has a 64 byte value for SCRATCH_MNT/testdir/sf_file
> -Attribute "attr_name2" has a 17 byte value for SCRATCH_MNT/testdir/sf_file
>  attr_name2: 9a6eb1bc9da3c66a9b495dfe2fe8a756  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/leaf_file
>  touch: cannot touch 'SCRATCH_MNT/testdir/leaf_file': Input/output error
> -Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/leaf_file
> -Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file
> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file
>  attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>  
>  attr_set: Input/output error
>  Could not set "attr_name2" for SCRATCH_MNT/testdir/node_file
>  touch: cannot touch 'SCRATCH_MNT/testdir/node_file': Input/output error
> -Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/node_file
> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/node_file
>  attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>  
>  *** done
> -- 
> 2.34.1
>
Catherine Hoang Aug. 5, 2022, 4:35 p.m. UTC | #2
> On Aug 4, 2022, at 9:32 PM, Darrick J. Wong <djwong@kernel.org> wrote:
> 
> On Thu, Aug 04, 2022 at 05:55:52PM -0700, Catherine Hoang wrote:
>> From: "Darrick J. Wong" <djwong@kernel.org>
>> 
>> Fix this test to work properly when the filesystem block size is less
>> than 4k.  Tripping the error injection points on shape changes in the
>> xattr structure must be done dynamically.
>> 
>> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> 
> Hmm, this patch got its start with things that I wrote...
> 
>> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
>> Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
>> ---
>> tests/xfs/018     | 15 ++++++++++-----
>> tests/xfs/018.out | 43 ++-----------------------------------------
>> 2 files changed, 12 insertions(+), 46 deletions(-)
>> 
>> diff --git a/tests/xfs/018 b/tests/xfs/018
>> index 041a3b24..1b45edf4 100755
>> --- a/tests/xfs/018
>> +++ b/tests/xfs/018
>> @@ -47,7 +47,8 @@ test_attr_replay()
>> 	touch $testfile
>> 
>> 	# Verify attr recovery
>> -	$ATTR_PROG -l $testfile | _filter_scratch
>> +	$ATTR_PROG -l $testfile >> $seqres.full
>> +	echo "Checking contents of $attr_name" >> $seqres.full
>> 	echo -n "$attr_name: "
>> 	$ATTR_PROG -q -g $attr_name $testfile 2> /dev/null | md5sum;
>> 
>> @@ -98,6 +99,10 @@ attr64k="$attr32k$attr32k"
>> echo "*** mkfs"
>> _scratch_mkfs >/dev/null
>> 
>> +blk_sz=$(_scratch_xfs_get_sb_field blocksize)
>> +err_inj_attr_sz=$(( blk_sz / 3 - 50 ))
>> +err_inj_attr_val=$(printf "A%.0s" $(seq $err_inj_attr_sz))
> 
> ...though I think this particular strategy (using attr values that are
> ~1/3 the block size) is novel.  I wonder if this deserves a comment on
> the calculation, though?
> 
> I think the idea here is that we want to build up exactly one attr leaf
> block by setting user.attr_name[1-3]; and then the fourth one is
> guaranteed to cause a split in the fileoff 0 leaf block, which is enough
> to trip both the da_leaf_split and attr_leaf_to_node injectors?
> 
> The reason why we have the same userspace code but two different trip
> points is that we're trying to test recovery from two different points
> in the xattr state machine, right?  So the test code looks identical,
> but we're testing two separate things, right?

The two injection points are used to test recovery at two different states,
and they can both be tripped by the addition of the fourth attribute (which
doesn't fit in the leaf block). So yes to all three questions. Thanks for
reviewing!
> 
> Assuming that all three answers are yes, then I'm satisfied by this new
> approach that is much simpler than the one I came up with:
> 
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> 
> --D
> 
> 
>> +
>> echo "*** mount FS"
>> _scratch_mount
>> 
>> @@ -140,12 +145,12 @@ test_attr_replay extent_file1 "attr_name2" $attr1k "s" "larp"
>> test_attr_replay extent_file1 "attr_name2" $attr1k "r" "larp"
>> 
>> # extent, inject error on split
>> -create_test_file extent_file2 3 $attr1k
>> -test_attr_replay extent_file2 "attr_name4" $attr1k "s" "da_leaf_split"
>> +create_test_file extent_file2 3 $err_inj_attr_val
>> +test_attr_replay extent_file2 "attr_name4" $attr256 "s" "da_leaf_split"
>> 
>> # extent, inject error on fork transition
>> -create_test_file extent_file3 3 $attr1k
>> -test_attr_replay extent_file3 "attr_name4" $attr1k "s" "attr_leaf_to_node"
>> +create_test_file extent_file3 3 $err_inj_attr_val
>> +test_attr_replay extent_file3 "attr_name4" $attr256 "s" "attr_leaf_to_node"
>> 
>> # extent, remote
>> create_test_file extent_file4 1 $attr1k
>> diff --git a/tests/xfs/018.out b/tests/xfs/018.out
>> index 022b0ca3..415ecd7a 100644
>> --- a/tests/xfs/018.out
>> +++ b/tests/xfs/018.out
>> @@ -4,7 +4,6 @@ QA output created by 018
>> attr_set: Input/output error
>> Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file1
>> touch: cannot touch 'SCRATCH_MNT/testdir/empty_file1': Input/output error
>> -Attribute "attr_name" has a 65 byte value for SCRATCH_MNT/testdir/empty_file1
>> attr_name: cfbe2a33be4601d2b655d099a18378fc  -
>> 
>> attr_remove: Input/output error
>> @@ -15,7 +14,6 @@ attr_name: d41d8cd98f00b204e9800998ecf8427e  -
>> attr_set: Input/output error
>> Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file2
>> touch: cannot touch 'SCRATCH_MNT/testdir/empty_file2': Input/output error
>> -Attribute "attr_name" has a 1025 byte value for SCRATCH_MNT/testdir/empty_file2
>> attr_name: 9fd415c49d67afc4b78fad4055a3a376  -
>> 
>> attr_remove: Input/output error
>> @@ -26,7 +24,6 @@ attr_name: d41d8cd98f00b204e9800998ecf8427e  -
>> attr_set: Input/output error
>> Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file3
>> touch: cannot touch 'SCRATCH_MNT/testdir/empty_file3': Input/output error
>> -Attribute "attr_name" has a 65536 byte value for SCRATCH_MNT/testdir/empty_file3
>> attr_name: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>> 
>> attr_remove: Input/output error
>> @@ -37,132 +34,96 @@ attr_name: d41d8cd98f00b204e9800998ecf8427e  -
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file1
>> touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error
>> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1
>> -Attribute "attr_name2" has a 65 byte value for SCRATCH_MNT/testdir/inline_file1
>> attr_name2: cfbe2a33be4601d2b655d099a18378fc  -
>> 
>> attr_remove: Input/output error
>> Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file1
>> touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error
>> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1
>> attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file2
>> touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error
>> -Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/inline_file2
>> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2
>> attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
>> 
>> attr_remove: Input/output error
>> Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file2
>> touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error
>> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2
>> attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file3
>> touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error
>> -Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/inline_file3
>> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3
>> attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>> 
>> attr_remove: Input/output error
>> Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file3
>> touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error
>> -Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3
>> attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file1
>> touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error
>> -Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file1
>> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1
>> attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
>> 
>> attr_remove: Input/output error
>> Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file1
>> touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error
>> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1
>> attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file2
>> touch: cannot touch 'SCRATCH_MNT/testdir/extent_file2': Input/output error
>> -Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file2
>> -Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
>> -Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
>> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
>> -attr_name4: 9fd415c49d67afc4b78fad4055a3a376  -
>> +attr_name4: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file3
>> touch: cannot touch 'SCRATCH_MNT/testdir/extent_file3': Input/output error
>> -Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file3
>> -Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
>> -Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
>> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
>> -attr_name4: 9fd415c49d67afc4b78fad4055a3a376  -
>> +attr_name4: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file4
>> touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error
>> -Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/extent_file4
>> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4
>> attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>> 
>> attr_remove: Input/output error
>> Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file4
>> touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error
>> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4
>> attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file1
>> touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error
>> -Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/remote_file1
>> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1
>> attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
>> 
>> attr_remove: Input/output error
>> Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file1
>> touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error
>> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1
>> attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file2
>> touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error
>> -Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
>> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
>> attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
>> 
>> attr_remove: Input/output error
>> Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file2
>> touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error
>> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
>> attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/sf_file
>> touch: cannot touch 'SCRATCH_MNT/testdir/sf_file': Input/output error
>> -Attribute "attr_name1" has a 64 byte value for SCRATCH_MNT/testdir/sf_file
>> -Attribute "attr_name2" has a 17 byte value for SCRATCH_MNT/testdir/sf_file
>> attr_name2: 9a6eb1bc9da3c66a9b495dfe2fe8a756  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/leaf_file
>> touch: cannot touch 'SCRATCH_MNT/testdir/leaf_file': Input/output error
>> -Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/leaf_file
>> -Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file
>> -Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file
>> attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>> 
>> attr_set: Input/output error
>> Could not set "attr_name2" for SCRATCH_MNT/testdir/node_file
>> touch: cannot touch 'SCRATCH_MNT/testdir/node_file': Input/output error
>> -Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/node_file
>> -Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/node_file
>> attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a  -
>> 
>> *** done
>> -- 
>> 2.34.1
>>
diff mbox series

Patch

diff --git a/tests/xfs/018 b/tests/xfs/018
index 041a3b24..1b45edf4 100755
--- a/tests/xfs/018
+++ b/tests/xfs/018
@@ -47,7 +47,8 @@  test_attr_replay()
 	touch $testfile
 
 	# Verify attr recovery
-	$ATTR_PROG -l $testfile | _filter_scratch
+	$ATTR_PROG -l $testfile >> $seqres.full
+	echo "Checking contents of $attr_name" >> $seqres.full
 	echo -n "$attr_name: "
 	$ATTR_PROG -q -g $attr_name $testfile 2> /dev/null | md5sum;
 
@@ -98,6 +99,10 @@  attr64k="$attr32k$attr32k"
 echo "*** mkfs"
 _scratch_mkfs >/dev/null
 
+blk_sz=$(_scratch_xfs_get_sb_field blocksize)
+err_inj_attr_sz=$(( blk_sz / 3 - 50 ))
+err_inj_attr_val=$(printf "A%.0s" $(seq $err_inj_attr_sz))
+
 echo "*** mount FS"
 _scratch_mount
 
@@ -140,12 +145,12 @@  test_attr_replay extent_file1 "attr_name2" $attr1k "s" "larp"
 test_attr_replay extent_file1 "attr_name2" $attr1k "r" "larp"
 
 # extent, inject error on split
-create_test_file extent_file2 3 $attr1k
-test_attr_replay extent_file2 "attr_name4" $attr1k "s" "da_leaf_split"
+create_test_file extent_file2 3 $err_inj_attr_val
+test_attr_replay extent_file2 "attr_name4" $attr256 "s" "da_leaf_split"
 
 # extent, inject error on fork transition
-create_test_file extent_file3 3 $attr1k
-test_attr_replay extent_file3 "attr_name4" $attr1k "s" "attr_leaf_to_node"
+create_test_file extent_file3 3 $err_inj_attr_val
+test_attr_replay extent_file3 "attr_name4" $attr256 "s" "attr_leaf_to_node"
 
 # extent, remote
 create_test_file extent_file4 1 $attr1k
diff --git a/tests/xfs/018.out b/tests/xfs/018.out
index 022b0ca3..415ecd7a 100644
--- a/tests/xfs/018.out
+++ b/tests/xfs/018.out
@@ -4,7 +4,6 @@  QA output created by 018
 attr_set: Input/output error
 Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file1
 touch: cannot touch 'SCRATCH_MNT/testdir/empty_file1': Input/output error
-Attribute "attr_name" has a 65 byte value for SCRATCH_MNT/testdir/empty_file1
 attr_name: cfbe2a33be4601d2b655d099a18378fc  -
 
 attr_remove: Input/output error
@@ -15,7 +14,6 @@  attr_name: d41d8cd98f00b204e9800998ecf8427e  -
 attr_set: Input/output error
 Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file2
 touch: cannot touch 'SCRATCH_MNT/testdir/empty_file2': Input/output error
-Attribute "attr_name" has a 1025 byte value for SCRATCH_MNT/testdir/empty_file2
 attr_name: 9fd415c49d67afc4b78fad4055a3a376  -
 
 attr_remove: Input/output error
@@ -26,7 +24,6 @@  attr_name: d41d8cd98f00b204e9800998ecf8427e  -
 attr_set: Input/output error
 Could not set "attr_name" for SCRATCH_MNT/testdir/empty_file3
 touch: cannot touch 'SCRATCH_MNT/testdir/empty_file3': Input/output error
-Attribute "attr_name" has a 65536 byte value for SCRATCH_MNT/testdir/empty_file3
 attr_name: 7f6fd1b6d872108bd44bd143cbcdfa19  -
 
 attr_remove: Input/output error
@@ -37,132 +34,96 @@  attr_name: d41d8cd98f00b204e9800998ecf8427e  -
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file1
 touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error
-Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1
-Attribute "attr_name2" has a 65 byte value for SCRATCH_MNT/testdir/inline_file1
 attr_name2: cfbe2a33be4601d2b655d099a18378fc  -
 
 attr_remove: Input/output error
 Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file1
 touch: cannot touch 'SCRATCH_MNT/testdir/inline_file1': Input/output error
-Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file1
 attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file2
 touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error
-Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/inline_file2
-Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2
 attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
 
 attr_remove: Input/output error
 Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file2
 touch: cannot touch 'SCRATCH_MNT/testdir/inline_file2': Input/output error
-Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file2
 attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/inline_file3
 touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error
-Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/inline_file3
-Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3
 attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
 
 attr_remove: Input/output error
 Could not remove "attr_name2" for SCRATCH_MNT/testdir/inline_file3
 touch: cannot touch 'SCRATCH_MNT/testdir/inline_file3': Input/output error
-Attribute "attr_name1" has a 16 byte value for SCRATCH_MNT/testdir/inline_file3
 attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file1
 touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error
-Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file1
-Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1
 attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
 
 attr_remove: Input/output error
 Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file1
 touch: cannot touch 'SCRATCH_MNT/testdir/extent_file1': Input/output error
-Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file1
 attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
 
 attr_set: Input/output error
 Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file2
 touch: cannot touch 'SCRATCH_MNT/testdir/extent_file2': Input/output error
-Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file2
-Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
-Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
-Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file2
-attr_name4: 9fd415c49d67afc4b78fad4055a3a376  -
+attr_name4: f4ea5799d72a0a9bf2d56a685c9cba7a  -
 
 attr_set: Input/output error
 Could not set "attr_name4" for SCRATCH_MNT/testdir/extent_file3
 touch: cannot touch 'SCRATCH_MNT/testdir/extent_file3': Input/output error
-Attribute "attr_name4" has a 1025 byte value for SCRATCH_MNT/testdir/extent_file3
-Attribute "attr_name2" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
-Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
-Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file3
-attr_name4: 9fd415c49d67afc4b78fad4055a3a376  -
+attr_name4: f4ea5799d72a0a9bf2d56a685c9cba7a  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/extent_file4
 touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error
-Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/extent_file4
-Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4
 attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
 
 attr_remove: Input/output error
 Could not remove "attr_name2" for SCRATCH_MNT/testdir/extent_file4
 touch: cannot touch 'SCRATCH_MNT/testdir/extent_file4': Input/output error
-Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/extent_file4
 attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file1
 touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error
-Attribute "attr_name2" has a 1025 byte value for SCRATCH_MNT/testdir/remote_file1
-Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1
 attr_name2: 9fd415c49d67afc4b78fad4055a3a376  -
 
 attr_remove: Input/output error
 Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file1
 touch: cannot touch 'SCRATCH_MNT/testdir/remote_file1': Input/output error
-Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file1
 attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/remote_file2
 touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error
-Attribute "attr_name2" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
-Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
 attr_name2: 7f6fd1b6d872108bd44bd143cbcdfa19  -
 
 attr_remove: Input/output error
 Could not remove "attr_name2" for SCRATCH_MNT/testdir/remote_file2
 touch: cannot touch 'SCRATCH_MNT/testdir/remote_file2': Input/output error
-Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/remote_file2
 attr_name2: d41d8cd98f00b204e9800998ecf8427e  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/sf_file
 touch: cannot touch 'SCRATCH_MNT/testdir/sf_file': Input/output error
-Attribute "attr_name1" has a 64 byte value for SCRATCH_MNT/testdir/sf_file
-Attribute "attr_name2" has a 17 byte value for SCRATCH_MNT/testdir/sf_file
 attr_name2: 9a6eb1bc9da3c66a9b495dfe2fe8a756  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/leaf_file
 touch: cannot touch 'SCRATCH_MNT/testdir/leaf_file': Input/output error
-Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/leaf_file
-Attribute "attr_name3" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file
-Attribute "attr_name1" has a 1024 byte value for SCRATCH_MNT/testdir/leaf_file
 attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a  -
 
 attr_set: Input/output error
 Could not set "attr_name2" for SCRATCH_MNT/testdir/node_file
 touch: cannot touch 'SCRATCH_MNT/testdir/node_file': Input/output error
-Attribute "attr_name2" has a 257 byte value for SCRATCH_MNT/testdir/node_file
-Attribute "attr_name1" has a 65536 byte value for SCRATCH_MNT/testdir/node_file
 attr_name2: f4ea5799d72a0a9bf2d56a685c9cba7a  -
 
 *** done