]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: test extent size hint size overflows
authorDave Chinner <dchinner@redhat.com>
Tue, 4 Aug 2015 04:10:44 +0000 (14:10 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 4 Aug 2015 04:10:44 +0000 (14:10 +1000)
In certain cases, the extent size hints can cause maximum extent
size overflows resulting in extent tree corruptions. This test
exercises the original reproducer, and another corner case
demonstrated to expose problems on 1k block size filesystems.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
--
Version 2:
- TESTDIR->TEST_DIR
- append output to $seqres.full

tests/xfs/074 [new file with mode: 0755]
tests/xfs/074.out [new file with mode: 0644]
tests/xfs/group

diff --git a/tests/xfs/074 b/tests/xfs/074
new file mode 100755 (executable)
index 0000000..a571a34
--- /dev/null
@@ -0,0 +1,93 @@
+#! /bin/bash
+# FS QA Test 074-extsz-hints-vs-maxextlen
+#
+# Check some extent size hint boundary conditions that can result in
+# MAXEXTLEN overflows.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Red Hat, 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"
+
+_cleanup()
+{
+       cd /
+       _destroy_loop_device $LOOP_DEV
+       rm -f $tmp.* $LOOP_FILE
+}
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+rm -f $seqres.full
+
+_require_test
+_require_xfs_io_command "falloc"
+
+# we use loop devices for this so that we can create large files for prealloc
+# without having to care about the underlying device size.
+_require_loop
+
+LOOP_FILE=$TEST_DIR/$seq.img
+LOOP_MNT=$TEST_DIR/$seq.mnt
+mkdir -p $LOOP_MNT
+$XFS_IO_PROG -ft -c "truncate 1t" $LOOP_FILE >> $seqres.full
+LOOP_DEV=`_create_loop_device $LOOP_FILE`
+
+_mkfs_dev -d size=40051712b,agcount=4 -l size=32m $LOOP_DEV
+_mount $LOOP_DEV $LOOP_MNT
+
+# Corrupt the BMBT by creating extents larger than MAXEXTLEN
+$XFS_IO_PROG -ft \
+       -c "extsize 16m" \
+       -c "falloc 0 30g" \
+       $LOOP_MNT/foo >> $seqres.full
+
+umount $LOOP_MNT
+_check_xfs_filesystem $LOOP_DEV none none
+
+_mkfs_dev -f -l size=32m $LOOP_DEV
+_mount $LOOP_DEV $LOOP_MNT
+
+# check we trim both ends of the extent approproiately; this will fail
+# on 1k block size filesystems without the correct fixes in place.
+$XFS_IO_PROG -ft \
+       -c "extsize 1g" \
+       -c "falloc 1023m 2g" \
+       $LOOP_MNT/foo >> $seqres.full
+
+umount $LOOP_MNT
+_check_xfs_filesystem $LOOP_DEV none none
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/xfs/074.out b/tests/xfs/074.out
new file mode 100644 (file)
index 0000000..380f065
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 074
+Silence is golden
index 848a1bdf483214e56aae2ad9cddd29330c297d14..c211fc1a18c835b79d52e1472b52477ccb8d2045 100644 (file)
@@ -71,6 +71,7 @@
 071 rw auto
 072 rw auto prealloc quick
 073 copy auto
+074 quick auto prealloc rw
 078 growfs auto quick
 080 rw ioctl
 081 deprecated # log logprint quota