linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Cc: Chandan Babu R <chandanrlinux@gmail.com>,
	"Darrick J . Wong" <djwong@kernel.org>
Subject: [PATCH 3/6] xfs/531: Fix test to execute in multi-block directory config
Date: Thu, 25 Mar 2021 19:38:54 +0530	[thread overview]
Message-ID: <20210325140857.7145-3-chandanrlinux@gmail.com> (raw)
In-Reply-To: <20210325140857.7145-1-chandanrlinux@gmail.com>

xfs/531 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>
---
 tests/xfs/531     | 11 ++++++++---
 tests/xfs/531.out |  9 ++++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/xfs/531 b/tests/xfs/531
index caec7848..935c52b0 100755
--- a/tests/xfs/531
+++ b/tests/xfs/531
@@ -49,13 +49,15 @@ nr_blks=30
 
 testfile=$SCRATCH_MNT/testfile
 
-echo "Inject reduce_max_iextents error tag"
-_scratch_inject_error reduce_max_iextents 1
-
 for op in fpunch finsert fcollapse fzero; do
 	echo "* $op regular file"
 
 	echo "Create \$testfile"
+	touch $testfile
+
+	echo "Inject reduce_max_iextents error tag"
+	_scratch_inject_error reduce_max_iextents 1
+
 	$XFS_IO_PROG -f -s \
 		     -c "pwrite -b $((nr_blks * bsize)) 0 $((nr_blks * bsize))" \
 		     $testfile  >> $seqres.full
@@ -75,6 +77,9 @@ for op in fpunch finsert fcollapse fzero; do
 		exit 1
 	fi
 
+	echo "Disable reduce_max_iextents error tag"
+	_scratch_inject_error reduce_max_iextents 0
+
 	rm $testfile
 done
 
diff --git a/tests/xfs/531.out b/tests/xfs/531.out
index f85776c9..6ac90787 100644
--- a/tests/xfs/531.out
+++ b/tests/xfs/531.out
@@ -1,19 +1,26 @@
 QA output created by 531
 Format and mount fs
-Inject reduce_max_iextents error tag
 * fpunch regular file
 Create $testfile
+Inject reduce_max_iextents error tag
 fpunch alternating blocks
 Verify $testfile's extent count
+Disable reduce_max_iextents error tag
 * finsert regular file
 Create $testfile
+Inject reduce_max_iextents error tag
 finsert alternating blocks
 Verify $testfile's extent count
+Disable reduce_max_iextents error tag
 * fcollapse regular file
 Create $testfile
+Inject reduce_max_iextents error tag
 fcollapse alternating blocks
 Verify $testfile's extent count
+Disable reduce_max_iextents error tag
 * fzero regular file
 Create $testfile
+Inject reduce_max_iextents error tag
 fzero alternating blocks
 Verify $testfile's extent count
+Disable reduce_max_iextents error tag
-- 
2.29.2


  parent reply	other threads:[~2021-03-25 14:10 UTC|newest]

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 ` Chandan Babu R [this message]
2021-03-29 18:05   ` [PATCH 3/6] xfs/531: " Darrick J. Wong
2021-03-25 14:08 ` [PATCH 4/6] xfs/532: " Chandan Babu R
2021-03-29 18:05   ` Darrick J. Wong
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=20210325140857.7145-3-chandanrlinux@gmail.com \
    --to=chandanrlinux@gmail.com \
    --cc=djwong@kernel.org \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).