On Thu, Mar 25, 2021 at 07:38:54PM +0530, Chandan Babu R wrote: > 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@xxxxxxxxxx> > Suggested-by: Darrick J. Wong <djwong@xxxxxxxxxx> > Signed-off-by: Chandan Babu R <chandanrlinux@xxxxxxxxx> Much better, Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> --D > --- > 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 >