FSTests Archive on lore.kernel.org
 help / color / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Chandan Babu R <chandanrlinux@gmail.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 4/6] xfs/532: Fix test to execute in multi-block directory config
Date: Mon, 29 Mar 2021 11:05:59 -0700
Message-ID: <20210329180559.GD4090233@magnolia> (raw)
In-Reply-To: <20210325140857.7145-4-chandanrlinux@gmail.com>

On Thu, Mar 25, 2021 at 07:38:55PM +0530, Chandan Babu R wrote:
> xfs/532 attempts to create $testfile after reduce_max_iextents error tag is
> injected. Creation of $testfile 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 $testfile 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>

Looks ok (and like Eryu says, this could all have been one large patch),
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/xfs/532     | 17 ++++++++++-------
>  tests/xfs/532.out |  6 +++---
>  2 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/xfs/532 b/tests/xfs/532
> index 1c789217..2bed574a 100755
> --- a/tests/xfs/532
> +++ b/tests/xfs/532
> @@ -63,9 +63,6 @@ for dentry in $(ls -1 $fillerdir/); do
>  	$here/src/punch-alternating $fillerdir/$dentry >> $seqres.full
>  done
>  
> -echo "Inject reduce_max_iextents error tag"
> -_scratch_inject_error reduce_max_iextents 1
> -
>  echo "Inject bmap_alloc_minlen_extent error tag"
>  _scratch_inject_error bmap_alloc_minlen_extent 1
>  
> @@ -74,6 +71,9 @@ echo "* Set xattrs"
>  echo "Create \$testfile"
>  touch $testfile
>  
> +echo "Inject reduce_max_iextents error tag"
> +_scratch_inject_error reduce_max_iextents 1
> +
>  echo "Create xattrs"
>  nr_attrs=$((bsize * 20 / attr_len))
>  for i in $(seq 1 $nr_attrs); do
> @@ -90,6 +90,9 @@ if (( $naextents > 10 )); then
>  	exit 1
>  fi
>  
> +echo "Disable reduce_max_iextents error tag"
> +_scratch_inject_error reduce_max_iextents 0
> +
>  echo "Remove \$testfile"
>  rm $testfile
>  
> @@ -98,9 +101,6 @@ echo "* Remove xattrs"
>  echo "Create \$testfile"
>  touch $testfile
>  
> -echo "Disable reduce_max_iextents error tag"
> -_scratch_inject_error reduce_max_iextents 0
> -
>  echo "Create initial xattr extents"
>  
>  naextents=0
> @@ -132,7 +132,10 @@ if [[ $? == 0 ]]; then
>  	exit 1
>  fi
>  
> -rm $testfile && echo "Successfully removed \$testfile"
> +echo "Disable reduce_max_iextents error tag"
> +_scratch_inject_error reduce_max_iextents 0
> +
> +rm $testfile
>  
>  # success, all done
>  status=0
> diff --git a/tests/xfs/532.out b/tests/xfs/532.out
> index 8e19d7bc..db52108f 100644
> --- a/tests/xfs/532.out
> +++ b/tests/xfs/532.out
> @@ -2,17 +2,17 @@ QA output created by 532
>  Format and mount fs
>  Consume free space
>  Create fragmented filesystem
> -Inject reduce_max_iextents error tag
>  Inject bmap_alloc_minlen_extent error tag
>  * Set xattrs
>  Create $testfile
> +Inject reduce_max_iextents error tag
>  Create xattrs
>  Verify $testfile's naextent count
> +Disable reduce_max_iextents error tag
>  Remove $testfile
>  * Remove xattrs
>  Create $testfile
> -Disable reduce_max_iextents error tag
>  Create initial xattr extents
>  Inject reduce_max_iextents error tag
>  Remove xattr to trigger -EFBIG
> -Successfully removed $testfile
> +Disable reduce_max_iextents error tag
> -- 
> 2.29.2
> 

  reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 14:08 [PATCH 1/6] xfs/529: Execute chown on an existing directory entry Chandan Babu R
2021-03-25 14:08 ` [PATCH 2/6] xfs/529: Fix test to execute in multi-block directory config Chandan Babu R
2021-03-28 16:49   ` Eryu Guan
2021-03-29 16:20   ` Darrick J. Wong
2021-03-25 14:08 ` [PATCH 3/6] xfs/531: " Chandan Babu R
2021-03-29 18:05   ` Darrick J. Wong
2021-03-25 14:08 ` [PATCH 4/6] xfs/532: " Chandan Babu R
2021-03-29 18:05   ` Darrick J. Wong [this message]
2021-03-25 14:08 ` [PATCH 5/6] xfs/534: " Chandan Babu R
2021-03-29 18:06   ` Darrick J. Wong
2021-03-25 14:08 ` [PATCH 6/6] xfs/535: " Chandan Babu R
2021-03-29 18:06   ` Darrick J. Wong
2021-03-30  3:49     ` Chandan Babu R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210329180559.GD4090233@magnolia \
    --to=djwong@kernel.org \
    --cc=chandanrlinux@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

FSTests Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/fstests/0 fstests/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 fstests fstests/ https://lore.kernel.org/fstests \
		fstests@vger.kernel.org
	public-inbox-index fstests

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.fstests


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git