xfstests: misc reflink test fixes
cover xfstests: misc reflink test fixes
Hi all,
The following patchset enable the use of xfstests to test reflink functionality under ocfs2. The first patch tests the ability to reflink into and out of inline-data files on ocfs2. Patches 2-6 fix various problems with the tests that came up when qualifying ocfs2.
The last patch maliciously corrupts ext4 and xfs filesystems to exploit nonexistent checking of i_size in order to coerce Linux into loading a file with negative size. It then exploits integer overflows in the VFS writeback code to hard lock the kernel. Don't run the tests in this patch ({shared,xfs}/40[01]) unless you have a fixed kernel (4.10)
Comments and questions are, as always, welcome.
--D
PATCH 1/7 ocfs2: test reflinking to inline data files
Make sure that we can handle reflinking from and to inline-data files.
--- common/reflink | 2 + tests/ocfs2/001 | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/ocfs2/001.out | 14 ++++++++ tests/ocfs2/Makefile | 20 +++++++++++ tests/ocfs2/group | 1 + 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100755 tests/ocfs2/001 create mode 100644 tests/ocfs2/001.out create mode 100644 tests/ocfs2/Makefile create mode 100644 tests/ocfs2/group
common/reflink +1 -1
@@ -206,7 +206,7 @@ _cp_reflink() { file1="$1" file2="$2" - cp --reflink=always -p "$file1" "$file2" + cp --reflink=always -p -f "$file1" "$file2" } # Reflink some file1 into file2
tests/ocfs2/001 new file +88 -0
88 lines not on this page · raw message
tests/ocfs2/001.out new file +14 -0
@@ -0,0 +1,14 @@ +QA output created by 001 +Format and mount +Create the original files +reflink into the start of file2 +reflink past the stuff in file3 +reflink an inline-data file to a regular one +reflink an inline-data file to another inline-data file +Verify the whole mess +2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-001/file1 +2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-001/file2 +4e68a2e24b6b0f386ab39d01d902293d SCRATCH_MNT/test-001/file3 +009520053b00386d1173f3988c55d192 SCRATCH_MNT/test-001/file4 +009520053b00386d1173f3988c55d192 SCRATCH_MNT/test-001/file5 +009520053b00386d1173f3988c55d192 SCRATCH_MNT/test-001/file6
tests/ocfs2/Makefile new file +20 -0
@@ -0,0 +1,20 @@ +# +# Copyright (c) 2017 Oracle. All Rights Reserved. +# + +TOPDIR = ../.. +include $(TOPDIR)/include/builddefs + +OCFS2_DIR = ocfs2 +TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(OCFS2_DIR) + +include $(BUILDRULES) + +install: + $(INSTALL) -m 755 -d $(TARGET_DIR) + $(INSTALL) -m 755 $(TESTS) $(TARGET_DIR) + $(INSTALL) -m 644 group $(TARGET_DIR) + $(INSTALL) -m 644 $(OUTFILES) $(TARGET_DIR) + +# Nothing. +install-dev install-lib:
tests/ocfs2/group new file +1 -0
@@ -0,0 +1 @@ +001 auto quick clone
PATCH 2/7 common: add leading underscore to get_block_size
In reply to Darrick J. WongAdd a leading underscore to the get_block_size helper since it's a common function.
--- common/attr | 4 ++-- common/defrag | 2 +- common/filter | 4 ++-- common/punch | 2 +- common/rc | 4 ++-- tests/btrfs/017 | 2 +- tests/btrfs/052 | 2 +- tests/btrfs/055 | 2 +- tests/btrfs/056 | 2 +- tests/btrfs/094 | 2 +- tests/btrfs/095 | 2 +- tests/btrfs/096 | 2 +- tests/btrfs/097 | 2 +- tests/btrfs/098 | 2 +- tests/btrfs/103 | 2 +- tests/generic/017 | 2 +- tests/generic/064 | 2 +- tests/generic/150 | 2 +- tests/generic/151 | 2 +- tests/generic/152 | 2 +- tests/generic/153 | 2 +- tests/generic/154 | 2 +- tests/generic/155 | 2 +- tests/generic/156 | 2 +- tests/generic/157 | 2 +- tests/generic/158 | 2 +- tests/generic/159 | 2 +- tests/generic/160 | 2 +- tests/generic/171 | 2 +- tests/generic/172 | 2 +- tests/generic/173 | 2 +- tests/generic/174 | 2 +- tests/generic/175 | 2 +- tests/generic/176 | 2 +- tests/generic/205 | 2 +- tests/generic/206 | 2 +- tests/generic/216 | 2 +- tests/generic/217 | 2 +- tests/generic/218 | 2 +- tests/generic/220 | 2 +- tests/generic/222 | 2 +- tests/generic/227 | 2 +- tests/generic/229 | 2 +- tests/generic/238 | 2 +- tests/generic/240 | 2 +- tests/generic/242 | 2 +- tests/generic/243 | 2 +- tests/generic/256 | 2 +- tests/generic/273 | 2 +- tests/generic/296 | 2 +- tests/generic/297 | 2 +- tests/generic/298 | 2 +- tests/generic/301 | 2 +- tests/generic/302 | 2 +- tests/generic/308 | 2 +- tests/generic/391 | 2 +- tests/shared/298 | 2 +- tests/xfs/127 | 2 +- tests/xfs/128 | 2 +- tests/xfs/129 | 2 +- tests/xfs/132 | 2 +- tests/xfs/139 | 2 +- tests/xfs/140 | 2 +- tests/xfs/169 | 2 +- tests/xfs/180 | 2 +- tests/xfs/182 | 2 +- tests/xfs/184 | 2 +- tests/xfs/192 | 2 +- tests/xfs/193 | 2 +- tests/xfs/198 | 2 +- tests/xfs/200 | 2 +- tests/xfs/204 | 2 +- tests/xfs/208 | 2 +- tests/xfs/211 | 2 +- tests/xfs/215 | 2 +- tests/xfs/218 | 2 +- tests/xfs/219 | 2 +- tests/xfs/221 | 2 +- tests/xfs/223 | 2 +- tests/xfs/224 | 2 +- tests/xfs/225 | 2 +- tests/xfs/226 | 2 +- tests/xfs/228 | 2 +- tests/xfs/230 | 2 +- tests/xfs/231 | 2 +- tests/xfs/232 | 2 +- tests/xfs/233 | 2 +- tests/xfs/234 | 2 +- tests/xfs/236 | 2 +- tests/xfs/265 | 2 +- tests/xfs/309 | 2 +- tests/xfs/310 | 4 ++-- tests/xfs/328 | 2 +- tests/xfs/331 | 2 +- tests/xfs/335 | 2 +- tests/xfs/336 | 2 +- tests/xfs/337 | 2 +- tests/xfs/341 | 2 +- tests/xfs/342 | 2 +- tests/xfs/344 | 2 +- tests/xfs/345 | 2 +- tests/xfs/346 | 2 +- tests/xfs/347 | 2 +- 103 files changed, 107 insertions(+), 107 deletions(-)
common/attr +2 -2
@@ -257,7 +257,7 @@ _sort_getfattr_output() if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then MAX_ATTRS=1000 else # Assume max ~1 block of attrs - BLOCK_SIZE=`get_block_size $TEST_DIR` + BLOCK_SIZE=`_get_block_size $TEST_DIR` # user.attribute_XXX="value.XXX" is about 32 bytes; leave some overhead let MAX_ATTRS=$BLOCK_SIZE/40 fi
@@ -268,7 +268,7 @@ export MAX_ATTRS if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then MAX_ATTRVAL_SIZE=64 else # Assume max ~1 block of attrs - BLOCK_SIZE=`get_block_size $TEST_DIR` + BLOCK_SIZE=`_get_block_size $TEST_DIR` # leave a little overhead let MAX_ATTRVAL_SIZE=$BLOCK_SIZE-256 fi
common/defrag +1 -1
@@ -29,7 +29,7 @@ _require_defrag() ext4|ext4dev) testfile="$TEST_DIR/$$-test.defrag" donorfile="$TEST_DIR/$$-donor.defrag" - bsize=`get_block_size $TEST_DIR` + bsize=`_get_block_size $TEST_DIR` $XFS_IO_PROG -f -c "pwrite -b $bsize 0 $bsize" $testfile > /dev/null cp $testfile $donorfile echo $testfile | $here/src/e4compact -v -f $donorfile | \
common/filter +2 -2
@@ -265,7 +265,7 @@ _filter_xfs_io_units_modified() _filter_xfs_io_blocks_modified() { - BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) _filter_xfs_io_units_modified "Block" $BLOCK_SIZE }
@@ -383,7 +383,7 @@ _filter_ro_mount() { _filter_od() { - BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) $AWK_PROG -v block_size=$BLOCK_SIZE ' /^[0-9]+/ { offset = strtonum("0"$1);
common/punch +1 -1
@@ -584,7 +584,7 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - block_size=`get_block_size $TEST_DIR` + block_size=`_get_block_size $TEST_DIR` $XFS_IO_PROG -f -c "truncate $block_size" \ -c "pwrite 0 $block_size" $sync_cmd \ -c "$zero_cmd 128 128" \
common/rc +2 -2
@@ -3077,10 +3077,10 @@ _sysfs_dev() echo /sys/dev/block/$_maj:$_min } -get_block_size() +_get_block_size() { if [ -z $1 ] || [ ! -d $1 ]; then - echo "Missing mount point argument for get_block_size" + echo "Missing mount point argument for _get_block_size" exit 1 fi echo `stat -f -c %S $1`
tests/btrfs/017 +1 -1
@@ -62,7 +62,7 @@ rm -f $seqres.full _scratch_mkfs "--nodesize 65536" >>$seqres.full 2>&1 _scratch_mount -BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) +BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) EXTENT_SIZE=$((2 * $BLOCK_SIZE)) $XFS_IO_PROG -f -d -c "pwrite 0 $EXTENT_SIZE" $SCRATCH_MNT/foo \
tests/btrfs/052 +1 -1
@@ -58,7 +58,7 @@ test_btrfs_clone_same_file() _scratch_mkfs >/dev/null 2>&1 _scratch_mount $MOUNT_OPTIONS - BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) EXTENT_SIZE=$((2 * $BLOCK_SIZE))
tests/btrfs/055 +1 -1
@@ -59,7 +59,7 @@ test_btrfs_clone_with_holes() _scratch_mkfs "$1" >/dev/null 2>&1 _scratch_mount - BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) EXTENT_SIZE=$((2 * $BLOCK_SIZE))
tests/btrfs/056 +1 -1
@@ -67,7 +67,7 @@ test_btrfs_clone_fsync_log_recover() MOUNT_OPTIONS="$MOUNT_OPTIONS $2" _mount_flakey - BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) EXTENT_SIZE=$((2 * $BLOCK_SIZE))
tests/btrfs/094 +1 -1
@@ -66,7 +66,7 @@ mkdir $send_files_dir _scratch_mkfs >>$seqres.full 2>&1 _scratch_mount "-o compress" -BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) +BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) # Create the file with a single extent of 32 blocks. This creates a metadata # file extent item with a data start offset of 0 and a logical length of
tests/btrfs/095 +1 -1
@@ -62,7 +62,7 @@ _scratch_mkfs >>$seqres.full 2>&1 _init_flakey _mount_flakey -BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) +BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) # Create prealloc extent covering file block range [40, 155[ $XFS_IO_PROG -f -c "falloc $((40 * $BLOCK_SIZE)) $((115 * $BLOCK_SIZE))" \
tests/btrfs/096 +1 -1
@@ -50,7 +50,7 @@ rm -f $seqres.full _scratch_mkfs >>$seqres.full 2>&1 _scratch_mount -BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) +BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) # Create our test files. File foo has the same 2k of data at offset $BLOCK_SIZE # as file bar has at its offset 0.
tests/btrfs/097 +1 -1
@@ -56,7 +56,7 @@ mkdir $send_files_dir _scratch_mkfs >>$seqres.full 2>&1 _scratch_mount -BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) +BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) # Create our test file with a single extent of 16 blocks starting at a file # offset mapped by 32nd block.
tests/btrfs/098 +1 -1
@@ -57,7 +57,7 @@ _scratch_mkfs >>$seqres.full 2>&1 _init_flakey _mount_flakey -BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) +BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) # Create our test file with a single 25 block extent starting at file offset # mapped by 200th block We fsync the file here to make the fsync log tree get a
tests/btrfs/103 +1 -1
@@ -55,7 +55,7 @@ test_clone_and_read_compressed_extent() _scratch_mkfs >>$seqres.full 2>&1 _scratch_mount $mount_opts - BLOCK_SIZE=$(get_block_size $SCRATCH_MNT) + BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) # Create a test file with a single extent that is compressed (the # data we write into it is highly compressible no matter which
tests/generic/017 +1 -1
@@ -53,7 +53,7 @@ _scratch_mount testfile=$SCRATCH_MNT/$seq.$$ BLOCKS=10240 -BSIZE=`get_block_size $SCRATCH_MNT` +BSIZE=`_get_block_size $SCRATCH_MNT` length=$(($BLOCKS * $BSIZE))
tests/generic/064 +1 -1
@@ -49,7 +49,7 @@ _require_xfs_io_command "fcollapse" src=$SCRATCH_MNT/testfile dest=$SCRATCH_MNT/testfile.dest BLOCKS=100 -BSIZE=`get_block_size $SCRATCH_MNT` +BSIZE=`_get_block_size $SCRATCH_MNT` rm -f $seqres.full _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
tests/generic/150 +1 -1
@@ -55,7 +55,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin='15%' sz=$((blksz * blks))
tests/generic/151 +1 -1
@@ -59,7 +59,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin='15%' sz=$((blksz * blks))
tests/generic/152 +1 -1
@@ -60,7 +60,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin='15%' sz=$((blksz * blks))
tests/generic/153 +1 -1
@@ -60,7 +60,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin='15%' sz=$((blksz * blks))
tests/generic/154 +1 -1
@@ -59,7 +59,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin='15%' free_blocks0=$(stat -f $testdir -c '%f')
tests/generic/155 +1 -1
@@ -64,7 +64,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin='15%' sz=$((blksz * blks))
tests/generic/156 +1 -1
@@ -67,7 +67,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin='15%' sz=$((blksz * blks))
tests/generic/157 +1 -1
@@ -60,7 +60,7 @@ testdir2=$SCRATCH_MNT/test-$seq mkdir $testdir2 echo "Create the original files" -blksz="$(get_block_size $testdir1)" +blksz="$(_get_block_size $testdir1)" blks=1000 margin='7%' sz=$((blksz * blks))
tests/generic/158 +1 -1
@@ -60,7 +60,7 @@ testdir2=$SCRATCH_MNT/test-$seq mkdir $testdir2 echo "Create the original files" -blksz="$(get_block_size $testdir1)" +blksz="$(_get_block_size $testdir1)" blks=1000 margin='7%' sz=$((blksz * blks))
tests/generic/159 +1 -1
@@ -54,7 +54,7 @@ rm -rf $testdir1 mkdir $testdir1 echo "Create the original files" -blksz="$(get_block_size $testdir1)" +blksz="$(_get_block_size $testdir1)" blks=1000 margin='7%' sz=$((blksz * blks))
tests/generic/160 +1 -1
@@ -54,7 +54,7 @@ rm -rf $testdir1 mkdir $testdir1 echo "Create the original files" -blksz="$(get_block_size $testdir1)" +blksz="$(_get_block_size $testdir1)" blks=1000 margin='7%' sz=$((blksz * blks))
tests/generic/171 +1 -1
@@ -58,7 +58,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Reformat with appropriate size" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=10240 umount $SCRATCH_MNT sz_bytes=$((nr_blks * 8 * blksz))
tests/generic/172 +1 -1
@@ -58,7 +58,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Reformat with appropriate size" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" umount $SCRATCH_MNT file_size=$((168 * 1024 * 1024))
tests/generic/173 +1 -1
@@ -58,7 +58,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Reformat with appropriate size" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=10240 umount $SCRATCH_MNT sz_bytes=$((nr_blks * 8 * blksz))
tests/generic/174 +1 -1
@@ -59,7 +59,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Reformat with appropriate size" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=10240 umount $SCRATCH_MNT sz_bytes=$((nr_blks * 8 * blksz))
tests/generic/175 +1 -1
@@ -56,7 +56,7 @@ testdir="$SCRATCH_MNT/test-$seq" mkdir "$testdir" echo "Create a one block file" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" _pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full" fnr=19
tests/generic/176 +1 -1
@@ -60,7 +60,7 @@ mkdir "$testdir" # 2^17 blocks... that should be plenty for anyone. fnr=20 free_blocks=$(stat -f -c '%a' "$testdir") -blksz=$(get_block_size "$testdir") +blksz=$(_get_block_size "$testdir") space_avail=$((free_blocks * blksz)) calc_space() { blocks_needed=$(( 2 ** (fnr + 1) ))
tests/generic/205 +1 -1
@@ -60,7 +60,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/206 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/216 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/217 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/218 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/220 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/222 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/227 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/229 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." runtest() {
tests/generic/238 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." runtest() {
tests/generic/240 +1 -1
@@ -62,7 +62,7 @@ rm -f $seqres.full rm -f $TEST_DIR/aiodio_sparse logical_block_size=`_min_dio_alignment $TEST_DEV` -fs_block_size=`get_block_size $TEST_DIR` +fs_block_size=`_get_block_size $TEST_DIR` file_size=$((8 * $fs_block_size)) if [ $fs_block_size -le $logical_block_size ]; then
tests/generic/242 +1 -1
@@ -65,7 +65,7 @@ bufnr=1280 bufsize=$((blksz * bufnr)) free_blocks=$(stat -f -c '%a' $testdir) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) space_needed=$(((filesize * 3) * 5 / 4)) space_avail=$((free_blocks * real_blksz)) test $space_needed -gt $space_avail && _notrun "Not enough space. $space_avail < $space_needed"
tests/generic/243 +1 -1
@@ -66,7 +66,7 @@ bufnr=1280 bufsize=$((blksz * bufnr)) free_blocks=$(stat -f -c '%a' $testdir) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) space_needed=$(((filesize * 3) * 5 / 4)) space_avail=$((free_blocks * real_blksz)) test $space_needed -gt $space_avail && _notrun "Not enough space. $space_avail < $space_needed"
tests/generic/256 +1 -1
@@ -117,7 +117,7 @@ _scratch_mount # Test must be able to write files with non-root permissions chmod 777 $SCRATCH_MNT -block_size=`get_block_size $SCRATCH_MNT` +block_size=`_get_block_size $SCRATCH_MNT` _test_full_fs_punch $(( $block_size * 2 )) $block_size 500 $SCRATCH_MNT/252.$$ $block_size status=0 ; exit
tests/generic/273 +1 -1
@@ -106,7 +106,7 @@ _do_workload() { _pids="" _pid=1 - block_size=$(get_block_size $SCRATCH_MNT) + block_size=$(_get_block_size $SCRATCH_MNT) _threads_set _file_create $block_size
tests/generic/296 +1 -1
@@ -61,7 +61,7 @@ filesize=$((blksz * nr)) bufnr=16 bufsize=$((blksz * bufnr)) -real_blksz=$(get_block_size "$testdir") +real_blksz=$(_get_block_size "$testdir") _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) echo "Create the original files"
tests/generic/297 +1 -1
@@ -59,7 +59,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create a one block file" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" _pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full fnr=26 # 2^26 reflink extents should be enough to find a slow op?
tests/generic/298 +1 -1
@@ -59,7 +59,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create a one block file" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" _pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full fnr=26 # 2^26 reflink extents should be enough to find a slow op?
tests/generic/301 +1 -1
@@ -65,7 +65,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/generic/302 +1 -1
@@ -66,7 +66,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/generic/308 +1 -1
@@ -49,7 +49,7 @@ _require_test rm -f $seqres.full echo "Silence is golden" -block_size=`get_block_size $TEST_DIR` +block_size=`_get_block_size $TEST_DIR` # On unpatched ext4, if an extent exists which includes the block right # before the maximum file offset, and the block for the maximum file offset
tests/generic/391 +1 -1
@@ -54,7 +54,7 @@ _require_test _require_xfs_io_command "falloc" _require_test_program "dio-interleaved" -extent_size="$(($(get_block_size "$TEST_DIR") * 2))" +extent_size="$(($(_get_block_size "$TEST_DIR") * 2))" num_extents=1024 testfile="$TEST_DIR/$$-testfile"
tests/shared/298 +1 -1
@@ -165,7 +165,7 @@ echo "done." echo -n "Comparing holes to the reported space from FS..." # Get block size -block_size=$(get_block_size $loop_mnt/) +block_size=$(_get_block_size $loop_mnt/) sectors_per_block=`expr $block_size / 512` # Obtain free space from filesystem
tests/xfs/127 +1 -1
@@ -55,7 +55,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create the original file and reflink to copy1, copy2" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" _pwrite_byte 0x61 0 $((blksz * 14 + 71)) $testdir/original >> $seqres.full _cp_reflink $testdir/original $testdir/copy1 _cp_reflink $testdir/copy1 $testdir/copy2
tests/xfs/128 +1 -1
@@ -60,7 +60,7 @@ echo "Create the original file and reflink to file2, file3" blks=2000 margin=160 blksz=65536 -real_blksz="$(get_block_size $testdir)" +real_blksz="$(_get_block_size $testdir)" blksz_factor=$((blksz / real_blksz)) _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file2
tests/xfs/129 +1 -1
@@ -59,7 +59,7 @@ mkdir $testdir metadump_file=$TEST_DIR/${seq}_metadump echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=$((4 * blksz / 12)) _pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
tests/xfs/132 +1 -1
@@ -72,7 +72,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" blks=2000 margin=100 sz=$((blksz * blks))
tests/xfs/139 +1 -1
@@ -54,7 +54,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" echo "Create the original files" sz=$((48 * 1048576))
tests/xfs/140 +1 -1
@@ -54,7 +54,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -blksz=$(get_block_size $testdir) +blksz=$(_get_block_size $testdir) echo "Create the original files" sz=$((48 * 1048576))
tests/xfs/169 +1 -1
@@ -57,7 +57,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=$((8 * blksz / 12)) for i in 1 2 x; do
tests/xfs/180 +1 -1
@@ -68,7 +68,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/182 +1 -1
@@ -69,7 +69,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/184 +1 -1
@@ -69,7 +69,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/192 +1 -1
@@ -70,7 +70,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/193 +1 -1
@@ -67,7 +67,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/198 +1 -1
@@ -68,7 +68,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/200 +1 -1
@@ -71,7 +71,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/204 +1 -1
@@ -72,7 +72,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/208 +1 -1
@@ -71,7 +71,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/211 +1 -1
@@ -69,7 +69,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 2 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/215 +1 -1
@@ -66,7 +66,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/218 +1 -1
@@ -65,7 +65,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/219 +1 -1
@@ -66,7 +66,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/221 +1 -1
@@ -65,7 +65,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/223 +1 -1
@@ -67,7 +67,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/224 +1 -1
@@ -66,7 +66,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/225 +1 -1
@@ -66,7 +66,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/226 +1 -1
@@ -65,7 +65,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/228 +1 -1
@@ -72,7 +72,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/230 +1 -1
@@ -72,7 +72,7 @@ echo "Create the original files" blksz=65536 nr=64 filesize=$((blksz * nr)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) $XFS_IO_PROG -c "cowextsize $((blksz * 16))" $testdir >> $seqres.full _weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full
tests/xfs/231 +1 -1
@@ -72,7 +72,7 @@ bufnr=2 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/232 +1 -1
@@ -73,7 +73,7 @@ bufnr=2 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/233 +1 -1
@@ -53,7 +53,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create the original files" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" _pwrite_byte 0x61 0 $((blksz * 14 + 71)) $testdir/original >> $seqres.full cp -p $testdir/original $testdir/copy1 cp -p $testdir/copy1 $testdir/copy2
tests/xfs/234 +1 -1
@@ -59,7 +59,7 @@ mkdir $testdir metadump_file=$TEST_DIR/${seq}_metadump echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=$((4 * blksz / 12)) _pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full sync
tests/xfs/236 +1 -1
@@ -57,7 +57,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=$((8 * blksz / 12)) for i in 1 2 x; do
tests/xfs/265 +1 -1
@@ -59,7 +59,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=$((2 * blksz / 12)) for i in 1 2 x; do
tests/xfs/309 +1 -1
@@ -59,7 +59,7 @@ testdir=$SCRATCH_MNT/test-$seq mkdir $testdir echo "Create the original file blocks" -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" nr_blks=$((2 * blksz / 12)) for i in 1 2 x; do
tests/xfs/310 +2 -2
@@ -58,7 +58,7 @@ _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full testdir=$SCRATCH_MNT/test-$seq -blksz="$(get_block_size $SCRATCH_MNT)" +blksz="$(_get_block_size $SCRATCH_MNT)" umount $SCRATCH_MNT
@@ -72,7 +72,7 @@ xfs_info $SCRATCH_MNT >> $seqres.full echo "Create the original file blocks" mkdir $testdir -blksz="$(get_block_size $testdir)" +blksz="$(_get_block_size $testdir)" $XFS_IO_PROG -f -c "falloc 0 $((nr_blks * blksz))" $testdir/file1 >> $seqres.full echo "Check extent count"
tests/xfs/328 +1 -1
@@ -62,7 +62,7 @@ mkdir "$testdir" # 2^10 blocks... that should be plenty for anyone. fnr=$((12 + LOAD_FACTOR)) free_blocks=$(stat -f -c '%a' "$testdir") -blksz=$(get_block_size $testdir) +blksz=$(_get_block_size $testdir) space_avail=$((free_blocks * blksz)) calc_space() {
tests/xfs/331 +1 -1
@@ -55,7 +55,7 @@ _scratch_mkfs > "$seqres.full" 2>&1 echo "+ mount fs image" _scratch_mount -blksz="$(get_block_size $SCRATCH_MNT)" +blksz="$(_get_block_size $SCRATCH_MNT)" # btree header is 56 bytes; an rmapbt record is 24 bytes; and # a rmapbt key/pointer pair is 44 bytes.
tests/xfs/335 +1 -1
@@ -54,7 +54,7 @@ _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs cat $tmp.mkfs > "$seqres.full" 2>&1 _scratch_mount -blksz="$(get_block_size $SCRATCH_MNT)" +blksz="$(_get_block_size $SCRATCH_MNT)" echo "Create a three-level rtrmapbt" # inode core size is at least 176 bytes; btree header is 56 bytes;
tests/xfs/336 +1 -1
@@ -54,7 +54,7 @@ _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs cat $tmp.mkfs > "$seqres.full" 2>&1 _scratch_mount -blksz="$(get_block_size $SCRATCH_MNT)" +blksz="$(_get_block_size $SCRATCH_MNT)" metadump_file=$TEST_DIR/${seq}_metadump rm -rf $metadump_file
tests/xfs/337 +1 -1
@@ -57,7 +57,7 @@ cat $tmp.mkfs > "$seqres.full" 2>&1 echo "+ mount fs image" _scratch_mount -blksz="$(get_block_size $SCRATCH_MNT)" +blksz="$(_get_block_size $SCRATCH_MNT)" # inode core size is at least 176 bytes; btree header is 56 bytes; # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
tests/xfs/341 +1 -1
@@ -54,7 +54,7 @@ _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs cat $tmp.mkfs > "$seqres.full" 2>&1 _scratch_mount -blksz="$(get_block_size $SCRATCH_MNT)" +blksz="$(_get_block_size $SCRATCH_MNT)" # inode core size is at least 176 bytes; btree header is 56 bytes; # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
tests/xfs/342 +1 -1
@@ -53,7 +53,7 @@ _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs cat $tmp.mkfs > "$seqres.full" 2>&1 _scratch_mount -blksz="$(get_block_size $SCRATCH_MNT)" +blksz="$(_get_block_size $SCRATCH_MNT)" # inode core size is at least 176 bytes; btree header is 56 bytes; # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
tests/xfs/344 +1 -1
@@ -70,7 +70,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/345 +1 -1
@@ -68,7 +68,7 @@ bufnr=16 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/346 +1 -1
@@ -70,7 +70,7 @@ bufnr=8 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
tests/xfs/347 +1 -1
@@ -69,7 +69,7 @@ bufnr=8 bufsize=$((blksz * bufnr)) _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4)) -real_blksz=$(get_block_size $testdir) +real_blksz=$(_get_block_size $testdir) internal_blks=$((filesize / real_blksz)) echo "Create the original files"
Re: [PATCH 2/7] common: add leading underscore to get_block_size
Quoted 4 lines · Darrick J. Wong
Add a leading underscore to the
get_block_sizehelper since it's a common function.Signed-off-by Darrick J. Wong <[email protected]>
There's a new user of get_block_size, after latest fstests update, btrfs/012. I can fold the btrfs/012 update to this patch.
Thanks for doing this!
Eryu
Re: [PATCH 2/7] common: add leading underscore to get_block_size
Quoted 8 lines · Eryu Guan
Quoted 4 lines · Darrick J. Wong
Add a leading underscore to the
get_block_sizehelper since it's a common function.Signed-off-by Darrick J. Wong <[email protected]>There's a new user of
get_block_size, after latest fstests update, btrfs/012. I can fold the btrfs/012 update to this patch.
Ok. Assuming you've already done this, I won't repost this patch.
(Though if I end up reposting the whole series then the patch in the new series will of course have a diff for btrfs/012.)
--D
Quoted 8 lines
Thanks for doing this!
Eryu
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/7 ocfs2/reflink: fix file block size reporting
In reply to Darrick J. WongSome of the reflink tests try to require a specific filesystem block size so that they can test file block manipulation functions. That's straightforward for most filesystems but ocfs2 throws in the additional twist that data fork block mappings are stored in units of clusters, not blocks, which causes these reflink tests to fail.
Therefore, introduce a new helper that retrieves the file minimum block size and adapt the reflink tests to use that instead.
---
v2: Add a leading underscore to the helper name.
--- common/rc | 21 +++++++++++++++++++-- tests/generic/205 | 2 +- tests/generic/206 | 2 +- tests/generic/216 | 2 +- tests/generic/217 | 2 +- tests/generic/218 | 2 +- tests/generic/220 | 2 +- tests/generic/222 | 2 +- tests/generic/227 | 2 +- tests/generic/229 | 2 +- tests/generic/238 | 2 +- 11 files changed, 29 insertions(+), 12 deletions(-)
common/rc +19 -2
@@ -973,7 +973,7 @@ _scratch_mkfs_blocksized() ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV ;; ocfs2) - yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV + yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
@@ -3077,13 +3077,30 @@ _sysfs_dev() echo /sys/dev/block/$_maj:$_min } +# Get the minimum block size of a file. Usually this is the +# minimum fs block size, but some filesystems (ocfs2) do block +# mappings in larger units. +_get_file_block_size() +{ + if [ -z $1 ] || [ ! -d $1 ]; then + echo "Missing mount point argument for _get_file_block_size" + exit 1 + fi + if [ "$FSTYP" = "ocfs2" ]; then + stat -c '%o' $1 + else + _get_block_size $1 + fi +} + +# Get the minimum block size of an fs. _get_block_size() { if [ -z $1 ] || [ ! -d $1 ]; then echo "Missing mount point argument for _get_block_size" exit 1 fi - echo `stat -f -c %S $1` + stat -f -c %S $1 } get_page_size()
tests/generic/205 +1 -1
@@ -60,7 +60,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/206 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/216 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/217 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/218 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/220 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/222 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/227 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." echo "Create the original files"
tests/generic/229 +1 -1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." runtest() {
tests/generic/238 +1 -1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq mkdir $testdir -real_blksz=$(_get_block_size $testdir) +real_blksz=$(_get_file_block_size $testdir) test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." runtest() {
PATCH 4/7 reflink: fix quota tests to work properly
In reply to Darrick J. WongFix the reflink quota tests to su to the fsgqa user so that we actually test enforcement of quotas. Seems that XFS enforces user quotas even if root is writing to a user file, whereas everything else lets root writes through. Also clean up some of the variable usage and _require_user.
---
v2: Refactor the quota block reporting into a helper function and port all the existing tests. Fix "fsgqa"/$qa_user usage too.
--- common/quota | 10 ++++++++++ tests/generic/305 | 22 ++++++++++------------ tests/generic/305.out | 30 +++++++++++++++--------------- tests/generic/326 | 22 ++++++++++------------ tests/generic/326.out | 30 +++++++++++++++--------------- tests/generic/327 | 19 +++++++++---------- tests/generic/327.out | 12 ++++++------ tests/generic/328 | 29 ++++++++++++++--------------- tests/generic/328.out | 28 ++++++++++++++-------------- tests/xfs/213 | 22 ++++++++++------------ tests/xfs/213.out | 30 +++++++++++++++--------------- tests/xfs/214 | 22 ++++++++++------------ tests/xfs/214.out | 30 +++++++++++++++--------------- 13 files changed, 153 insertions(+), 153 deletions(-)
common/quota +10 -0
@@ -302,5 +302,15 @@ _check_quota_usage() } } +# Report the block usage of root, $qa_user, and nobody +_report_quota_blocks() { + repquota $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}' +} + +# Report the inode usage of root, $qa_user, and nobody +_report_quota_inodes() { + repquota $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}' +} + # make sure this script returns success /bin/true
tests/generic/305 +10 -12
@@ -49,10 +49,8 @@ _require_cp_reflink _require_fiemap _require_quota _require_nobody +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -73,27 +71,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks echo "CoW one of the files" $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks # success, all done status=0
tests/generic/305.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 305 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
tests/generic/326 +10 -12
@@ -50,10 +50,8 @@ _require_fiemap _require_quota _require_nobody _require_odirect +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -74,27 +72,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks echo "CoW one of the files" $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks # success, all done status=0
tests/generic/326.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 326 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
tests/generic/327 +9 -10
@@ -48,10 +48,8 @@ _require_cp_reflink _require_fiemap _require_quota _require_nobody +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -67,20 +65,21 @@ mkdir $testdir sz=1048576 echo "Create the original files" $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full -chown fsgqa $testdir/file1 +chown $qa_user $testdir/file1 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks _scratch_cycle_mount +quotaon $SCRATCH_MNT 2> /dev/null echo "Set hard quota to prevent third reflink" -setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT -_repquota +setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT +_report_quota_blocks echo "Try to reflink again" touch $testdir/file3 -chown fsgqa $testdir/file3 -_cp_reflink $testdir/file1 $testdir/file3 2>&1 | _filter_scratch -_repquota +chown $qa_user $testdir/file3 +su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch +_report_quota_blocks # success, all done status=0
tests/generic/327.out +6 -6
@@ -1,12 +1,12 @@ QA output created by 327 Format and mount Create the original files -root -- 0 0 0 4 0 0 -fsgqa -- 2048 0 0 2 0 0 +root 0 0 0 +fsgqa 2048 0 0 Set hard quota to prevent third reflink -root -- 0 0 0 4 0 0 -fsgqa +- 2048 0 1024 2 0 0 +root 0 0 0 +fsgqa 2048 0 1024 Try to reflink again cp: failed to clone 'SCRATCH_MNT/test-327/file3' from 'SCRATCH_MNT/test-327/file1': Disk quota exceeded -root -- 0 0 0 4 0 0 -fsgqa +- 2048 0 1024 3 0 0 +root 0 0 0 +fsgqa 2048 0 1024
tests/generic/328 +14 -15
@@ -49,10 +49,8 @@ _require_fiemap _require_quota _require_nobody _require_odirect +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -68,39 +66,40 @@ mkdir $testdir sz=1048576 echo "Create the original files" $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full -chown fsgqa $testdir/file1 +chown $qa_user $testdir/file1 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full -_repquota +_report_quota_blocks _scratch_cycle_mount +quotaon $SCRATCH_MNT 2> /dev/null echo "Set hard quota to prevent rewrite" -setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT -_repquota +setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT +_report_quota_blocks echo "Try to dio write the whole file" -_pwrite_byte 0x62 0 $sz $testdir/file1 -d 2>&1 >> $seqres.full | \ +su $qa_user -c '$XFS_IO_PROG -d -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \ _filter_xfs_io_error -_repquota +_report_quota_blocks echo "Try to write the whole file" -_pwrite_byte 0x62 0 $sz $testdir/file1 2>&1 >> $seqres.full | \ +su $qa_user -c '$XFS_IO_PROG -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \ _filter_xfs_io_error -_repquota +_report_quota_blocks echo "Set hard quota to allow rewrite" -setquota -u fsgqa 0 8192 0 0 $SCRATCH_MNT -_repquota +setquota -u $qa_user 0 8192 0 0 $SCRATCH_MNT +_report_quota_blocks echo "Try to dio write the whole file" _pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full sync -_repquota +_report_quota_blocks echo "Try to write the whole file" _pwrite_byte 0x62 0 $sz $testdir/file3 >> $seqres.full sync -_repquota +_report_quota_blocks # success, all done status=0
tests/generic/328.out +14 -14
@@ -1,25 +1,25 @@ QA output created by 328 Format and mount Create the original files -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 0 3 0 0 +root 0 0 0 +fsgqa 3072 0 0 Set hard quota to prevent rewrite -root -- 0 0 0 4 0 0 -fsgqa +- 3072 0 1024 3 0 0 +root 0 0 0 +fsgqa 3072 0 1024 Try to dio write the whole file pwrite: Disk quota exceeded -root -- 0 0 0 4 0 0 -fsgqa +- 3072 0 1024 3 0 0 +root 0 0 0 +fsgqa 3072 0 1024 Try to write the whole file pwrite: Disk quota exceeded -root -- 0 0 0 4 0 0 -fsgqa +- 3072 0 1024 3 0 0 +root 0 0 0 +fsgqa 3072 0 1024 Set hard quota to allow rewrite -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 8192 3 0 0 +root 0 0 0 +fsgqa 3072 0 8192 Try to dio write the whole file -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 8192 3 0 0 +root 0 0 0 +fsgqa 3072 0 8192 Try to write the whole file -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 8192 3 0 0 +root 0 0 0 +fsgqa 3072 0 8192
tests/xfs/213 +10 -12
@@ -52,10 +52,8 @@ _require_fiemap _require_quota _require_nobody _require_xfs_io_command "cowextsize" +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -78,27 +76,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks echo "CoW one of the files" $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks # success, all done status=0
tests/xfs/213.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 213 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3520 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3520 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
tests/xfs/214 +10 -12
@@ -53,10 +53,8 @@ _require_quota _require_nobody _require_xfs_io_command "cowextsize" _require_odirect +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -79,27 +77,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks echo "CoW one of the files" $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks # success, all done status=0
tests/xfs/214.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 214 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3520 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3520 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
Re: [PATCH 4/7] reflink: fix quota tests to work properly
Quoted 35 lines · Darrick J. Wong
Fix the reflink quota tests to su to the fsgqa user so that we actually test enforcement of quotas. Seems that XFS enforces user quotas even if root is writing to a user file, whereas everything else lets root writes through. Also clean up some of the variable usage and
_require_user.Signed-off-by Darrick J. Wong <[email protected]>---
v2: Refactor the quota block reporting into a helper function and port all the existing tests. Fix "fsgqa"/$qa_user usage too.--- common/quota | 10 ++++++++++ tests/generic/305 | 22 ++++++++++------------ tests/generic/305.out | 30 +++++++++++++++--------------- tests/generic/326 | 22 ++++++++++------------ tests/generic/326.out | 30 +++++++++++++++--------------- tests/generic/327 | 19 +++++++++---------- tests/generic/327.out | 12 ++++++------ tests/generic/328 | 29 ++++++++++++++--------------- tests/generic/328.out | 28 ++++++++++++++-------------- tests/xfs/213 | 22 ++++++++++------------ tests/xfs/213.out | 30 +++++++++++++++--------------- tests/xfs/214 | 22 ++++++++++------------ tests/xfs/214.out | 30 +++++++++++++++--------------- 13 files changed, 153 insertions(+), 153 deletions(-)common/quota +0
-0@@ -302,5 +302,15 @@ _check_quota_usage() } }
common/quota _check_quota_usage() · line 314
Quoted 10 lines
common/quota +10
-0+# Report the block usage of root, $qa_user, and nobody +_report_quota_blocks() { + repquota $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}' +} + +# Report the inode usage of root, $qa_user, and nobody +_report_quota_inodes() { + repquota $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}' +} +
Name them as _scratch_report_quota_blocks|inodes ? Since they're assuming mount point is SCRATCH_MNT. Or take the mount point as the first argument?
Thanks,
Eryu
Re: [PATCH 4/7] reflink: fix quota tests to work properly
Quoted 36 lines · Eryu Guan
Quoted 35 lines · Darrick J. Wong
Fix the reflink quota tests to su to the fsgqa user so that we actually test enforcement of quotas. Seems that XFS enforces user quotas even if root is writing to a user file, whereas everything else lets root writes through. Also clean up some of the variable usage and
_require_user.Signed-off-by Darrick J. Wong <[email protected]>---
v2: Refactor the quota block reporting into a helper function and port all the existing tests. Fix "fsgqa"/$qa_user usage too.--- common/quota | 10 ++++++++++ tests/generic/305 | 22 ++++++++++------------ tests/generic/305.out | 30 +++++++++++++++--------------- tests/generic/326 | 22 ++++++++++------------ tests/generic/326.out | 30 +++++++++++++++--------------- tests/generic/327 | 19 +++++++++---------- tests/generic/327.out | 12 ++++++------ tests/generic/328 | 29 ++++++++++++++--------------- tests/generic/328.out | 28 ++++++++++++++-------------- tests/xfs/213 | 22 ++++++++++------------ tests/xfs/213.out | 30 +++++++++++++++--------------- tests/xfs/214 | 22 ++++++++++------------ tests/xfs/214.out | 30 +++++++++++++++--------------- 13 files changed, 153 insertions(+), 153 deletions(-)common/quota +0
-0@@ -302,5 +302,15 @@ _check_quota_usage() } }
Quoted 14 lines
common/quota _check_quota_usage() · line 314
Quoted 10 lines
common/quota +10
-0+# Report the block usage of root, $qa_user, and nobody +_report_quota_blocks() { + repquota $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}' +} + +# Report the inode usage of root, $qa_user, and nobody +_report_quota_inodes() { + repquota $SCRATCH_MNT | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}' +} +Name them as _scratch_report_quota_blocks|inodes ? Since they're assuming mount point is
SCRATCH_MNT. Or take the mount point as the first argument?
Ok, changed to require a mountpoint as a first arg.
--D
Quoted 7 lines
Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/7 reflink: fix quota tests to work properly
In reply to Darrick J. WongFix the reflink quota tests to su to the fsgqa user so that we actually test enforcement of quotas. Seems that XFS enforces user quotas even if root is writing to a user file, whereas everything else lets root writes through. Also clean up some of the variable usage and _require_user.
---
v2: Refactor the quota block reporting into a helper function and port all the existing tests. Fix "fsgqa"/$qa_user usage too.
v3: _report_quota_* should take a mountpoint as an argument.
--- common/quota | 10 ++++++++++ tests/generic/305 | 22 ++++++++++------------ tests/generic/305.out | 30 +++++++++++++++--------------- tests/generic/326 | 22 ++++++++++------------ tests/generic/326.out | 30 +++++++++++++++--------------- tests/generic/327 | 19 +++++++++---------- tests/generic/327.out | 12 ++++++------ tests/generic/328 | 29 ++++++++++++++--------------- tests/generic/328.out | 28 ++++++++++++++-------------- tests/xfs/213 | 22 ++++++++++------------ tests/xfs/213.out | 30 +++++++++++++++--------------- tests/xfs/214 | 22 ++++++++++------------ tests/xfs/214.out | 30 +++++++++++++++--------------- 13 files changed, 153 insertions(+), 153 deletions(-)
common/quota +10 -0
@@ -302,5 +302,15 @@ _check_quota_usage() } } +# Report the block usage of root, $qa_user, and nobody +_report_quota_blocks() { + repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $3, $4, $5}' +} + +# Report the inode usage of root, $qa_user, and nobody +_report_quota_inodes() { + repquota $1 | egrep "^($qa_user|root|nobody)" | awk '{print $1, $6, $7, $8}' +} + # make sure this script returns success /bin/true
tests/generic/305 +10 -12
@@ -49,10 +49,8 @@ _require_cp_reflink _require_fiemap _require_quota _require_nobody +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -73,27 +71,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks $SCRATCH_MNT _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks $SCRATCH_MNT echo "CoW one of the files" $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks $SCRATCH_MNT # success, all done status=0
tests/generic/305.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 305 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
tests/generic/326 +10 -12
@@ -50,10 +50,8 @@ _require_fiemap _require_quota _require_nobody _require_odirect +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -74,27 +72,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks $SCRATCH_MNT _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks $SCRATCH_MNT echo "CoW one of the files" $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $((sz/2)) 0 $((sz/2))" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks $SCRATCH_MNT # success, all done status=0
tests/generic/326.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 326 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
tests/generic/327 +9 -10
@@ -48,10 +48,8 @@ _require_cp_reflink _require_fiemap _require_quota _require_nobody +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -67,20 +65,21 @@ mkdir $testdir sz=1048576 echo "Create the original files" $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full -chown fsgqa $testdir/file1 +chown $qa_user $testdir/file1 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks $SCRATCH_MNT _scratch_cycle_mount +quotaon $SCRATCH_MNT 2> /dev/null echo "Set hard quota to prevent third reflink" -setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT -_repquota +setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT +_report_quota_blocks $SCRATCH_MNT echo "Try to reflink again" touch $testdir/file3 -chown fsgqa $testdir/file3 -_cp_reflink $testdir/file1 $testdir/file3 2>&1 | _filter_scratch -_repquota +chown $qa_user $testdir/file3 +su $qa_user -c "cp --reflink=always -f $testdir/file1 $testdir/file3" 2>&1 | _filter_scratch +_report_quota_blocks $SCRATCH_MNT # success, all done status=0
tests/generic/327.out +6 -6
@@ -1,12 +1,12 @@ QA output created by 327 Format and mount Create the original files -root -- 0 0 0 4 0 0 -fsgqa -- 2048 0 0 2 0 0 +root 0 0 0 +fsgqa 2048 0 0 Set hard quota to prevent third reflink -root -- 0 0 0 4 0 0 -fsgqa +- 2048 0 1024 2 0 0 +root 0 0 0 +fsgqa 2048 0 1024 Try to reflink again cp: failed to clone 'SCRATCH_MNT/test-327/file3' from 'SCRATCH_MNT/test-327/file1': Disk quota exceeded -root -- 0 0 0 4 0 0 -fsgqa +- 2048 0 1024 3 0 0 +root 0 0 0 +fsgqa 2048 0 1024
tests/generic/328 +14 -15
@@ -49,10 +49,8 @@ _require_fiemap _require_quota _require_nobody _require_odirect +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -68,39 +66,40 @@ mkdir $testdir sz=1048576 echo "Create the original files" $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full -chown fsgqa $testdir/file1 +chown $qa_user $testdir/file1 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full -_repquota +_report_quota_blocks $SCRATCH_MNT _scratch_cycle_mount +quotaon $SCRATCH_MNT 2> /dev/null echo "Set hard quota to prevent rewrite" -setquota -u fsgqa 0 1024 0 0 $SCRATCH_MNT -_repquota +setquota -u $qa_user 0 1024 0 0 $SCRATCH_MNT +_report_quota_blocks $SCRATCH_MNT echo "Try to dio write the whole file" -_pwrite_byte 0x62 0 $sz $testdir/file1 -d 2>&1 >> $seqres.full | \ +su $qa_user -c '$XFS_IO_PROG -d -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \ _filter_xfs_io_error -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Try to write the whole file" -_pwrite_byte 0x62 0 $sz $testdir/file1 2>&1 >> $seqres.full | \ +su $qa_user -c '$XFS_IO_PROG -c "pwrite 0 '$((sz+65536))'" '$testdir'/file1' 2>&1 >> $seqres.full | \ _filter_xfs_io_error -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Set hard quota to allow rewrite" -setquota -u fsgqa 0 8192 0 0 $SCRATCH_MNT -_repquota +setquota -u $qa_user 0 8192 0 0 $SCRATCH_MNT +_report_quota_blocks $SCRATCH_MNT echo "Try to dio write the whole file" _pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full sync -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Try to write the whole file" _pwrite_byte 0x62 0 $sz $testdir/file3 >> $seqres.full sync -_repquota +_report_quota_blocks $SCRATCH_MNT # success, all done status=0
tests/generic/328.out +14 -14
@@ -1,25 +1,25 @@ QA output created by 328 Format and mount Create the original files -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 0 3 0 0 +root 0 0 0 +fsgqa 3072 0 0 Set hard quota to prevent rewrite -root -- 0 0 0 4 0 0 -fsgqa +- 3072 0 1024 3 0 0 +root 0 0 0 +fsgqa 3072 0 1024 Try to dio write the whole file pwrite: Disk quota exceeded -root -- 0 0 0 4 0 0 -fsgqa +- 3072 0 1024 3 0 0 +root 0 0 0 +fsgqa 3072 0 1024 Try to write the whole file pwrite: Disk quota exceeded -root -- 0 0 0 4 0 0 -fsgqa +- 3072 0 1024 3 0 0 +root 0 0 0 +fsgqa 3072 0 1024 Set hard quota to allow rewrite -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 8192 3 0 0 +root 0 0 0 +fsgqa 3072 0 8192 Try to dio write the whole file -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 8192 3 0 0 +root 0 0 0 +fsgqa 3072 0 8192 Try to write the whole file -root -- 0 0 0 4 0 0 -fsgqa -- 3072 0 8192 3 0 0 +root 0 0 0 +fsgqa 3072 0 8192
tests/xfs/213 +10 -12
@@ -52,10 +52,8 @@ _require_fiemap _require_quota _require_nobody _require_xfs_io_command "cowextsize" +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -78,27 +76,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks $SCRATCH_MNT _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks $SCRATCH_MNT echo "CoW one of the files" $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks $SCRATCH_MNT # success, all done status=0
tests/xfs/213.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 213 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3520 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3520 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
tests/xfs/214 +10 -12
@@ -53,10 +53,8 @@ _require_quota _require_nobody _require_xfs_io_command "cowextsize" _require_odirect +_require_user -_repquota() { - repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' -} rm -f $seqres.full echo "Format and mount"
@@ -79,27 +77,27 @@ _cp_reflink $testdir/file1 $testdir/file3 >> $seqres.full touch $testdir/urk chown nobody $testdir/urk touch $testdir/erk -chown fsgqa $testdir/erk -_repquota +chown $qa_user $testdir/erk +_report_quota_blocks $SCRATCH_MNT _scratch_cycle_mount echo "Change file ownership" -chown fsgqa $testdir/file1 -chown fsgqa $testdir/file2 -chown fsgqa $testdir/file3 -_repquota +chown $qa_user $testdir/file1 +chown $qa_user $testdir/file2 +chown $qa_user $testdir/file3 +_report_quota_blocks $SCRATCH_MNT echo "CoW one of the files" $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $blksz $((sz - blksz)) $blksz" -c "fsync" $testdir/file2 >> $seqres.full -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Remount the FS to see if accounting changes" _scratch_cycle_mount -_repquota +_report_quota_blocks $SCRATCH_MNT echo "Chown one of the files" chown nobody $testdir/file3 -_repquota +_report_quota_blocks $SCRATCH_MNT # success, all done status=0
tests/xfs/214.out +15 -15
@@ -1,22 +1,22 @@ QA output created by 214 Format and mount Create the original files -root -- 3072 0 0 7 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 0 0 0 1 0 0 +root 3072 0 0 +nobody 0 0 0 +fsgqa 0 0 0 Change file ownership -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 CoW one of the files -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3520 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3520 0 0 Remount the FS to see if accounting changes -root -- 0 0 0 4 0 0 -nobody -- 0 0 0 1 0 0 -fsgqa -- 3072 0 0 4 0 0 +root 0 0 0 +nobody 0 0 0 +fsgqa 3072 0 0 Chown one of the files -root -- 0 0 0 4 0 0 -nobody -- 1024 0 0 2 0 0 -fsgqa -- 2048 0 0 3 0 0 +root 0 0 0 +nobody 1024 0 0 +fsgqa 2048 0 0
PATCH 5/7 reflink: make error reporting consistent when simulating EIO
In reply to Darrick J. WongWhen we're using dm-error to simulate failed devices, we don't really know if the write or the fdatasync is going to receive the EIO. For tests that make a single (failed) write attempt and never retry, it's sufficient to check that the file md5 doesn't change after recovery. For tests that /do/ retry the write, we should capture the entire output and just look for the word error instead of enshrining the exact perror message (filename/function call and everything) in the golden output.
--- tests/generic/265 | 6 +++++- tests/generic/265.out | 1 - tests/generic/266 | 5 ++++- tests/generic/266.out | 1 - tests/generic/267 | 2 +- tests/generic/268 | 5 ++++- tests/generic/268.out | 1 - tests/generic/271 | 5 +++-- tests/generic/271.out | 1 - tests/generic/272 | 5 +++-- tests/generic/272.out | 1 - tests/generic/276 | 2 +- tests/generic/276.out | 1 - tests/generic/278 | 5 +++-- tests/generic/278.out | 1 - tests/generic/279 | 4 ++-- tests/generic/279.out | 1 - tests/generic/281 | 4 ++-- tests/generic/281.out | 1 - tests/generic/282 | 3 +-- tests/generic/283 | 6 ++++-- tests/generic/283.out | 1 - 22 files changed, 33 insertions(+), 29 deletions(-)
tests/generic/265 +5 -1
@@ -80,7 +80,11 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \ + -c "fdatasync" $testdir/file2 2>&1) +echo $urk >> $seqres.full +echo "$urk" | grep -q "error" || _fail "pwrite did not fail" + _dmerror_load_working_table _dmerror_unmount _dmerror_mount
tests/generic/265.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-265/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-265/file2 CoW and unmount -fdatasync: Input/output error Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-265/file1 Check for damage
tests/generic/266 +4 -1
@@ -80,7 +80,10 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \ + -c "fdatasync" $testdir/file2 2>&1) +echo $urk >> $seqres.full +echo "$urk" | grep -q "error" || _fail "pwrite did not fail" echo "Clean up the mess" _dmerror_unmount
tests/generic/266.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-266/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-266/file2 CoW and unmount -fdatasync: Input/output error Clean up the mess Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-266/file1
tests/generic/267 +1 -1
@@ -80,7 +80,7 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1 _dmerror_load_working_table rm -rf $testdir/file2 >> $seqres.full 2>&1 _dmerror_unmount
tests/generic/268 +4 -1
@@ -81,7 +81,10 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" -c "fdatasync" $testdir/file2 >> $seqres.full +urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \ + -c "fdatasync" $testdir/file2 2>&1) +echo $urk >> $seqres.full +echo "$urk" | grep -q "error" || _fail "pwrite did not fail" _dmerror_load_working_table echo "Rewrite"
tests/generic/268.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-268/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-268/file2 CoW and unmount -fdatasync: Input/output error Rewrite Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-268/file1
tests/generic/271 +3 -2
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \ - 2>&1 >> $seqres.full | _filter_xfs_io_error +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1) +echo $urk >> $seqres.full +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail" _dmerror_load_working_table _dmerror_unmount _dmerror_mount
tests/generic/271.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-271/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-271/file2 CoW and unmount -pwrite: Input/output error Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-271/file1 Check for damage
tests/generic/272 +3 -2
@@ -81,8 +81,9 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \ - 2>&1 >> $seqres.full | _filter_xfs_io_error +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1) +echo $urk >> $seqres.full +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail" echo "Clean up the mess" _dmerror_unmount
tests/generic/272.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-272/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-272/file2 CoW and unmount -pwrite: Input/output error Clean up the mess Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-272/file1
tests/generic/276 +1 -1
@@ -82,7 +82,7 @@ echo "CoW and unmount" sync _dmerror_load_error_table $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \ - 2>&1 >> $seqres.full | _filter_xfs_io_error + >> $seqres.full 2>&1 _dmerror_load_working_table rm -rf $testdir/file2 >> $seqres.full 2>&1 _dmerror_unmount
tests/generic/276.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-276/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-276/file2 CoW and unmount -pwrite: Input/output error Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-276/file1 Check for damage
tests/generic/278 +3 -2
@@ -82,8 +82,9 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \ - 2>&1 >> $seqres.full | _filter_xfs_io_error +urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1) +echo $urk >> $seqres.full +echo "$urk" | grep -q "error" || _fail "dio pwrite did not fail" _dmerror_load_working_table echo "Rewrite"
tests/generic/278.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-278/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-278/file2 CoW and unmount -pwrite: Input/output error Rewrite Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-278/file1
tests/generic/279 +2 -2
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1) -cat $TEST_DIR/mwrite.out | tee -a $seqres.full +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \ + -c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1 _dmerror_load_working_table _dmerror_unmount _dmerror_mount
tests/generic/279.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-279/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-279/file2 CoW and unmount -msync: Input/output error Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-279/file1 Check for damage
tests/generic/281 +2 -2
@@ -80,8 +80,8 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1) -cat $TEST_DIR/mwrite.out | tee -a $seqres.full +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \ + -c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1 echo "Clean up the mess" _dmerror_unmount
tests/generic/281.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-281/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-281/file2 CoW and unmount -msync: Input/output error Clean up the mess Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-281/file1
tests/generic/282 +1 -2
@@ -80,8 +80,7 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1) -cat $TEST_DIR/mwrite.out | tee -a $seqres.full +$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 >> $seqres.full 2>&1 _dmerror_load_working_table rm -rf $testdir/file2 >> $seqres.full 2>&1 _dmerror_unmount
tests/generic/283 +4 -2
@@ -81,8 +81,10 @@ md5sum $testdir/file2 | _filter_scratch echo "CoW and unmount" sync _dmerror_load_error_table -urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" -c "msync -s 0 $filesize" $testdir/file2 > $TEST_DIR/mwrite.out 2>&1) -cat $TEST_DIR/mwrite.out | tee -a $seqres.full +urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \ + -c "msync -s 0 $filesize" $testdir/file2 2>&1) +echo $urk >> $seqres.full +echo "$urk" | grep -q "error" || _fail "mwrite did not fail" _dmerror_load_working_table echo "Rewrite"
tests/generic/283.out +0 -1
@@ -5,7 +5,6 @@ Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-283/file1 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-283/file2 CoW and unmount -msync: Input/output error Rewrite Compare files 1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-283/file1
PATCH 6/7 dedupe: fix consistent error message prefixes for dedupe tests
In reply to Darrick J. WongSince we're fixing the xfs_io dedupe command to consistently print the dedupe ioctl name on error, fix the tests too.
--- tests/generic/122.out | 2 +- tests/generic/136.out | 2 +- tests/generic/158.out | 16 ++++++++-------- tests/generic/304.out | 12 ++++++------ tests/generic/374.out | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-)
tests/generic/122.out +1 -1
@@ -4,7 +4,7 @@ Create the original files 5e3501f97fd2669babfcbd3e1972e833 TEST_DIR/test-122/file2 Files 1-2 do not match (intentional) (Fail to) dedupe the middle blocks together -dedupe: Extents did not match. +XFS_IOC_FILE_EXTENT_SAME: Extents did not match. Compare sections 35ac8d7917305c385c30f3d82c30a8f6 TEST_DIR/test-122/file1 5e3501f97fd2669babfcbd3e1972e833 TEST_DIR/test-122/file2
tests/generic/136.out +1 -1
@@ -7,7 +7,7 @@ c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file2 Dedupe the last blocks together 1->2 1->3 -dedupe: Extents did not match. +XFS_IOC_FILE_EXTENT_SAME: Extents did not match. c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file1 c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file2 07ac67bf7f271195442509e79cde4cee TEST_DIR/test-136/file3
tests/generic/158.out +8 -8
@@ -2,17 +2,17 @@ QA output created by 158 Format and mount Create the original files Try cross-device dedupe -dedupe: Invalid cross-device link +XFS_IOC_FILE_EXTENT_SAME: Invalid cross-device link Try unaligned dedupe -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try overlapping dedupe -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try dedupe from past EOF -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try dedupe to past EOF, destination offset beyond EOF -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try dedupe to past EOF, destination offset behind EOF -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try to dedupe a dir XFS_IOC_FILE_EXTENT_SAME: Is a directory Try to dedupe a device
@@ -20,8 +20,8 @@ XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try to dedupe to a dir TEST_DIR/test-158/dir1: Is a directory Try to dedupe to a device -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try to dedupe to a fifo -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Try to dedupe an append-only file Dedupe two files
tests/generic/304.out +6 -6
@@ -2,17 +2,17 @@ QA output created by 304 Format and mount Create the original files Dedupe large single byte file -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Dedupe large empty file -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Dedupe past maximum file size in dest file (should fail) -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Dedupe high offset to low offset -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Dedupe past source file EOF (should fail) -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Dedupe max size at nonzero offset (should fail) -dedupe: Invalid argument +XFS_IOC_FILE_EXTENT_SAME: Invalid argument Dedupe with huge off/len (should fail) XFS_IOC_FILE_EXTENT_SAME: Invalid argument Check file creation
tests/generic/374.out +1 -1
@@ -3,7 +3,7 @@ Format and mount Mount otherdir Create file Dedupe one file to another -dedupe: Invalid cross-device link +XFS_IOC_FILE_EXTENT_SAME: Invalid cross-device link Check output 2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-374/file 2d61aa54b58c2e94403fb092c3dbc027 OTHER_DIR/test-374/otherfile
Re: [PATCH 6/7] dedupe: fix consistent error message prefixes for dedupe tests
Quoted 4 lines · Darrick J. Wong
Since we're fixing the
xfs_iodedupe command to consistently print the dedupe ioctl name on error, fix the tests too.Signed-off-by Darrick J. Wong <[email protected]>
Seems you need to rebase against current master, I just pushed my patch out on Sunday with your Reviewed-by :)
1300cbc generic/158,304: filter dedupe error message
And take use the new _filter_dedupe_error()? So both old and new version of xfs_io pass the tests.
Thanks,
Eryu
Re: [PATCH 6/7] dedupe: fix consistent error message prefixes for dedupe tests
Quoted 6 lines · Eryu Guan
Quoted 4 lines · Darrick J. Wong
Since we're fixing the
xfs_iodedupe command to consistently print the dedupe ioctl name on error, fix the tests too.Signed-off-by Darrick J. Wong <[email protected]>
Quoted 7 lines
Seems you need to rebase against current master, I just pushed my patch out on Sunday with your Reviewed-by :)
1300cbc generic/158,304: filter dedupe error message
And take use the new
_filter_dedupe_error()? So both old and new version ofxfs_iopass the tests.
Ok, will do.
--D
Quoted 7 lines
Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 6/7 dedupe: fix consistent error message prefixes for dedupe tests
In reply to Darrick J. WongSince we're fixing the xfs_io dedupe command to consistently print the dedupe ioctl name on error, fix the tests too.
---
v2: use _filter_dedupe_error
--- tests/generic/122 | 2 +- tests/generic/122.out | 2 +- tests/generic/136 | 2 +- tests/generic/136.out | 2 +- tests/generic/374 | 2 +- tests/generic/374.out | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
tests/generic/122 +1 -1
@@ -67,7 +67,7 @@ _compare_range $testdir/file1 0 $testdir/file2 0 "$((blksz * 8))" \ echo "(Fail to) dedupe the middle blocks together" free_before=$(stat -f -c '%a' $testdir) _dedupe_range $testdir/file1 $((blksz * 4)) $testdir/file2 \ - $((blksz * 4)) $((blksz * 2)) >> $seqres.full + $((blksz * 4)) $((blksz * 2)) 2>&1 | _filter_dedupe_error _test_cycle_mount free_after=$(stat -f -c '%a' $testdir) echo "freesp changed by $free_before -> $free_after" >> $seqres.full
tests/generic/122.out +1 -1
@@ -4,7 +4,7 @@ Create the original files 5e3501f97fd2669babfcbd3e1972e833 TEST_DIR/test-122/file2 Files 1-2 do not match (intentional) (Fail to) dedupe the middle blocks together -dedupe: Extents did not match. +XFS_IOC_FILE_EXTENT_SAME: Extents did not match. Compare sections 35ac8d7917305c385c30f3d82c30a8f6 TEST_DIR/test-122/file1 5e3501f97fd2669babfcbd3e1972e833 TEST_DIR/test-122/file2
tests/generic/136 +1 -1
@@ -85,7 +85,7 @@ echo "Dedupe the last blocks together" echo "1->2" _dedupe_range $testdir/file1 $blksz $testdir/file2 $blksz 37 >> $seqres.full echo "1->3" -_dedupe_range $testdir/file1 $blksz $testdir/file3 $blksz 37 >> $seqres.full +_dedupe_range $testdir/file1 $blksz $testdir/file3 $blksz 37 2>&1 | _filter_dedupe_error _test_cycle_mount md5sum $testdir/file1 | _filter_test_dir
tests/generic/136.out +1 -1
@@ -7,7 +7,7 @@ c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file2 Dedupe the last blocks together 1->2 1->3 -dedupe: Extents did not match. +XFS_IOC_FILE_EXTENT_SAME: Extents did not match. c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file1 c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file2 07ac67bf7f271195442509e79cde4cee TEST_DIR/test-136/file3
tests/generic/374 +1 -1
@@ -70,7 +70,7 @@ _pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full _pwrite_byte 0x61 0 $sz $testdir/otherfile >> $seqres.full echo "Dedupe one file to another" -_dedupe_range $testdir/file 0 $othertestdir/otherfile 0 $sz >> $seqres.full +_dedupe_range $testdir/file 0 $othertestdir/otherfile 0 $sz 2>&1 | _filter_dedupe_error filter_md5() {
tests/generic/374.out +1 -1
@@ -3,7 +3,7 @@ Format and mount Mount otherdir Create file Dedupe one file to another -dedupe: Invalid cross-device link +XFS_IOC_FILE_EXTENT_SAME: Invalid cross-device link Check output 2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-374/file 2d61aa54b58c2e94403fb092c3dbc027 OTHER_DIR/test-374/otherfile
PATCH 7/7 xfs/ext4: check negative inode size
In reply to Darrick J. WongCraft a malicious filesystem image with a negative inode size, then try to trigger a kernel DoS by appending data to the file. Ideally this should trigger verifier errors instead of hanging.
--- tests/shared/400 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/400.out | 5 +++ tests/shared/401 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/401.out | 5 +++ tests/shared/group | 2 + tests/xfs/400 | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/400.out | 5 +++ tests/xfs/401 | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/401.out | 5 +++ tests/xfs/group | 2 + 10 files changed, 310 insertions(+) create mode 100755 tests/shared/400 create mode 100644 tests/shared/400.out create mode 100755 tests/shared/401 create mode 100644 tests/shared/401.out create mode 100755 tests/xfs/400 create mode 100644 tests/xfs/400.out create mode 100755 tests/xfs/401 create mode 100644 tests/xfs/401.out
tests/shared/400 new file +71 -0
@@ -0,0 +1,71 @@ +#! /bin/bash +# FSQA Test No. 400 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs ext2 ext3 ext4 +_require_scratch_nocheck +_disable_dmesg_check + +rm -f $seqres.full + +echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a + +echo "Corrupt filesystem" +_scratch_unmount +debugfs -w -R "sif /a size -1" $SCRATCH_DEV >> $seqres.full 2>&1 + +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exit
tests/shared/400.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/shared/401 new file +71 -0
71 lines not on this page · raw message
tests/shared/401.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/shared/group +2 -0
@@ -13,3 +13,5 @@ 272 auto enospc rw 289 auto quick 298 auto trim +400 dangerous_fuzzers +401 dangerous_fuzzers
tests/xfs/400 new file +72 -0
72 lines not on this page · raw message
tests/xfs/400.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/xfs/401 new file +72 -0
72 lines not on this page · raw message
tests/xfs/401.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/xfs/group +2 -0
@@ -334,3 +334,5 @@ 345 auto quick clone 346 auto quick clone 347 auto quick clone +400 dangerous_fuzzers +401 dangerous_fuzzers
Re: [PATCH 7/7] xfs/ext4: check negative inode size
Quoted 33 lines · Darrick J. Wong
Craft a malicious filesystem image with a negative inode size, then try to trigger a kernel DoS by appending data to the file. Ideally this should trigger verifier errors instead of hanging.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/shared/400 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/400.out | 5 +++ tests/shared/401 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/401.out | 5 +++ tests/shared/group | 2 + tests/xfs/400 | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/400.out | 5 +++ tests/xfs/401 | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/401.out | 5 +++ tests/xfs/group | 2 + 10 files changed, 310 insertions(+) create mode 100755 tests/shared/400 create mode 100644 tests/shared/400.out create mode 100755 tests/shared/401 create mode 100644 tests/shared/401.out create mode 100755 tests/xfs/400 create mode 100644 tests/xfs/400.out create mode 100755 tests/xfs/401 create mode 100644 tests/xfs/401.outtests/shared/400 new file +0
-0
tests/shared/400 line 8
Quoted 8 lines
tests/shared/400 new file +8
-0@@ -0,0 +1,71 @@ +#! /bin/bash +# FSQA Test No. 400 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up.
How about adding some more descriptions here? Stating that this test is testing buffered I/O, and adding some comments about testing direct I/O to shared/401? The same to xfs/400 and xfs/401. Otherwise they look the same just from the test description.
Quoted 31 lines
tests/shared/400 new file +31
-0+# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +}
tests/shared/400 line 49
Quoted 10 lines
tests/shared/400 new file +10
-0+ +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs ext2 ext3 ext4 +_require_scratch_nocheck +_disable_dmesg_check
_require_command "$DEBUGFS_PROG" debugfs and..
tests/shared/400 line 62
Quoted 13 lines
tests/shared/400 new file +13
-0+ +rm -f $seqres.full + +echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a + +echo "Corrupt filesystem" +_scratch_unmount +debugfs -w -R "sif /a size -1" $SCRATCH_DEV >> $seqres.full 2>&1
$DEBUGFS_PROG here
Quoted 78 lines
tests/shared/400 new file +9
-0+ +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/shared/400.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/shared/401 new file +52
-0@@ -0,0 +1,71 @@ +#! /bin/bash +# FSQA Test No. 401 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs ext2 ext3 ext4 +_require_scratch_nocheck +_disable_dmesg_check + +rm -f $seqres.full +
tests/shared/401 line 62
Quoted 10 lines
tests/shared/401 new file +10
-0+echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a + +echo "Corrupt filesystem" +_scratch_unmount +debugfs -w -R "sif /a size 0xFFFFFFFFFFFFFE00" $SCRATCH_DEV >> $seqres.full 2>&1
Better to have your explanation to 0XFFFFFFFFFFFFFE00 as comments. (Same to xfs/400 and xfs/401.)
"The 0xFFFFFFFFFFFFFE00 rounds the file size down to a multiple of 512 so that we can do the directio"
Thanks,
Eryu
Quoted 219 lines
tests/shared/401 new file +9
-0+ +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/shared/401.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/shared/group +2
-0@@ -13,3 +13,5 @@ 272 auto enospc rw 289 auto quick 298 auto trim +400 dangerous_fuzzers +401 dangerous_fuzzerstests/xfs/400 new file +72
-0@@ -0,0 +1,72 @@ +#! /bin/bash +# FSQA Test No. 400 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs xfs +_require_scratch_nocheck +_disable_dmesg_check + +rm -f $seqres.full + +echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a +inum=$(stat -c "%i" $testdir/a) + +echo "Corrupt filesystem" +_scratch_unmount +_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -1' >> $seqres.full + +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/xfs/400.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/xfs/401 new file +72
-0@@ -0,0 +1,72 @@ +#! /bin/bash +# FSQA Test No. 401 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs xfs +_require_scratch_nocheck +_disable_dmesg_check + +rm -f $seqres.full + +echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a +inum=$(stat -c "%i" $testdir/a) + +echo "Corrupt filesystem" +_scratch_unmount +_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -512' >> $seqres.full + +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/xfs/401.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/xfs/group +2
-0@@ -334,3 +334,5 @@ 345 auto quick clone 346 auto quick clone 347 auto quick clone +400 dangerous_fuzzers +401 dangerous_fuzzers
Re: [PATCH 7/7] xfs/ext4: check negative inode size
Quoted 39 lines · Eryu Guan
Quoted 38 lines · Darrick J. Wong
Craft a malicious filesystem image with a negative inode size, then try to trigger a kernel DoS by appending data to the file. Ideally this should trigger verifier errors instead of hanging.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/shared/400 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/400.out | 5 +++ tests/shared/401 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/401.out | 5 +++ tests/shared/group | 2 + tests/xfs/400 | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/400.out | 5 +++ tests/xfs/401 | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/401.out | 5 +++ tests/xfs/group | 2 + 10 files changed, 310 insertions(+) create mode 100755 tests/shared/400 create mode 100644 tests/shared/400.out create mode 100755 tests/shared/401 create mode 100644 tests/shared/401.out create mode 100755 tests/xfs/400 create mode 100644 tests/xfs/400.out create mode 100755 tests/xfs/401 create mode 100644 tests/xfs/401.outtests/shared/400 new file +5
-0@@ -0,0 +1,71 @@ +#! /bin/bash +# FSQA Test No. 400 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this,
Quoted 8 lines
tests/shared/400 line 8
Quoted 3 lines
tests/shared/400 new file +3
-0+# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up.How about adding some more descriptions here? Stating that this test is testing buffered I/O, and adding some comments about testing direct I/O to shared/401? The same to xfs/400 and xfs/401. Otherwise they look the same just from the test description.
Ok.
Quoted 35 lines
Quoted 35 lines
tests/shared/400 new file +35
-0+# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter
Quoted 8 lines
tests/shared/400 line 49
Quoted 6 lines
tests/shared/400 new file +6
-0+ +# real QA test starts here +_supported_os Linux +_supported_fs ext2 ext3 ext4 +_require_scratch_nocheck +_disable_dmesg_check
_require_command"$DEBUGFS_PROG" debugfs and..
<nod>
Quoted 16 lines
Quoted 4 lines
tests/shared/400 new file +3
-0+ +rm -f $seqres.full +tests/shared/400 line 62
Quoted 10 lines
tests/shared/400 new file +10
-0+echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a + +echo "Corrupt filesystem" +_scratch_unmount +debugfs -w -R "sif /a size -1" $SCRATCH_DEV >> $seqres.full 2>&1$DEBUGFS_PROG here
<nod>
Quoted 93 lines
Quoted 79 lines
tests/shared/400 new file +9
-0+ +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/shared/400.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/shared/401 new file +52
-0@@ -0,0 +1,71 @@ +#! /bin/bash +# FSQA Test No. 401 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs ext2 ext3 ext4 +_require_scratch_nocheck +_disable_dmesg_check + +rm -f $seqres.full +tests/shared/401 line 62
Quoted 10 lines
tests/shared/401 new file +10
-0+echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a + +echo "Corrupt filesystem" +_scratch_unmount +debugfs -w -R "sif /a size 0xFFFFFFFFFFFFFE00" $SCRATCH_DEV >> $seqres.full 2>&1Better to have your explanation to
0XFFFFFFFFFFFFFE00as comments. (Same to xfs/400 and xfs/401.)
Quoted 2 lines
"The
0xFFFFFFFFFFFFFE00rounds the file size down to a multiple of 512 so that we can do the directio"
Ok, fixed.
--D
Quoted 227 lines
Thanks,
EryuQuoted 214 lines
tests/shared/401 new file +9
-0+ +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/shared/401.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/shared/group +2
-0@@ -13,3 +13,5 @@ 272 auto enospc rw 289 auto quick 298 auto trim +400 dangerous_fuzzers +401 dangerous_fuzzerstests/xfs/400 new file +72
-0@@ -0,0 +1,72 @@ +#! /bin/bash +# FSQA Test No. 400 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs xfs +_require_scratch_nocheck +_disable_dmesg_check + +rm -f $seqres.full + +echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a +inum=$(stat -c "%i" $testdir/a) + +echo "Corrupt filesystem" +_scratch_unmount +_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -1' >> $seqres.full + +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/xfs/400.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/xfs/401 new file +72
-0@@ -0,0 +1,72 @@ +#! /bin/bash +# FSQA Test No. 401 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs xfs +_require_scratch_nocheck +_disable_dmesg_check + +rm -f $seqres.full + +echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a +inum=$(stat -c "%i" $testdir/a) + +echo "Corrupt filesystem" +_scratch_unmount +_scratch_xfs_db -x -c "inode ${inum}" -c 'write core.size -- -512' >> $seqres.full + +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exittests/xfs/401.out new file +5
-0@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).tests/xfs/group +0
-0tests/xfs/group line 338
Quoted 5 lines
tests/xfs/group +2
-0@@ -334,3 +334,5 @@ 345 auto quick clone 346 auto quick clone 347 auto quick clone +400 dangerous_fuzzers +401 dangerous_fuzzers--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 7/7 xfs/ext4: check negative inode size
In reply to Darrick J. WongCraft a malicious filesystem image with a negative inode size, then try to trigger a kernel DoS by appending data to the file. Ideally this should trigger verifier errors instead of hanging.
---
v2: use $DEBUGFS_PROG instead of debugfs; improve documentation
--- tests/shared/400 | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/400.out | 5 +++ tests/shared/401 | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/401.out | 5 +++ tests/shared/group | 2 + tests/xfs/400 | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/400.out | 5 +++ tests/xfs/401 | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/401.out | 5 +++ tests/xfs/group | 2 + 10 files changed, 328 insertions(+) create mode 100755 tests/shared/400 create mode 100644 tests/shared/400.out create mode 100755 tests/shared/401 create mode 100644 tests/shared/401.out create mode 100755 tests/xfs/400 create mode 100644 tests/xfs/400.out create mode 100755 tests/xfs/401 create mode 100644 tests/xfs/401.out
tests/shared/400 new file +75 -0
@@ -0,0 +1,75 @@ +#! /bin/bash +# FSQA Test No. 400 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +# So, create this malformed inode and try a buffered append to make +# sure we catch this situation. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +PIDS="" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs ext2 ext3 ext4 +_require_scratch_nocheck +_disable_dmesg_check +_require_command "$DEBUGFS_PROG" + +rm -f $seqres.full + +echo "Format and mount" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +testdir=$SCRATCH_MNT +echo m > $testdir/a + +echo "Corrupt filesystem" +_scratch_unmount +$DEBUGFS_PROG -w -R "sif /a size -1" $SCRATCH_DEV >> $seqres.full 2>&1 + +echo "Remount, try to append" +_scratch_mount +dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." +sync + +# success, all done +status=0 +exit
tests/shared/400.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/shared/401 new file +77 -0
77 lines not on this page · raw message
tests/shared/401.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/shared/group +2 -0
@@ -13,3 +13,5 @@ 272 auto enospc rw 289 auto quick 298 auto trim +400 dangerous_fuzzers +401 dangerous_fuzzers
tests/xfs/400 new file +75 -0
75 lines not on this page · raw message
tests/xfs/400.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 400 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/xfs/401 new file +77 -0
77 lines not on this page · raw message
tests/xfs/401.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 401 +Format and mount +Corrupt filesystem +Remount, try to append +Write did not succeed (ok).
tests/xfs/group +2 -0
@@ -334,3 +334,5 @@ 345 auto quick clone 346 auto quick clone 347 auto quick clone +400 dangerous_fuzzers +401 dangerous_fuzzers
Re: [PATCH v2 7/7] xfs/ext4: check negative inode size
Quoted 7 lines · Darrick J. Wong
Craft a malicious filesystem image with a negative inode size, then try to trigger a kernel DoS by appending data to the file. Ideally this should trigger verifier errors instead of hanging.
Signed-off-by Darrick J. Wong <[email protected]>---
v2: use $DEBUGFS_PROG instead of debugfs; improve documentation
Thanks for all the updated patches! I fixed a minor typo locally and committed.
Quoted 6 lines
tests/shared/401 new file +0
-0
tests/shared/401 line 10
Quoted 10 lines
tests/shared/401 new file +10
-0@@ -0,0 +1,77 @@ +#! /bin/bash +# FSQA Test No. 401 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +# So, create this malformed inode and try a buffered dio append to make
^^^^^^^^
I removed the "buffered" here and from xfs/401.
Thanks,
Eryu
Re: [PATCH v2 7/7] xfs/ext4: check negative inode size
Quoted 29 lines · Eryu Guan
Quoted 7 lines · Darrick J. Wong
Craft a malicious filesystem image with a negative inode size, then try to trigger a kernel DoS by appending data to the file. Ideally this should trigger verifier errors instead of hanging.
Signed-off-by Darrick J. Wong <[email protected]>---
v2: use $DEBUGFS_PROG instead of debugfs; improve documentationThanks for all the updated patches! I fixed a minor typo locally and committed.
Quoted 6 lines
tests/shared/401 new file +0
-0tests/shared/401 line 10
Quoted 10 lines
tests/shared/401 new file +10
-0@@ -0,0 +1,77 @@ +#! /bin/bash +# FSQA Test No. 401 +# +# Since loff_t is a signed type, it is invalid for a filesystem to load +# an inode with i_size = -1ULL. Unfortunately, nobody checks this, +# which means that we can trivially DoS the VFS by creating such a file +# and appending to it. This causes an integer overflow in the routines +# underlying writeback, which results in the kernel locking up. +# +# So, create this malformed inode and try a buffered dio append to make^^^^^^^^
Quoted 1 line
I removed the "buffered" here and from xfs/401.
D'oh!!! Thanks for fixing that.
--D
Quoted 3 lines
Thanks,
Eryu