mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
fstests: Fix tests to execute in multi-block directory config
xfs/{529,531,532,534,535} attempt to create test files after injecting
reduce_max_iextents error tag. Creation of test 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 test files before injecting
reduce_max_iextents error tag.
Reported-by: Darrick J. Wong <djwong@kernel.org>
Suggested-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
committed by
Eryu Guan
parent
f3172bbedc
commit
172b311e6f
+21
-3
@@ -54,6 +54,8 @@ echo "* Delalloc to written extent conversion"
|
||||
|
||||
testfile=$SCRATCH_MNT/testfile
|
||||
|
||||
touch $testfile
|
||||
|
||||
echo "Inject reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 1
|
||||
|
||||
@@ -74,10 +76,18 @@ if (( $nextents > 10 )); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Disable reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 0
|
||||
|
||||
rm $testfile
|
||||
|
||||
echo "* Fallocate unwritten extents"
|
||||
|
||||
touch $testfile
|
||||
|
||||
echo "Inject reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 1
|
||||
|
||||
echo "Fallocate fragmented file"
|
||||
for i in $(seq 0 2 $((nr_blks - 1))); do
|
||||
$XFS_IO_PROG -f -c "falloc $((i * bsize)) $bsize" $testfile \
|
||||
@@ -93,10 +103,18 @@ if (( $nextents > 10 )); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Disable reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 0
|
||||
|
||||
rm $testfile
|
||||
|
||||
echo "* Directio write"
|
||||
|
||||
touch $testfile
|
||||
|
||||
echo "Inject reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 1
|
||||
|
||||
echo "Create fragmented file via directio writes"
|
||||
for i in $(seq 0 2 $((nr_blks - 1))); do
|
||||
$XFS_IO_PROG -d -s -f -c "pwrite $((i * bsize)) $bsize" $testfile \
|
||||
@@ -112,15 +130,15 @@ if (( $nextents > 10 )); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Disable reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 0
|
||||
|
||||
rm $testfile
|
||||
|
||||
# Check if XFS gracefully returns with an error code when we try to increase
|
||||
# extent count of user quota inode beyond the pseudo max extent count limit.
|
||||
echo "* Extend quota inodes"
|
||||
|
||||
echo "Disable reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 0
|
||||
|
||||
echo "Consume free space"
|
||||
fillerdir=$SCRATCH_MNT/fillerdir
|
||||
nr_free_blks=$(stat -f -c '%f' $SCRATCH_MNT)
|
||||
|
||||
+5
-1
@@ -4,14 +4,18 @@ Format and mount fs
|
||||
Inject reduce_max_iextents error tag
|
||||
Create fragmented file
|
||||
Verify $testfile's extent count
|
||||
Disable reduce_max_iextents error tag
|
||||
* Fallocate unwritten extents
|
||||
Inject reduce_max_iextents error tag
|
||||
Fallocate fragmented file
|
||||
Verify $testfile's extent count
|
||||
Disable reduce_max_iextents error tag
|
||||
* Directio write
|
||||
Inject reduce_max_iextents error tag
|
||||
Create fragmented file via directio writes
|
||||
Verify $testfile's extent count
|
||||
* Extend quota inodes
|
||||
Disable reduce_max_iextents error tag
|
||||
* Extend quota inodes
|
||||
Consume free space
|
||||
Create fragmented filesystem
|
||||
Inject reduce_max_iextents error tag
|
||||
|
||||
+8
-3
@@ -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
|
||||
|
||||
|
||||
+8
-1
@@ -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
|
||||
|
||||
+10
-7
@@ -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
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
+6
-3
@@ -45,9 +45,6 @@ bsize=$(_get_file_block_size $SCRATCH_MNT)
|
||||
|
||||
testfile=${SCRATCH_MNT}/testfile
|
||||
|
||||
echo "Inject reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 1
|
||||
|
||||
nr_blks=15
|
||||
|
||||
for io in Buffered Direct; do
|
||||
@@ -62,6 +59,9 @@ for io in Buffered Direct; do
|
||||
xfs_io_flag="-d"
|
||||
fi
|
||||
|
||||
echo "Inject reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 1
|
||||
|
||||
echo "$io write to every other block of fallocated space"
|
||||
for i in $(seq 1 2 $((nr_blks - 1))); do
|
||||
$XFS_IO_PROG -f -s $xfs_io_flag -c "pwrite $((i * bsize)) $bsize" \
|
||||
@@ -76,6 +76,9 @@ for io in Buffered Direct; do
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Disable reduce_max_iextents error tag"
|
||||
_scratch_inject_error reduce_max_iextents 0
|
||||
|
||||
rm $testfile
|
||||
done
|
||||
|
||||
|
||||
+4
-1
@@ -1,11 +1,14 @@
|
||||
QA output created by 534
|
||||
Format and mount fs
|
||||
Inject reduce_max_iextents error tag
|
||||
* Buffered write to unwritten extent
|
||||
Fallocate 15 blocks
|
||||
Inject reduce_max_iextents error tag
|
||||
Buffered write to every other block of fallocated space
|
||||
Verify $testfile's extent count
|
||||
Disable reduce_max_iextents error tag
|
||||
* Direct write to unwritten extent
|
||||
Fallocate 15 blocks
|
||||
Inject reduce_max_iextents error tag
|
||||
Direct write to every other block of fallocated space
|
||||
Verify $testfile's extent count
|
||||
Disable reduce_max_iextents error tag
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user