diff mbox series

[6/6] xfs/535: Fix test to execute in multi-block directory config

Message ID 20210325140857.7145-6-chandanrlinux@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/6] xfs/529: Execute chown on an existing directory entry | expand

Commit Message

Chandan Babu R March 25, 2021, 2:08 p.m. UTC
xfs/535 attempts to create $srcfile and $dstfile after reduce_max_iextents
error tag is injected. Creation of these files fails when using a multi-block
directory test configuration because,
1. A directory can have a pseudo maximum extent count of 10.
2. In the worst case a directory entry creation operation can consume
   (XFS_DA_NODE_MAXDEPTH + 1 + 1) * (Nr fs blocks in a single directory block)
   extents.
   With 1k fs block size and 4k directory block size, this evaluates to,
   (5 + 1 + 1) * 4
   = 7 * 4
   = 28
   > 10 (Pseudo maximum inode extent count).

This commit fixes the issue by creating $srcfile and $dstfile before injecting
reduce_max_iextents error tag.

Reported-by: Darrick J. Wong <djwong@kernel.org>
Suggested-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
---
 tests/xfs/535     | 11 +++++++++++
 tests/xfs/535.out |  2 ++
 2 files changed, 13 insertions(+)

Comments

Darrick J. Wong March 29, 2021, 6:06 p.m. UTC | #1
On Thu, Mar 25, 2021 at 07:38:57PM +0530, Chandan Babu R wrote:
> xfs/535 attempts to create $srcfile and $dstfile after reduce_max_iextents
> error tag is injected. Creation of these files fails when using a multi-block
> directory test configuration because,
> 1. A directory can have a pseudo maximum extent count of 10.
> 2. In the worst case a directory entry creation operation can consume
>    (XFS_DA_NODE_MAXDEPTH + 1 + 1) * (Nr fs blocks in a single directory block)
>    extents.
>    With 1k fs block size and 4k directory block size, this evaluates to,
>    (5 + 1 + 1) * 4
>    = 7 * 4
>    = 28
>    > 10 (Pseudo maximum inode extent count).
> 
> This commit fixes the issue by creating $srcfile and $dstfile before injecting
> reduce_max_iextents error tag.
> 
> Reported-by: Darrick J. Wong <djwong@kernel.org>
> Suggested-by: Darrick J. Wong <djwong@kernel.org>
> Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>

Now on to the xfs/538 regressions! ;)
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/xfs/535     | 11 +++++++++++
>  tests/xfs/535.out |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/tests/xfs/535 b/tests/xfs/535
> index 2d82624c..f2a8a3a5 100755
> --- a/tests/xfs/535
> +++ b/tests/xfs/535
> @@ -51,6 +51,9 @@ nr_blks=15
>  srcfile=${SCRATCH_MNT}/srcfile
>  dstfile=${SCRATCH_MNT}/dstfile
>  
> +touch $srcfile
> +touch $dstfile
> +
>  echo "Inject reduce_max_iextents error tag"
>  _scratch_inject_error reduce_max_iextents 1
>  
> @@ -77,10 +80,18 @@ if (( $nextents > 10 )); then
>  	exit 1
>  fi
>  
> +echo "Disable reduce_max_iextents error tag"
> +_scratch_inject_error reduce_max_iextents 0
> +
>  rm $dstfile
>  
>  echo "* Funshare shared extent"
>  
> +touch $dstfile
> +
> +echo "Inject reduce_max_iextents error tag"
> +_scratch_inject_error reduce_max_iextents 1
> +
>  echo "Share the extent with \$dstfile"
>  _reflink $srcfile $dstfile >> $seqres.full
>  
> diff --git a/tests/xfs/535.out b/tests/xfs/535.out
> index 4383e921..8f600272 100644
> --- a/tests/xfs/535.out
> +++ b/tests/xfs/535.out
> @@ -6,7 +6,9 @@ Create a $srcfile having an extent of length 15 blocks
>  Share the extent with $dstfile
>  Buffered write to every other block of $dstfile's shared extent
>  Verify $dstfile's extent count
> +Disable reduce_max_iextents error tag
>  * Funshare shared extent
> +Inject reduce_max_iextents error tag
>  Share the extent with $dstfile
>  Funshare every other block of $dstfile's shared extent
>  Verify $dstfile's extent count
> -- 
> 2.29.2
>
Chandan Babu R March 30, 2021, 3:49 a.m. UTC | #2
On 29 Mar 2021 at 23:36, Darrick J. Wong wrote:
> On Thu, Mar 25, 2021 at 07:38:57PM +0530, Chandan Babu R wrote:
>> xfs/535 attempts to create $srcfile and $dstfile after reduce_max_iextents
>> error tag is injected. Creation of these files fails when using a multi-block
>> directory test configuration because,
>> 1. A directory can have a pseudo maximum extent count of 10.
>> 2. In the worst case a directory entry creation operation can consume
>>    (XFS_DA_NODE_MAXDEPTH + 1 + 1) * (Nr fs blocks in a single directory block)
>>    extents.
>>    With 1k fs block size and 4k directory block size, this evaluates to,
>>    (5 + 1 + 1) * 4
>>    = 7 * 4
>>    = 28
>>    > 10 (Pseudo maximum inode extent count).
>> 
>> This commit fixes the issue by creating $srcfile and $dstfile before injecting
>> reduce_max_iextents error tag.
>> 
>> Reported-by: Darrick J. Wong <djwong@kernel.org>
>> Suggested-by: Darrick J. Wong <djwong@kernel.org>
>> Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
>
> Now on to the xfs/538 regressions! ;)

Yup, I am working on them.

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

Thanks for the review! I will fold patches 2 to 6 into a single patch and
repost.
diff mbox series

Patch

diff --git a/tests/xfs/535 b/tests/xfs/535
index 2d82624c..f2a8a3a5 100755
--- a/tests/xfs/535
+++ b/tests/xfs/535
@@ -51,6 +51,9 @@  nr_blks=15
 srcfile=${SCRATCH_MNT}/srcfile
 dstfile=${SCRATCH_MNT}/dstfile
 
+touch $srcfile
+touch $dstfile
+
 echo "Inject reduce_max_iextents error tag"
 _scratch_inject_error reduce_max_iextents 1
 
@@ -77,10 +80,18 @@  if (( $nextents > 10 )); then
 	exit 1
 fi
 
+echo "Disable reduce_max_iextents error tag"
+_scratch_inject_error reduce_max_iextents 0
+
 rm $dstfile
 
 echo "* Funshare shared extent"
 
+touch $dstfile
+
+echo "Inject reduce_max_iextents error tag"
+_scratch_inject_error reduce_max_iextents 1
+
 echo "Share the extent with \$dstfile"
 _reflink $srcfile $dstfile >> $seqres.full
 
diff --git a/tests/xfs/535.out b/tests/xfs/535.out
index 4383e921..8f600272 100644
--- a/tests/xfs/535.out
+++ b/tests/xfs/535.out
@@ -6,7 +6,9 @@  Create a $srcfile having an extent of length 15 blocks
 Share the extent with $dstfile
 Buffered write to every other block of $dstfile's shared extent
 Verify $dstfile's extent count
+Disable reduce_max_iextents error tag
 * Funshare shared extent
+Inject reduce_max_iextents error tag
 Share the extent with $dstfile
 Funshare every other block of $dstfile's shared extent
 Verify $dstfile's extent count