Hi all, This is the seventh revision of a patchset that adds to xfstests support for testing reverse-mappings of physical blocks to file and metadata (rmap); support for testing multiple file logical blocks to the same physical block (reflink); and implements the beginnings of online metadata scrubbing. The first eleven tests fix various bugs in existing reflink and rmap tests, most of which were a result of not using helpers when I should have. After that, there are new tests to make sure that we can't clone_range across mountpoints; test to make sure that swapext works with many extents on a rmap filesystem; and tests for realtime reverse-mapping. There are also revised patches for testing xfs_repair's ability to rebuild filesystem indices correctly, and to run xfs_scrub during each test. If you're going to start using this mess, you probably ought to just pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3]. There are also updates for xfs-docs[4]. The kernel patches should apply to dchinner's for-next; xfsprogs patches to for-next; and xfstest to master. The kernel git tree already has for-next included. The patches have been xfstested with x64, i386, armv7l, and ppc64. AFAICT these don't cause any new failures for the 'auto' group. This is an extraordinary way to eat your data. Enjoy! Comments and questions are, as always, welcome. --D [1] https://github.com/djwong/linux/tree/djwong-experimental [2] https://github.com/djwong/xfsprogs/tree/djwong-experimental [3] https://github.com/djwong/xfstests/tree/djwong-devel [4] https://github.com/djwong/xfs-documentation/tree/djwong-devel
Hi all, This is the seventh revision of a patchset that adds to xfstests support for testing reverse-mappings of physical blocks to file and metadata (rmap); support for testing multiple file logical blocks to the same physical block (reflink); and implements the beginnings of online metadata scrubbing. The first eleven tests fix various bugs in existing reflink and rmap tests, most of which were a result of not using helpers when I should have. After that, there are new tests to make sure that we can't clone_range across mountpoints; test to make sure that swapext works with many extents on a rmap filesystem; and tests for realtime reverse-mapping. There are also revised patches for testing xfs_repair's ability to rebuild filesystem indices correctly, and to run xfs_scrub during each test. If you're going to start using this mess, you probably ought to just pull from my github trees for kernel[1], xfsprogs[2], and xfstests[3]. There are also updates for xfs-docs[4]. The kernel patches should apply to dchinner's for-next; xfsprogs patches to for-next; and xfstest to master. The kernel git tree already has for-next included. The patches have been xfstested with x64, i386, armv7l, and ppc64. AFAICT these don't cause any new failures for the 'auto' group. This is an extraordinary way to eat your data. Enjoy! Comments and questions are, as always, welcome. --D [1] https://github.com/djwong/linux/tree/djwong-experimental [2] https://github.com/djwong/xfsprogs/tree/djwong-experimental [3] https://github.com/djwong/xfstests/tree/djwong-devel [4] https://github.com/djwong/xfs-documentation/tree/djwong-devel _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
These two tests were accidentally double-added as xfs/30[78], but the newer versions have fixed up helper usage and fewer whitespace problems, so nuke the old tests. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/263 | 179 ----------------------------------------------------- tests/xfs/263.out | 13 ---- tests/xfs/264 | 180 ----------------------------------------------------- tests/xfs/264.out | 13 ---- tests/xfs/group | 2 - 5 files changed, 387 deletions(-) delete mode 100755 tests/xfs/263 delete mode 100644 tests/xfs/263.out delete mode 100755 tests/xfs/264 delete mode 100644 tests/xfs/264.out diff --git a/tests/xfs/263 b/tests/xfs/263 deleted file mode 100755 index 6659dee..0000000 --- a/tests/xfs/263 +++ /dev/null @@ -1,179 +0,0 @@ -#! /bin/bash -# FS QA Test No. 263 -# -# Test recovery of "lost" CoW blocks: -# - Use the debugger to fake a leftover CoW extent -# - See if xfs_repair fixes it -# -#----------------------------------------------------------------------- -# Copyright (c) 2016, Oracle and/or its affiliates. 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" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -rf $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/reflink - -# real QA test starts here -_supported_os Linux -_supported_fs xfs -_require_scratch_reflink - -rm -f $seqres.full - -echo "Format" -_scratch_mkfs > $seqres.full 2>&1 -_scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -umount $SCRATCH_MNT - -_get_agf_data() { - field="$1" - shift - - xfs_db -c 'agf 1' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_agf_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_get_sb_data() { - field="$1" - shift - - xfs_db -c 'sb 0' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_sb_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_filter_leftover() { - grep "^leftover" | sed -e "s/[0-9]\+/NR/g" -} - -_dump_status() { - echo "** " "$@" - xfs_db -c 'sb 0' -c p $SCRATCH_DEV - echo "** agf header" - xfs_db -c 'agf 1' -c p $SCRATCH_DEV - echo "** refcntbt" - xfs_db -c 'agf 1' -c 'addr refcntroot' -c p $SCRATCH_DEV - echo "** rmapbt" - test $is_rmap -gt 0 && xfs_db -c 'agf 1' -c 'addr rmaproot' -c p $SCRATCH_DEV - echo "** bnobt" - xfs_db -c 'agf 1' -c 'addr bnoroot' -c p $SCRATCH_DEV - echo "** cntbt" - xfs_db -c 'agf 1' -c 'addr cntroot' -c p $SCRATCH_DEV -} - -echo "We need AG1 to have a single free extent" -bno_lvl=$(_get_agf_data level -c 'addr bnoroot') -bno_nr=$(_get_agf_data numrecs -c 'addr bnoroot') -refc_lvl=$(_get_agf_data level -c 'addr refcntroot') -refc_nr=$(_get_agf_data numrecs -c 'addr refcntroot') - -test $bno_lvl -eq 0 || echo " AG 1 bnobt must only have one level" -test $bno_nr -eq 1 || echo " AG 1 bnobt must only have one record" -test $refc_lvl -eq 0 || echo " AG 1 refcountbt must only have one level" -test $refc_nr -eq 0 || echo " AG 1 refcountbt must only have one record" - -if [ $is_rmap -gt 0 ]; then - rmap_lvl=$(_get_agf_data level -c 'addr rmaproot') - rmap_nr=$(_get_agf_data numrecs -c 'addr rmaproot') - test $rmap_lvl -eq 0 || echo " AG 1 rmapbt must only have one level" -fi - -echo "Find our extent and old counter values" -bno=$(_get_agf_data "recs[1].startblock" -c 'addr bnoroot') -len=$(_get_agf_data "recs[1].blockcount" -c 'addr bnoroot') -agf_freeblks=$(_get_agf_data freeblks) -sb_fdblocks=$(_get_sb_data fdblocks) - -test $len -ge 200 || echo " AG 1 doesn't have enough free blocks" - -# Take the last 100 blocks of the free extent -debris_len=100 -debris_bno=$((bno + len - debris_len)) - -echo "Remove the extent from the freesp btrees" -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr bnoroot' -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr cntroot' -_set_agf_data freeblks $((agf_freeblks - debris_len)) -_set_agf_data longest $((len - debris_len)) -_set_sb_data fdblocks $((sb_fdblocks - debris_len)) - -echo "Add the extent to the refcount btree" -_set_agf_data numrecs 1 -c 'addr refcntroot' -_set_agf_data "recs[1].startblock" $debris_bno -c 'addr refcntroot' -_set_agf_data "recs[1].blockcount" $debris_len -c 'addr refcntroot' -_set_agf_data "recs[1].refcount" 1 -c 'addr refcntroot' - -if [ $is_rmap -gt 0 ]; then - rmap_nr=$((rmap_nr + 1)) - _set_agf_data numrecs $rmap_nr -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].startblock" $debris_bno -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].blockcount" $debris_len -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].owner" -9 -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].offset" 0 -c 'addr rmaproot' -fi - -_dump_status "broken fs config" >> $seqres.full - -echo "Look for leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -echo "Fix filesystem" -_scratch_xfs_repair >> $seqres.full 2>&1 || echo "xfs_repair failed?" - -_dump_status "supposedly fixed fs config" >> $seqres.full - -echo "Look for no more leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for no more leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -# success, all done -status=0 -exit diff --git a/tests/xfs/263.out b/tests/xfs/263.out deleted file mode 100644 index bc3eea9..0000000 --- a/tests/xfs/263.out +++ /dev/null @@ -1,13 +0,0 @@ -QA output created by 263 -Format -We need AG1 to have a single free extent -Find our extent and old counter values -Remove the extent from the freesp btrees -Add the extent to the refcount btree -Look for leftover warning in xfs_check -leftover CoW extent (NR/NR) len NR -Look for leftover warning in xfs_repair -leftover CoW extent (NR/NR) len NR -Fix filesystem -Look for no more leftover warning in xfs_check -Look for no more leftover warning in xfs_repair diff --git a/tests/xfs/264 b/tests/xfs/264 deleted file mode 100755 index 190361d..0000000 --- a/tests/xfs/264 +++ /dev/null @@ -1,180 +0,0 @@ -#! /bin/bash -# FS QA Test No. 264 -# -# Test recovery of "lost" CoW blocks: -# - Use the debugger to fake a leftover CoW extent -# - See if mount/umount fixes it -# -#----------------------------------------------------------------------- -# Copyright (c) 2016, Oracle and/or its affiliates. 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" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -rf $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/reflink - -# real QA test starts here -_supported_os Linux -_supported_fs xfs -_require_scratch_reflink - -rm -f $seqres.full - -echo "Format" -_scratch_mkfs > $seqres.full 2>&1 -_scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -umount $SCRATCH_MNT - -_get_agf_data() { - field="$1" - shift - - xfs_db -c 'agf 1' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_agf_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_get_sb_data() { - field="$1" - shift - - xfs_db -c 'sb 0' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_sb_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_filter_leftover() { - grep "^leftover" | sed -e "s/[0-9]\+/NR/g" -} - -_dump_status() { - echo "** " "$@" - xfs_db -c 'sb 0' -c p $SCRATCH_DEV - echo "** agf header" - xfs_db -c 'agf 1' -c p $SCRATCH_DEV - echo "** refcntbt" - xfs_db -c 'agf 1' -c 'addr refcntroot' -c p $SCRATCH_DEV - echo "** rmapbt" - test $is_rmap -gt 0 && xfs_db -c 'agf 1' -c 'addr rmaproot' -c p $SCRATCH_DEV - echo "** bnobt" - xfs_db -c 'agf 1' -c 'addr bnoroot' -c p $SCRATCH_DEV - echo "** cntbt" - xfs_db -c 'agf 1' -c 'addr cntroot' -c p $SCRATCH_DEV -} - -echo "We need AG1 to have a single free extent" -bno_lvl=$(_get_agf_data level -c 'addr bnoroot') -bno_nr=$(_get_agf_data numrecs -c 'addr bnoroot') -refc_lvl=$(_get_agf_data level -c 'addr refcntroot') -refc_nr=$(_get_agf_data numrecs -c 'addr refcntroot') - -test $bno_lvl -eq 0 || echo " AG 1 bnobt must only have one level" -test $bno_nr -eq 1 || echo " AG 1 bnobt must only have one record" -test $refc_lvl -eq 0 || echo " AG 1 refcountbt must only have one level" -test $refc_nr -eq 0 || echo " AG 1 refcountbt must only have one record" - -if [ $is_rmap -gt 0 ]; then - rmap_lvl=$(_get_agf_data level -c 'addr rmaproot') - rmap_nr=$(_get_agf_data numrecs -c 'addr rmaproot') - test $rmap_lvl -eq 0 || echo " AG 1 rmapbt must only have one level" -fi - -echo "Find our extent and old counter values" -bno=$(_get_agf_data "recs[1].startblock" -c 'addr bnoroot') -len=$(_get_agf_data "recs[1].blockcount" -c 'addr bnoroot') -agf_freeblks=$(_get_agf_data freeblks) -sb_fdblocks=$(_get_sb_data fdblocks) - -test $len -ge 200 || echo " AG 1 doesn't have enough free blocks" - -# Take the last 100 blocks of the free extent -debris_len=100 -debris_bno=$((bno + len - debris_len)) - -echo "Remove the extent from the freesp btrees" -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr bnoroot' -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr cntroot' -_set_agf_data freeblks $((agf_freeblks - debris_len)) -_set_agf_data longest $((len - debris_len)) -_set_sb_data fdblocks $((sb_fdblocks - debris_len)) - -echo "Add the extent to the refcount btree" -_set_agf_data numrecs 1 -c 'addr refcntroot' -_set_agf_data "recs[1].startblock" $debris_bno -c 'addr refcntroot' -_set_agf_data "recs[1].blockcount" $debris_len -c 'addr refcntroot' -_set_agf_data "recs[1].refcount" 1 -c 'addr refcntroot' - -if [ $is_rmap -gt 0 ]; then - rmap_nr=$((rmap_nr + 1)) - _set_agf_data numrecs $rmap_nr -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].startblock" $debris_bno -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].blockcount" $debris_len -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].owner" -9 -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].offset" 0 -c 'addr rmaproot' -fi - -_dump_status "broken fs config" >> $seqres.full - -echo "Look for leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -echo "Mount filesystem" -_scratch_mount -umount $SCRATCH_MNT - -_dump_status "supposedly fixed fs config" >> $seqres.full - -echo "Look for no more leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for no more leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -# success, all done -status=0 -exit diff --git a/tests/xfs/264.out b/tests/xfs/264.out deleted file mode 100644 index 3faaf42..0000000 --- a/tests/xfs/264.out +++ /dev/null @@ -1,13 +0,0 @@ -QA output created by 264 -Format -We need AG1 to have a single free extent -Find our extent and old counter values -Remove the extent from the freesp btrees -Add the extent to the refcount btree -Look for leftover warning in xfs_check -leftover CoW extent (NR/NR) len NR -Look for leftover warning in xfs_repair -leftover CoW extent (NR/NR) len NR -Mount filesystem -Look for no more leftover warning in xfs_check -Look for no more leftover warning in xfs_repair diff --git a/tests/xfs/group b/tests/xfs/group index 9f8ca0f..aa3b3ec 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -259,8 +259,6 @@ 260 auto quick quota 261 auto quick quota 262 auto quick quota -263 auto quick clone -264 auto quick clone 265 auto clone 266 dump ioctl auto quick 267 dump ioctl tape
These two tests were accidentally double-added as xfs/30[78], but the newer versions have fixed up helper usage and fewer whitespace problems, so nuke the old tests. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/263 | 179 ----------------------------------------------------- tests/xfs/263.out | 13 ---- tests/xfs/264 | 180 ----------------------------------------------------- tests/xfs/264.out | 13 ---- tests/xfs/group | 2 - 5 files changed, 387 deletions(-) delete mode 100755 tests/xfs/263 delete mode 100644 tests/xfs/263.out delete mode 100755 tests/xfs/264 delete mode 100644 tests/xfs/264.out diff --git a/tests/xfs/263 b/tests/xfs/263 deleted file mode 100755 index 6659dee..0000000 --- a/tests/xfs/263 +++ /dev/null @@ -1,179 +0,0 @@ -#! /bin/bash -# FS QA Test No. 263 -# -# Test recovery of "lost" CoW blocks: -# - Use the debugger to fake a leftover CoW extent -# - See if xfs_repair fixes it -# -#----------------------------------------------------------------------- -# Copyright (c) 2016, Oracle and/or its affiliates. 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" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -rf $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/reflink - -# real QA test starts here -_supported_os Linux -_supported_fs xfs -_require_scratch_reflink - -rm -f $seqres.full - -echo "Format" -_scratch_mkfs > $seqres.full 2>&1 -_scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -umount $SCRATCH_MNT - -_get_agf_data() { - field="$1" - shift - - xfs_db -c 'agf 1' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_agf_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_get_sb_data() { - field="$1" - shift - - xfs_db -c 'sb 0' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_sb_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_filter_leftover() { - grep "^leftover" | sed -e "s/[0-9]\+/NR/g" -} - -_dump_status() { - echo "** " "$@" - xfs_db -c 'sb 0' -c p $SCRATCH_DEV - echo "** agf header" - xfs_db -c 'agf 1' -c p $SCRATCH_DEV - echo "** refcntbt" - xfs_db -c 'agf 1' -c 'addr refcntroot' -c p $SCRATCH_DEV - echo "** rmapbt" - test $is_rmap -gt 0 && xfs_db -c 'agf 1' -c 'addr rmaproot' -c p $SCRATCH_DEV - echo "** bnobt" - xfs_db -c 'agf 1' -c 'addr bnoroot' -c p $SCRATCH_DEV - echo "** cntbt" - xfs_db -c 'agf 1' -c 'addr cntroot' -c p $SCRATCH_DEV -} - -echo "We need AG1 to have a single free extent" -bno_lvl=$(_get_agf_data level -c 'addr bnoroot') -bno_nr=$(_get_agf_data numrecs -c 'addr bnoroot') -refc_lvl=$(_get_agf_data level -c 'addr refcntroot') -refc_nr=$(_get_agf_data numrecs -c 'addr refcntroot') - -test $bno_lvl -eq 0 || echo " AG 1 bnobt must only have one level" -test $bno_nr -eq 1 || echo " AG 1 bnobt must only have one record" -test $refc_lvl -eq 0 || echo " AG 1 refcountbt must only have one level" -test $refc_nr -eq 0 || echo " AG 1 refcountbt must only have one record" - -if [ $is_rmap -gt 0 ]; then - rmap_lvl=$(_get_agf_data level -c 'addr rmaproot') - rmap_nr=$(_get_agf_data numrecs -c 'addr rmaproot') - test $rmap_lvl -eq 0 || echo " AG 1 rmapbt must only have one level" -fi - -echo "Find our extent and old counter values" -bno=$(_get_agf_data "recs[1].startblock" -c 'addr bnoroot') -len=$(_get_agf_data "recs[1].blockcount" -c 'addr bnoroot') -agf_freeblks=$(_get_agf_data freeblks) -sb_fdblocks=$(_get_sb_data fdblocks) - -test $len -ge 200 || echo " AG 1 doesn't have enough free blocks" - -# Take the last 100 blocks of the free extent -debris_len=100 -debris_bno=$((bno + len - debris_len)) - -echo "Remove the extent from the freesp btrees" -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr bnoroot' -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr cntroot' -_set_agf_data freeblks $((agf_freeblks - debris_len)) -_set_agf_data longest $((len - debris_len)) -_set_sb_data fdblocks $((sb_fdblocks - debris_len)) - -echo "Add the extent to the refcount btree" -_set_agf_data numrecs 1 -c 'addr refcntroot' -_set_agf_data "recs[1].startblock" $debris_bno -c 'addr refcntroot' -_set_agf_data "recs[1].blockcount" $debris_len -c 'addr refcntroot' -_set_agf_data "recs[1].refcount" 1 -c 'addr refcntroot' - -if [ $is_rmap -gt 0 ]; then - rmap_nr=$((rmap_nr + 1)) - _set_agf_data numrecs $rmap_nr -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].startblock" $debris_bno -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].blockcount" $debris_len -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].owner" -9 -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].offset" 0 -c 'addr rmaproot' -fi - -_dump_status "broken fs config" >> $seqres.full - -echo "Look for leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -echo "Fix filesystem" -_scratch_xfs_repair >> $seqres.full 2>&1 || echo "xfs_repair failed?" - -_dump_status "supposedly fixed fs config" >> $seqres.full - -echo "Look for no more leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for no more leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -# success, all done -status=0 -exit diff --git a/tests/xfs/263.out b/tests/xfs/263.out deleted file mode 100644 index bc3eea9..0000000 --- a/tests/xfs/263.out +++ /dev/null @@ -1,13 +0,0 @@ -QA output created by 263 -Format -We need AG1 to have a single free extent -Find our extent and old counter values -Remove the extent from the freesp btrees -Add the extent to the refcount btree -Look for leftover warning in xfs_check -leftover CoW extent (NR/NR) len NR -Look for leftover warning in xfs_repair -leftover CoW extent (NR/NR) len NR -Fix filesystem -Look for no more leftover warning in xfs_check -Look for no more leftover warning in xfs_repair diff --git a/tests/xfs/264 b/tests/xfs/264 deleted file mode 100755 index 190361d..0000000 --- a/tests/xfs/264 +++ /dev/null @@ -1,180 +0,0 @@ -#! /bin/bash -# FS QA Test No. 264 -# -# Test recovery of "lost" CoW blocks: -# - Use the debugger to fake a leftover CoW extent -# - See if mount/umount fixes it -# -#----------------------------------------------------------------------- -# Copyright (c) 2016, Oracle and/or its affiliates. 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" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -rf $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/reflink - -# real QA test starts here -_supported_os Linux -_supported_fs xfs -_require_scratch_reflink - -rm -f $seqres.full - -echo "Format" -_scratch_mkfs > $seqres.full 2>&1 -_scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -umount $SCRATCH_MNT - -_get_agf_data() { - field="$1" - shift - - xfs_db -c 'agf 1' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_agf_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'agf 1' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_get_sb_data() { - field="$1" - shift - - xfs_db -c 'sb 0' "$@" -c "p $field" $SCRATCH_DEV | awk '{print $3}' -} - -_set_sb_data() { - field="$1" - value="$2" - shift; shift - - xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value" $SCRATCH_DEV >> $seqres.full -} - -_filter_leftover() { - grep "^leftover" | sed -e "s/[0-9]\+/NR/g" -} - -_dump_status() { - echo "** " "$@" - xfs_db -c 'sb 0' -c p $SCRATCH_DEV - echo "** agf header" - xfs_db -c 'agf 1' -c p $SCRATCH_DEV - echo "** refcntbt" - xfs_db -c 'agf 1' -c 'addr refcntroot' -c p $SCRATCH_DEV - echo "** rmapbt" - test $is_rmap -gt 0 && xfs_db -c 'agf 1' -c 'addr rmaproot' -c p $SCRATCH_DEV - echo "** bnobt" - xfs_db -c 'agf 1' -c 'addr bnoroot' -c p $SCRATCH_DEV - echo "** cntbt" - xfs_db -c 'agf 1' -c 'addr cntroot' -c p $SCRATCH_DEV -} - -echo "We need AG1 to have a single free extent" -bno_lvl=$(_get_agf_data level -c 'addr bnoroot') -bno_nr=$(_get_agf_data numrecs -c 'addr bnoroot') -refc_lvl=$(_get_agf_data level -c 'addr refcntroot') -refc_nr=$(_get_agf_data numrecs -c 'addr refcntroot') - -test $bno_lvl -eq 0 || echo " AG 1 bnobt must only have one level" -test $bno_nr -eq 1 || echo " AG 1 bnobt must only have one record" -test $refc_lvl -eq 0 || echo " AG 1 refcountbt must only have one level" -test $refc_nr -eq 0 || echo " AG 1 refcountbt must only have one record" - -if [ $is_rmap -gt 0 ]; then - rmap_lvl=$(_get_agf_data level -c 'addr rmaproot') - rmap_nr=$(_get_agf_data numrecs -c 'addr rmaproot') - test $rmap_lvl -eq 0 || echo " AG 1 rmapbt must only have one level" -fi - -echo "Find our extent and old counter values" -bno=$(_get_agf_data "recs[1].startblock" -c 'addr bnoroot') -len=$(_get_agf_data "recs[1].blockcount" -c 'addr bnoroot') -agf_freeblks=$(_get_agf_data freeblks) -sb_fdblocks=$(_get_sb_data fdblocks) - -test $len -ge 200 || echo " AG 1 doesn't have enough free blocks" - -# Take the last 100 blocks of the free extent -debris_len=100 -debris_bno=$((bno + len - debris_len)) - -echo "Remove the extent from the freesp btrees" -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr bnoroot' -_set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr cntroot' -_set_agf_data freeblks $((agf_freeblks - debris_len)) -_set_agf_data longest $((len - debris_len)) -_set_sb_data fdblocks $((sb_fdblocks - debris_len)) - -echo "Add the extent to the refcount btree" -_set_agf_data numrecs 1 -c 'addr refcntroot' -_set_agf_data "recs[1].startblock" $debris_bno -c 'addr refcntroot' -_set_agf_data "recs[1].blockcount" $debris_len -c 'addr refcntroot' -_set_agf_data "recs[1].refcount" 1 -c 'addr refcntroot' - -if [ $is_rmap -gt 0 ]; then - rmap_nr=$((rmap_nr + 1)) - _set_agf_data numrecs $rmap_nr -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].startblock" $debris_bno -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].blockcount" $debris_len -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].owner" -9 -c 'addr rmaproot' - _set_agf_data "recs[$rmap_nr].offset" 0 -c 'addr rmaproot' -fi - -_dump_status "broken fs config" >> $seqres.full - -echo "Look for leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -echo "Mount filesystem" -_scratch_mount -umount $SCRATCH_MNT - -_dump_status "supposedly fixed fs config" >> $seqres.full - -echo "Look for no more leftover warning in xfs_check" -_scratch_xfs_check | _filter_leftover - -echo "Look for no more leftover warning in xfs_repair" -_scratch_xfs_repair -n 2>&1 | _filter_leftover - -# success, all done -status=0 -exit diff --git a/tests/xfs/264.out b/tests/xfs/264.out deleted file mode 100644 index 3faaf42..0000000 --- a/tests/xfs/264.out +++ /dev/null @@ -1,13 +0,0 @@ -QA output created by 264 -Format -We need AG1 to have a single free extent -Find our extent and old counter values -Remove the extent from the freesp btrees -Add the extent to the refcount btree -Look for leftover warning in xfs_check -leftover CoW extent (NR/NR) len NR -Look for leftover warning in xfs_repair -leftover CoW extent (NR/NR) len NR -Mount filesystem -Look for no more leftover warning in xfs_check -Look for no more leftover warning in xfs_repair diff --git a/tests/xfs/group b/tests/xfs/group index 9f8ca0f..aa3b3ec 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -259,8 +259,6 @@ 260 auto quick quota 261 auto quick quota 262 auto quick quota -263 auto quick clone -264 auto quick clone 265 auto clone 266 dump ioctl auto quick 267 dump ioctl tape _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Don't open-code _notrun checks for the rmapbt, just use the helper. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/310 | 4 +--- tests/xfs/314 | 4 +--- tests/xfs/317 | 4 +--- tests/xfs/322 | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/xfs/310 b/tests/xfs/310 index 36b683c..bfdec39 100755 --- a/tests/xfs/310 +++ b/tests/xfs/310 @@ -47,6 +47,7 @@ _cleanup() _supported_os Linux _supported_fs xfs _require_scratch +_require_xfs_scratch_rmapbt _require_xfs_io_command "falloc" rm -f $seqres.full @@ -56,9 +57,6 @@ echo "Figure out block size" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - testdir=$SCRATCH_MNT/test-$seq blksz="$(stat -f $SCRATCH_MNT -c '%S')" diff --git a/tests/xfs/314 b/tests/xfs/314 index 6b867b8..ec16c6f 100755 --- a/tests/xfs/314 +++ b/tests/xfs/314 @@ -48,6 +48,7 @@ _supported_os Linux _supported_fs xfs _require_cp_reflink _require_scratch_reflink +_require_xfs_scratch_rmapbt _require_error_injection _require_xfs_io_error_injection "rmap_finish_one" @@ -60,9 +61,6 @@ echo "Format filesystem" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - echo "Create files" _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2 diff --git a/tests/xfs/317 b/tests/xfs/317 index ac9f3ae..507c2a9 100755 --- a/tests/xfs/317 +++ b/tests/xfs/317 @@ -45,6 +45,7 @@ _cleanup() _supported_os Linux _supported_fs xfs _require_scratch +_require_xfs_scratch_rmapbt _require_error_injection _require_xfs_io_error_injection "rmap_finish_one" @@ -57,9 +58,6 @@ echo "Format filesystem" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - echo "Create files" touch $SCRATCH_MNT/file1 _pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file0 >> $seqres.full diff --git a/tests/xfs/322 b/tests/xfs/322 index 0dddb1f..ef402c8 100755 --- a/tests/xfs/322 +++ b/tests/xfs/322 @@ -48,6 +48,7 @@ _supported_os Linux _supported_fs xfs _require_cp_reflink _require_scratch_reflink +_require_xfs_scratch_rmapbt _require_xfs_io_error_injection "rmap_finish_one" rm -f $seqres.full @@ -59,9 +60,6 @@ echo "Format filesystem" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - echo "Create files" _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full $XFS_IO_PROG -f -c "truncate $sz" $SCRATCH_MNT/file3 >> $seqres.full
Don't open-code _notrun checks for the rmapbt, just use the helper. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/310 | 4 +--- tests/xfs/314 | 4 +--- tests/xfs/317 | 4 +--- tests/xfs/322 | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/xfs/310 b/tests/xfs/310 index 36b683c..bfdec39 100755 --- a/tests/xfs/310 +++ b/tests/xfs/310 @@ -47,6 +47,7 @@ _cleanup() _supported_os Linux _supported_fs xfs _require_scratch +_require_xfs_scratch_rmapbt _require_xfs_io_command "falloc" rm -f $seqres.full @@ -56,9 +57,6 @@ echo "Figure out block size" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - testdir=$SCRATCH_MNT/test-$seq blksz="$(stat -f $SCRATCH_MNT -c '%S')" diff --git a/tests/xfs/314 b/tests/xfs/314 index 6b867b8..ec16c6f 100755 --- a/tests/xfs/314 +++ b/tests/xfs/314 @@ -48,6 +48,7 @@ _supported_os Linux _supported_fs xfs _require_cp_reflink _require_scratch_reflink +_require_xfs_scratch_rmapbt _require_error_injection _require_xfs_io_error_injection "rmap_finish_one" @@ -60,9 +61,6 @@ echo "Format filesystem" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - echo "Create files" _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2 diff --git a/tests/xfs/317 b/tests/xfs/317 index ac9f3ae..507c2a9 100755 --- a/tests/xfs/317 +++ b/tests/xfs/317 @@ -45,6 +45,7 @@ _cleanup() _supported_os Linux _supported_fs xfs _require_scratch +_require_xfs_scratch_rmapbt _require_error_injection _require_xfs_io_error_injection "rmap_finish_one" @@ -57,9 +58,6 @@ echo "Format filesystem" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - echo "Create files" touch $SCRATCH_MNT/file1 _pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file0 >> $seqres.full diff --git a/tests/xfs/322 b/tests/xfs/322 index 0dddb1f..ef402c8 100755 --- a/tests/xfs/322 +++ b/tests/xfs/322 @@ -48,6 +48,7 @@ _supported_os Linux _supported_fs xfs _require_cp_reflink _require_scratch_reflink +_require_xfs_scratch_rmapbt _require_xfs_io_error_injection "rmap_finish_one" rm -f $seqres.full @@ -59,9 +60,6 @@ echo "Format filesystem" _scratch_mkfs >/dev/null 2>&1 _scratch_mount >> $seqres.full -is_rmap=$(xfs_info $SCRATCH_MNT | grep -c "rmapbt=1") -test $is_rmap -gt 0 || _notrun "rmap not supported on scratch fs" - echo "Create files" _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full $XFS_IO_PROG -f -c "truncate $sz" $SCRATCH_MNT/file3 >> $seqres.full _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Fix the calculation of the dmhuge size. The previous calculation tried to calculate the size correctly, but got it wrong for 1k block sizes. Therefore, clean the whole mess up. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/310 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/xfs/310 b/tests/xfs/310 index bfdec39..5125773 100755 --- a/tests/xfs/310 +++ b/tests/xfs/310 @@ -63,7 +63,9 @@ blksz="$(stat -f $SCRATCH_MNT -c '%S')" umount $SCRATCH_MNT echo "Format huge device" -_dmhugedisk_init $((blksz * 2 * 4400)) # a little over 2^22 blocks +nr_blks=2100000 # 2^21 plus a little more +sectors=$(( (nr_blks * 3) * blksz / 512 )) # each AG must have > 2^21 blocks +_dmhugedisk_init $sectors _mkfs_dev -d agcount=2 $DMHUGEDISK_DEV _mount $DMHUGEDISK_DEV $SCRATCH_MNT xfs_info $SCRATCH_MNT >> $seqres.full @@ -71,7 +73,6 @@ xfs_info $SCRATCH_MNT >> $seqres.full echo "Create the original file blocks" mkdir $testdir blksz="$(stat -f $testdir -c '%S')" -nr_blks=2100000 # 2^21 plus a little more $XFS_IO_PROG -f -c "falloc 0 $((nr_blks * blksz))" $testdir/file1 >> $seqres.full echo "Check extent count"
Fix the calculation of the dmhuge size. The previous calculation tried to calculate the size correctly, but got it wrong for 1k block sizes. Therefore, clean the whole mess up. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/310 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/xfs/310 b/tests/xfs/310 index bfdec39..5125773 100755 --- a/tests/xfs/310 +++ b/tests/xfs/310 @@ -63,7 +63,9 @@ blksz="$(stat -f $SCRATCH_MNT -c '%S')" umount $SCRATCH_MNT echo "Format huge device" -_dmhugedisk_init $((blksz * 2 * 4400)) # a little over 2^22 blocks +nr_blks=2100000 # 2^21 plus a little more +sectors=$(( (nr_blks * 3) * blksz / 512 )) # each AG must have > 2^21 blocks +_dmhugedisk_init $sectors _mkfs_dev -d agcount=2 $DMHUGEDISK_DEV _mount $DMHUGEDISK_DEV $SCRATCH_MNT xfs_info $SCRATCH_MNT >> $seqres.full @@ -71,7 +73,6 @@ xfs_info $SCRATCH_MNT >> $seqres.full echo "Create the original file blocks" mkdir $testdir blksz="$(stat -f $testdir -c '%S')" -nr_blks=2100000 # 2^21 plus a little more $XFS_IO_PROG -f -c "falloc 0 $((nr_blks * blksz))" $testdir/file1 >> $seqres.full echo "Check extent count" _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
List the new log redo items. These should have stable sizes. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/122.out | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index ebc4421..c4ed725 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -60,7 +60,11 @@ sizeof(struct xfs_attr3_leaf_hdr) = 80 sizeof(struct xfs_attr3_leafblock) = 88 sizeof(struct xfs_attr3_rmt_hdr) = 56 sizeof(struct xfs_btree_block) = 72 +sizeof(struct xfs_bud_log_format) = 48 +sizeof(struct xfs_bui_log_format) = 48 sizeof(struct xfs_clone_args) = 32 +sizeof(struct xfs_cud_log_format) = 32 +sizeof(struct xfs_cui_log_format) = 32 sizeof(struct xfs_da3_blkinfo) = 56 sizeof(struct xfs_da3_intnode) = 64 sizeof(struct xfs_da3_node_hdr) = 64 @@ -76,10 +80,14 @@ sizeof(struct xfs_extent_data_info) = 32 sizeof(struct xfs_fs_eofblocks) = 128 sizeof(struct xfs_icreate_log) = 28 sizeof(struct xfs_log_dinode) = 176 +sizeof(struct xfs_map_extent) = 32 +sizeof(struct xfs_phys_extent) = 16 sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rud_log_format) = 48 +sizeof(struct xfs_rui_log_format) = 48 sizeof(xfs_agf_t) = 224 sizeof(xfs_agfl_t) = 36 sizeof(xfs_agi_t) = 336
List the new log redo items. These should have stable sizes. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/122.out | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index ebc4421..c4ed725 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -60,7 +60,11 @@ sizeof(struct xfs_attr3_leaf_hdr) = 80 sizeof(struct xfs_attr3_leafblock) = 88 sizeof(struct xfs_attr3_rmt_hdr) = 56 sizeof(struct xfs_btree_block) = 72 +sizeof(struct xfs_bud_log_format) = 48 +sizeof(struct xfs_bui_log_format) = 48 sizeof(struct xfs_clone_args) = 32 +sizeof(struct xfs_cud_log_format) = 32 +sizeof(struct xfs_cui_log_format) = 32 sizeof(struct xfs_da3_blkinfo) = 56 sizeof(struct xfs_da3_intnode) = 64 sizeof(struct xfs_da3_node_hdr) = 64 @@ -76,10 +80,14 @@ sizeof(struct xfs_extent_data_info) = 32 sizeof(struct xfs_fs_eofblocks) = 128 sizeof(struct xfs_icreate_log) = 28 sizeof(struct xfs_log_dinode) = 176 +sizeof(struct xfs_map_extent) = 32 +sizeof(struct xfs_phys_extent) = 16 sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rud_log_format) = 48 +sizeof(struct xfs_rui_log_format) = 48 sizeof(xfs_agf_t) = 224 sizeof(xfs_agfl_t) = 36 sizeof(xfs_agi_t) = 336 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
In _require_scratch_dedupe, test the scratch device, not the testdev. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/reflink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/reflink b/common/reflink index 4ec390d..1363971 100644 --- a/common/reflink +++ b/common/reflink @@ -107,7 +107,7 @@ _require_scratch_dedupe() _scratch_mount "$XFS_IO_PROG" -f -c "pwrite -S 0x61 0 65536" "$SCRATCH_MNT/file1" > /dev/null "$XFS_IO_PROG" -f -c "pwrite -S 0x61 0 65536" "$SCRATCH_MNT/file2" > /dev/null - testio="$("$XFS_IO_PROG" -f -c "dedupe $TEST_DIR/file1 0 0 65536" "$TEST_DIR/file2" 2>&1)" + testio="$("$XFS_IO_PROG" -f -c "dedupe $SCRATCH_MNT/file1 0 0 65536" "$SCRATCH_MNT/file2" 2>&1)" echo $testio | grep -q "Operation not supported" && \ _notrun "Dedupe not supported by test filesystem type: $FSTYP" echo $testio | grep -q "Inappropriate ioctl for device" && \
In _require_scratch_dedupe, test the scratch device, not the testdev. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/reflink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/reflink b/common/reflink index 4ec390d..1363971 100644 --- a/common/reflink +++ b/common/reflink @@ -107,7 +107,7 @@ _require_scratch_dedupe() _scratch_mount "$XFS_IO_PROG" -f -c "pwrite -S 0x61 0 65536" "$SCRATCH_MNT/file1" > /dev/null "$XFS_IO_PROG" -f -c "pwrite -S 0x61 0 65536" "$SCRATCH_MNT/file2" > /dev/null - testio="$("$XFS_IO_PROG" -f -c "dedupe $TEST_DIR/file1 0 0 65536" "$TEST_DIR/file2" 2>&1)" + testio="$("$XFS_IO_PROG" -f -c "dedupe $SCRATCH_MNT/file1 0 0 65536" "$SCRATCH_MNT/file2" 2>&1)" echo $testio | grep -q "Operation not supported" && \ _notrun "Dedupe not supported by test filesystem type: $FSTYP" echo $testio | grep -q "Inappropriate ioctl for device" && \ _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Run xfs_repair twice at the end of each test -- once to rebuild the btree indices, and again with -n to check the rebuild work. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- README | 4 ++++ common/rc | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/README b/README index 2647e12..4509cc1 100644 --- a/README +++ b/README @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): added to the end of fsstresss and fsx invocations, respectively, in case you wish to exclude certain operational modes from these tests. + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem + run xfs_repair -n to check the filesystem; xfs_repair to rebuild + metadata indexes; and xfs_repair -n (a third time) to check the + results of the rebuilding. - or add a case to the switch in common/config assigning these variables based on the hostname of your test diff --git a/common/rc b/common/rc index 7c79bf8..3b45578 100644 --- a/common/rc +++ b/common/rc @@ -2428,6 +2428,36 @@ _check_xfs_filesystem() ok=0 fi + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full + echo "*** xfs_repair -n output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full + echo "*** xfs_repair -n output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + fi + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 if [ $? -ne 0 ] then
Run xfs_repair twice at the end of each test -- once to rebuild the btree indices, and again with -n to check the rebuild work. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- README | 4 ++++ common/rc | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/README b/README index 2647e12..4509cc1 100644 --- a/README +++ b/README @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): added to the end of fsstresss and fsx invocations, respectively, in case you wish to exclude certain operational modes from these tests. + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem + run xfs_repair -n to check the filesystem; xfs_repair to rebuild + metadata indexes; and xfs_repair -n (a third time) to check the + results of the rebuilding. - or add a case to the switch in common/config assigning these variables based on the hostname of your test diff --git a/common/rc b/common/rc index 7c79bf8..3b45578 100644 --- a/common/rc +++ b/common/rc @@ -2428,6 +2428,36 @@ _check_xfs_filesystem() ok=0 fi + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full + echo "*** xfs_repair -n output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full + echo "*** xfs_repair -n output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + fi + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 if [ $? -ne 0 ] then _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
This test uses the scratch device, so cycle that, not the test dev. This is also a xfs_fsr test, so put it in the fsr group. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/128 | 7 ++++--- tests/xfs/group | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/xfs/128 b/tests/xfs/128 index 8758d7e..2e756d5 100755 --- a/tests/xfs/128 +++ b/tests/xfs/128 @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file2 _cp_reflink $testdir/file2 $testdir/file3 _cp_reflink $testdir/file3 $testdir/file4 -_test_cycle_mount +_scratch_cycle_mount free_blocks1=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) echo "CoW the reflink copies" _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full -_test_cycle_mount +_scratch_cycle_mount free_blocks2=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -97,11 +97,12 @@ c14=$(_md5_checksum $testdir/file4) echo "Defragment" lsattr -l $testdir/ | _filter_scratch | _filter_spaces +filefrag -v $testdir/file* >> $seqres.full $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file -_test_cycle_mount +_scratch_cycle_mount free_blocks3=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch diff --git a/tests/xfs/group b/tests/xfs/group index aa3b3ec..5ccf3d6 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -125,7 +125,7 @@ 125 fuzzers 126 fuzzers 127 auto quick clone -128 auto quick clone +128 auto quick clone fsr 129 auto quick clone 130 fuzzers clone 131 auto quick clone
This test uses the scratch device, so cycle that, not the test dev. This is also a xfs_fsr test, so put it in the fsr group. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/128 | 7 ++++--- tests/xfs/group | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/xfs/128 b/tests/xfs/128 index 8758d7e..2e756d5 100755 --- a/tests/xfs/128 +++ b/tests/xfs/128 @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file2 _cp_reflink $testdir/file2 $testdir/file3 _cp_reflink $testdir/file3 $testdir/file4 -_test_cycle_mount +_scratch_cycle_mount free_blocks1=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) echo "CoW the reflink copies" _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full -_test_cycle_mount +_scratch_cycle_mount free_blocks2=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -97,11 +97,12 @@ c14=$(_md5_checksum $testdir/file4) echo "Defragment" lsattr -l $testdir/ | _filter_scratch | _filter_spaces +filefrag -v $testdir/file* >> $seqres.full $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file -_test_cycle_mount +_scratch_cycle_mount free_blocks3=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch diff --git a/tests/xfs/group b/tests/xfs/group index aa3b3ec..5ccf3d6 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -125,7 +125,7 @@ 125 fuzzers 126 fuzzers 127 auto quick clone -128 auto quick clone +128 auto quick clone fsr 129 auto quick clone 130 fuzzers clone 131 auto quick clone _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Use the standard _scratch_mount to mount the filesystem from the restored image, instead of trying to call mount directly. This is needed in case we had custom mount options (like rtdev). Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/129 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/xfs/129 b/tests/xfs/129 index d29f842..17ff238 100755 --- a/tests/xfs/129 +++ b/tests/xfs/129 @@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _scratch_unmount > /dev/null 2>&1 rm -rf $tmp.* $testdir $metadump_file $TEST_DIR/image } @@ -76,8 +76,8 @@ _scratch_metadump $metadump_file # Now restore the obfuscated one back and take a look around echo "Restore metadump" xfs_mdrestore $metadump_file $TEST_DIR/image -_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT -umount $SCRATCH_MNT +SCRATCH_DEV=$TEST_DIR/image _scratch_mount +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount echo "Check restored fs" _check_generic_filesystem $metadump_file
Use the standard _scratch_mount to mount the filesystem from the restored image, instead of trying to call mount directly. This is needed in case we had custom mount options (like rtdev). Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/129 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/xfs/129 b/tests/xfs/129 index d29f842..17ff238 100755 --- a/tests/xfs/129 +++ b/tests/xfs/129 @@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _scratch_unmount > /dev/null 2>&1 rm -rf $tmp.* $testdir $metadump_file $TEST_DIR/image } @@ -76,8 +76,8 @@ _scratch_metadump $metadump_file # Now restore the obfuscated one back and take a look around echo "Restore metadump" xfs_mdrestore $metadump_file $TEST_DIR/image -_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT -umount $SCRATCH_MNT +SCRATCH_DEV=$TEST_DIR/image _scratch_mount +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount echo "Check restored fs" _check_generic_filesystem $metadump_file _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Calling _mount doesn't work when we want to add mount options such as realtime devices. Since it's just a normal scratch device mount except for the source device, just call _scratch_mount with SCRATCH_DEV set to the dmerror device. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/dmerror | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/common/dmerror b/common/dmerror index 5ad9994..22b9ea9 100644 --- a/common/dmerror +++ b/common/dmerror @@ -41,14 +41,9 @@ _dmerror_init() DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" } -_dmerror_mount_options() -{ - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT -} - _dmerror_mount() { - _mount -t $FSTYP `_dmerror_mount_options $*` + SCRATCH_DEV=$DMERROR_DEV _scratch_mount $* } _dmerror_unmount()
Calling _mount doesn't work when we want to add mount options such as realtime devices. Since it's just a normal scratch device mount except for the source device, just call _scratch_mount with SCRATCH_DEV set to the dmerror device. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/dmerror | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/common/dmerror b/common/dmerror index 5ad9994..22b9ea9 100644 --- a/common/dmerror +++ b/common/dmerror @@ -41,14 +41,9 @@ _dmerror_init() DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" } -_dmerror_mount_options() -{ - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT -} - _dmerror_mount() { - _mount -t $FSTYP `_dmerror_mount_options $*` + SCRATCH_DEV=$DMERROR_DEV _scratch_mount $* } _dmerror_unmount() _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Use the helper functions for scratch devices. This fixes a problem where xfs/179 fails when there's a realtime device. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/179 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/xfs/179 b/tests/xfs/179 index e0b0af8..18459cb 100755 --- a/tests/xfs/179 +++ b/tests/xfs/179 @@ -65,7 +65,7 @@ _pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full echo "Change reference count" -umount $SCRATCH_MNT +_scratch_unmount echo "set refcount to -4" >> $seqres.full $XFS_DB_PROG -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' $SCRATCH_DEV >> $seqres.full echo "check refcount after setting to -4" >> $seqres.full @@ -80,7 +80,7 @@ _cp_reflink $testdir/file1 $testdir/file6 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file7 >> $seqres.full echo "Check scratch fs" -umount $SCRATCH_MNT +_scratch_unmount echo "check refcount after reflinking 5 more times" >> $seqres.full $XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full _scratch_mount >> $seqres.full @@ -91,7 +91,7 @@ _pwrite_byte 0x62 0 $blksz $testdir/file5 >> $seqres.full _pwrite_byte 0x62 0 $blksz $testdir/file7 >> $seqres.full echo "Check scratch fs" -umount $SCRATCH_MNT +_scratch_unmount echo "check refcount after cowing 3 files" >> $seqres.full $XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full _scratch_mount >> $seqres.full @@ -100,10 +100,10 @@ echo "Remove reflinked files" rm -rf $testdir/file* echo "Check scratch fs" -umount $SCRATCH_MNT +_scratch_unmount echo "check refcount after removing all files" >> $seqres.full $XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full -$XFS_REPAIR_PROG -o force_geometry -n $SCRATCH_DEV >> $seqres.full 2>&1 +_scratch_xfs_repair -o force_geometry -n >> $seqres.full 2>&1 res=$? if [ $res -eq 0 ]; then # If repair succeeds then format the device so that the post-test
Use the helper functions for scratch devices. This fixes a problem where xfs/179 fails when there's a realtime device. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/179 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/xfs/179 b/tests/xfs/179 index e0b0af8..18459cb 100755 --- a/tests/xfs/179 +++ b/tests/xfs/179 @@ -65,7 +65,7 @@ _pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full echo "Change reference count" -umount $SCRATCH_MNT +_scratch_unmount echo "set refcount to -4" >> $seqres.full $XFS_DB_PROG -x -c 'agf 0' -c 'addr refcntroot' -c 'write recs[1].refcount 4294967292' $SCRATCH_DEV >> $seqres.full echo "check refcount after setting to -4" >> $seqres.full @@ -80,7 +80,7 @@ _cp_reflink $testdir/file1 $testdir/file6 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file7 >> $seqres.full echo "Check scratch fs" -umount $SCRATCH_MNT +_scratch_unmount echo "check refcount after reflinking 5 more times" >> $seqres.full $XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full _scratch_mount >> $seqres.full @@ -91,7 +91,7 @@ _pwrite_byte 0x62 0 $blksz $testdir/file5 >> $seqres.full _pwrite_byte 0x62 0 $blksz $testdir/file7 >> $seqres.full echo "Check scratch fs" -umount $SCRATCH_MNT +_scratch_unmount echo "check refcount after cowing 3 files" >> $seqres.full $XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full _scratch_mount >> $seqres.full @@ -100,10 +100,10 @@ echo "Remove reflinked files" rm -rf $testdir/file* echo "Check scratch fs" -umount $SCRATCH_MNT +_scratch_unmount echo "check refcount after removing all files" >> $seqres.full $XFS_DB_PROG -c 'agf 0' -c 'addr refcntroot' -c 'p recs[1]' $SCRATCH_DEV >> $seqres.full -$XFS_REPAIR_PROG -o force_geometry -n $SCRATCH_DEV >> $seqres.full 2>&1 +_scratch_xfs_repair -o force_geometry -n >> $seqres.full 2>&1 res=$? if [ $res -eq 0 ]; then # If repair succeeds then format the device so that the post-test _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Use the helper functions for scratch devices. This fixes a problem where xfs/234 fails when there's a realtime device. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/234 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/xfs/234 b/tests/xfs/234 index 2bbf295..8dadc34 100755 --- a/tests/xfs/234 +++ b/tests/xfs/234 @@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _scratch_unmount > /dev/null 2>&1 rm -rf $tmp.* $metadump_file $TEST_DIR/image } @@ -76,8 +76,8 @@ _scratch_metadump $metadump_file # Now restore the obfuscated one back and take a look around echo "Restore metadump" xfs_mdrestore $metadump_file $TEST_DIR/image -_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT -umount $SCRATCH_MNT +SCRATCH_DEV=$TEST_DIR/image _scratch_mount +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount echo "Check restored fs" _check_generic_filesystem $metadump_file
Use the helper functions for scratch devices. This fixes a problem where xfs/234 fails when there's a realtime device. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/234 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/xfs/234 b/tests/xfs/234 index 2bbf295..8dadc34 100755 --- a/tests/xfs/234 +++ b/tests/xfs/234 @@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _scratch_unmount > /dev/null 2>&1 rm -rf $tmp.* $metadump_file $TEST_DIR/image } @@ -76,8 +76,8 @@ _scratch_metadump $metadump_file # Now restore the obfuscated one back and take a look around echo "Restore metadump" xfs_mdrestore $metadump_file $TEST_DIR/image -_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT -umount $SCRATCH_MNT +SCRATCH_DEV=$TEST_DIR/image _scratch_mount +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount echo "Check restored fs" _check_generic_filesystem $metadump_file _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Test sharing blocks via reflink and dedupe between two different mountpoints of the same filesystem. This shouldn't work, since we don't allow cross-mountpoint functions. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/generic/927 | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/927.out | 9 +++++ tests/generic/928 | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/928.out | 10 ++++++ tests/generic/group | 2 + 5 files changed, 195 insertions(+) create mode 100755 tests/generic/927 create mode 100644 tests/generic/927.out create mode 100755 tests/generic/928 create mode 100644 tests/generic/928.out diff --git a/tests/generic/927 b/tests/generic/927 new file mode 100755 index 0000000..c7d82b7 --- /dev/null +++ b/tests/generic/927 @@ -0,0 +1,88 @@ +#! /bin/bash +# FS QA Test No. 927 +# +# Check that cross-mountpoint reflink doesn't work. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir +otherdir=/tmp/m.$seq +othertestdir=$otherdir/test-$seq +rm -rf $otherdir +mkdir $otherdir + +blocks=1 +blksz=65536 +sz=$((blksz * blocks)) + +echo "Mount otherdir" +SCRATCH_MNT=$otherdir _scratch_mount + +echo "Create file" +_pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full + +filter_md5() { + _filter_scratch | sed -e "s,$otherdir,OTHER_DIR,g" +} + +echo "Reflink one file to another" +_cp_reflink $testdir/file $othertestdir/otherfiles 2>&1 | filter_md5 + +echo "Check output" +md5sum $testdir/file | _filter_scratch +test -e $othertestdir/otherfile && echo "otherfile should not exist" + +echo "Unmount otherdir" +SCRATCH_MNT=$otherdir _scratch_unmount +rm -rf $otherdir + +# success, all done +status=0 +exit diff --git a/tests/generic/927.out b/tests/generic/927.out new file mode 100644 index 0000000..3ef3057 --- /dev/null +++ b/tests/generic/927.out @@ -0,0 +1,9 @@ +QA output created by 927 +Format and mount +Mount otherdir +Create file +Reflink one file to another +cp: failed to clone 'OTHER_DIR/test-927/otherfiles' from 'SCRATCH_MNT/test-927/file': Invalid cross-device link +Check output +2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-927/file +Unmount otherdir diff --git a/tests/generic/928 b/tests/generic/928 new file mode 100755 index 0000000..86268e7 --- /dev/null +++ b/tests/generic/928 @@ -0,0 +1,86 @@ +#! /bin/bash +# FS QA Test No. 928 +# +# Check that cross-mountpoint dedupe doesn't work. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_dedupe + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir +otherdir=/tmp/m.$seq +othertestdir=$otherdir/test-$seq +rm -rf $otherdir +mkdir $otherdir + +blocks=1 +blksz=65536 +sz=$((blocks * blksz)) + +echo "Mount otherdir" +SCRATCH_MNT=$otherdir _scratch_mount + +echo "Create file" +_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 + +filter_md5() { + _filter_scratch | sed -e "s,$otherdir,OTHER_DIR,g" +} +echo "Check output" +md5sum $testdir/file $othertestdir/otherfile | filter_md5 + +echo "Unmount otherdir" +SCRATCH_MNT=$otherdir _scratch_unmount +rm -rf $otherdir + +# success, all done +status=0 +exit diff --git a/tests/generic/928.out b/tests/generic/928.out new file mode 100644 index 0000000..ef35c5b --- /dev/null +++ b/tests/generic/928.out @@ -0,0 +1,10 @@ +QA output created by 928 +Format and mount +Mount otherdir +Create file +Dedupe one file to another +dedupe: Invalid cross-device link +Check output +2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-928/file +2d61aa54b58c2e94403fb092c3dbc027 OTHER_DIR/test-928/otherfile +Unmount otherdir diff --git a/tests/generic/group b/tests/generic/group index 97ecb65..18b9775 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -373,3 +373,5 @@ 368 auto quick richacl 369 auto quick richacl 370 auto quick richacl +927 auto quick clone +928 auto quick clone dedupe
Test sharing blocks via reflink and dedupe between two different mountpoints of the same filesystem. This shouldn't work, since we don't allow cross-mountpoint functions. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/generic/927 | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/927.out | 9 +++++ tests/generic/928 | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/928.out | 10 ++++++ tests/generic/group | 2 + 5 files changed, 195 insertions(+) create mode 100755 tests/generic/927 create mode 100644 tests/generic/927.out create mode 100755 tests/generic/928 create mode 100644 tests/generic/928.out diff --git a/tests/generic/927 b/tests/generic/927 new file mode 100755 index 0000000..c7d82b7 --- /dev/null +++ b/tests/generic/927 @@ -0,0 +1,88 @@ +#! /bin/bash +# FS QA Test No. 927 +# +# Check that cross-mountpoint reflink doesn't work. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir +otherdir=/tmp/m.$seq +othertestdir=$otherdir/test-$seq +rm -rf $otherdir +mkdir $otherdir + +blocks=1 +blksz=65536 +sz=$((blksz * blocks)) + +echo "Mount otherdir" +SCRATCH_MNT=$otherdir _scratch_mount + +echo "Create file" +_pwrite_byte 0x61 0 $sz $testdir/file >> $seqres.full + +filter_md5() { + _filter_scratch | sed -e "s,$otherdir,OTHER_DIR,g" +} + +echo "Reflink one file to another" +_cp_reflink $testdir/file $othertestdir/otherfiles 2>&1 | filter_md5 + +echo "Check output" +md5sum $testdir/file | _filter_scratch +test -e $othertestdir/otherfile && echo "otherfile should not exist" + +echo "Unmount otherdir" +SCRATCH_MNT=$otherdir _scratch_unmount +rm -rf $otherdir + +# success, all done +status=0 +exit diff --git a/tests/generic/927.out b/tests/generic/927.out new file mode 100644 index 0000000..3ef3057 --- /dev/null +++ b/tests/generic/927.out @@ -0,0 +1,9 @@ +QA output created by 927 +Format and mount +Mount otherdir +Create file +Reflink one file to another +cp: failed to clone 'OTHER_DIR/test-927/otherfiles' from 'SCRATCH_MNT/test-927/file': Invalid cross-device link +Check output +2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-927/file +Unmount otherdir diff --git a/tests/generic/928 b/tests/generic/928 new file mode 100755 index 0000000..86268e7 --- /dev/null +++ b/tests/generic/928 @@ -0,0 +1,86 @@ +#! /bin/bash +# FS QA Test No. 928 +# +# Check that cross-mountpoint dedupe doesn't work. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_dedupe + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir +otherdir=/tmp/m.$seq +othertestdir=$otherdir/test-$seq +rm -rf $otherdir +mkdir $otherdir + +blocks=1 +blksz=65536 +sz=$((blocks * blksz)) + +echo "Mount otherdir" +SCRATCH_MNT=$otherdir _scratch_mount + +echo "Create file" +_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 + +filter_md5() { + _filter_scratch | sed -e "s,$otherdir,OTHER_DIR,g" +} +echo "Check output" +md5sum $testdir/file $othertestdir/otherfile | filter_md5 + +echo "Unmount otherdir" +SCRATCH_MNT=$otherdir _scratch_unmount +rm -rf $otherdir + +# success, all done +status=0 +exit diff --git a/tests/generic/928.out b/tests/generic/928.out new file mode 100644 index 0000000..ef35c5b --- /dev/null +++ b/tests/generic/928.out @@ -0,0 +1,10 @@ +QA output created by 928 +Format and mount +Mount otherdir +Create file +Dedupe one file to another +dedupe: Invalid cross-device link +Check output +2d61aa54b58c2e94403fb092c3dbc027 SCRATCH_MNT/test-928/file +2d61aa54b58c2e94403fb092c3dbc027 OTHER_DIR/test-928/otherfile +Unmount otherdir diff --git a/tests/generic/group b/tests/generic/group index 97ecb65..18b9775 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -373,3 +373,5 @@ 368 auto quick richacl 369 auto quick richacl 370 auto quick richacl +927 auto quick clone +928 auto quick clone dedupe _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Add a few tests to stress the new swapext code for reflink and rmap. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/873 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/873.out | 6 +++ tests/xfs/874 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/874.out | 10 +++++ tests/xfs/875 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/875.out | 12 ++++++ tests/xfs/group | 3 + 7 files changed, 337 insertions(+) create mode 100755 tests/xfs/873 create mode 100644 tests/xfs/873.out create mode 100755 tests/xfs/874 create mode 100644 tests/xfs/874.out create mode 100755 tests/xfs/875 create mode 100644 tests/xfs/875.out diff --git a/tests/xfs/873 b/tests/xfs/873 new file mode 100755 index 0000000..a980148 --- /dev/null +++ b/tests/xfs/873 @@ -0,0 +1,107 @@ +#! /bin/bash +# FS QA Test No. 873 +# +# See how well xfs_fsr handles "defragging" a file with a hojillion extents. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink +_require_test_program "punch-alternating" +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +testdir="$SCRATCH_MNT/test-$seq" +mkdir "$testdir" + +# Setup for 16000 blocks, but we'll accept stress testing down to +# 2^10 blocks... that should be plenty for anyone. +fnr=$((12 + LOAD_FACTOR)) +free_blocks=$(stat -f -c '%a' "$testdir") +blksz=$(stat -f -c '%S' "$testdir") +space_avail=$((free_blocks * blksz)) +calc_space() { + blocks_needed=$(( 2 ** (fnr + 1) )) + space_needed=$((blocks_needed * blksz * 5 / 4)) +} +calc_space +while test $space_needed -gt $space_avail; do + fnr=$((fnr - 1)) + calc_space +done +test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents." +bytes=$((blocks_needed * blksz)) + +echo "Create a many-block file" +echo "creating $blocks_needed blocks..." >> "$seqres.full" +_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full" +echo "punching..." >> "$seqres.full" +"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full" +seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do + _reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full +done +echo "...done" >> "$seqres.full" +_scratch_cycle_mount + +echo "Reflink the big file" +echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full" +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" + +echo "Defrag the big file" +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) + +echo "Check extent count" +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" + +# success, all done +status=0 +exit diff --git a/tests/xfs/873.out b/tests/xfs/873.out new file mode 100644 index 0000000..9dddf55 --- /dev/null +++ b/tests/xfs/873.out @@ -0,0 +1,6 @@ +QA output created by 873 +Format and mount +Create a many-block file +Reflink the big file +Defrag the big file +Check extent count diff --git a/tests/xfs/874 b/tests/xfs/874 new file mode 100755 index 0000000..fb31ea8 --- /dev/null +++ b/tests/xfs/874 @@ -0,0 +1,99 @@ +#! /bin/bash +# FS QA Test No. 874 +# +# Ensure that xfs_fsr handles errors correctly while defragging files. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink +. ./common/quota +. ./common/inject + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" +_require_xfs_io_error_injection "bmap_finish_one" +_require_xfs_scratch_rmapbt + +_repquota() { + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' +} + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +testdir="$SCRATCH_MNT/test-$seq" +blksz=65536 +blks=3 +mkdir "$testdir" + +echo "Create a many-block file" +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full +_scratch_cycle_mount +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full + +echo "Inject error" +_scratch_inject_error "bmap_finish_one" + +echo "Defrag the file" +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1 + +echo "FS should be shut down, touch will fail" +touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch + +echo "Remount to replay log" | tee /dev/ttyprintk +_scratch_inject_logprint >> $seqres.full + +echo "Check extent count" | tee /dev/ttyprintk +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full + +echo "FS should be online, touch should succeed" +touch $SCRATCH_MNT/goodfs +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/874.out b/tests/xfs/874.out new file mode 100644 index 0000000..dbc0f49 --- /dev/null +++ b/tests/xfs/874.out @@ -0,0 +1,10 @@ +QA output created by 874 +Format and mount +Create a many-block file +Inject error +Defrag the file +FS should be shut down, touch will fail +touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error +Remount to replay log +Check extent count +FS should be online, touch should succeed diff --git a/tests/xfs/875 b/tests/xfs/875 new file mode 100755 index 0000000..17c28db --- /dev/null +++ b/tests/xfs/875 @@ -0,0 +1,100 @@ +#! /bin/bash +# FS QA Test No. 875 +# +# Ensure that xfs_fsr handles quota correctly while defragging files. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink +. ./common/quota + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" +_require_quota +_require_nobody + +_repquota() { + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' +} + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" +_scratch_mount >> "$seqres.full" 2>&1 +quotacheck -u -g $SCRATCH_MNT 2> /dev/null +quotaon $SCRATCH_MNT 2> /dev/null + +testdir="$SCRATCH_MNT/test-$seq" +blksz=65536 +blks=3 +mkdir "$testdir" + +echo "Create a many-block file" +touch $testdir/file1 +chown nobody $testdir/file1 +touch $testdir/file2 +chown nobody $testdir/file2 +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full +_repquota +_scratch_cycle_mount + +echo "Defrag the file" +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) +_repquota + +echo "Remount the FS to see if accounting changes" +_scratch_cycle_mount +_repquota + +echo "Check extent count" +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" + +# success, all done +status=0 +exit diff --git a/tests/xfs/875.out b/tests/xfs/875.out new file mode 100644 index 0000000..57653e9 --- /dev/null +++ b/tests/xfs/875.out @@ -0,0 +1,12 @@ +QA output created by 875 +Format and mount +Create a many-block file +root -- 0 0 0 4 0 0 +nobody -- 256 0 0 2 0 0 +Defrag the file +root -- 0 0 0 4 0 0 +nobody -- 256 0 0 2 0 0 +Remount the FS to see if accounting changes +root -- 0 0 0 4 0 0 +nobody -- 256 0 0 2 0 0 +Check extent count diff --git a/tests/xfs/group b/tests/xfs/group index 5ccf3d6..16f7947 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -306,3 +306,6 @@ 325 auto quick clone 326 auto quick clone 327 auto quick clone +873 auto quick clone fsr +874 auto quick clone fsr +875 auto quick clone fsr quota
Add a few tests to stress the new swapext code for reflink and rmap. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/873 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/873.out | 6 +++ tests/xfs/874 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/874.out | 10 +++++ tests/xfs/875 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/875.out | 12 ++++++ tests/xfs/group | 3 + 7 files changed, 337 insertions(+) create mode 100755 tests/xfs/873 create mode 100644 tests/xfs/873.out create mode 100755 tests/xfs/874 create mode 100644 tests/xfs/874.out create mode 100755 tests/xfs/875 create mode 100644 tests/xfs/875.out diff --git a/tests/xfs/873 b/tests/xfs/873 new file mode 100755 index 0000000..a980148 --- /dev/null +++ b/tests/xfs/873 @@ -0,0 +1,107 @@ +#! /bin/bash +# FS QA Test No. 873 +# +# See how well xfs_fsr handles "defragging" a file with a hojillion extents. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink +_require_test_program "punch-alternating" +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +testdir="$SCRATCH_MNT/test-$seq" +mkdir "$testdir" + +# Setup for 16000 blocks, but we'll accept stress testing down to +# 2^10 blocks... that should be plenty for anyone. +fnr=$((12 + LOAD_FACTOR)) +free_blocks=$(stat -f -c '%a' "$testdir") +blksz=$(stat -f -c '%S' "$testdir") +space_avail=$((free_blocks * blksz)) +calc_space() { + blocks_needed=$(( 2 ** (fnr + 1) )) + space_needed=$((blocks_needed * blksz * 5 / 4)) +} +calc_space +while test $space_needed -gt $space_avail; do + fnr=$((fnr - 1)) + calc_space +done +test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents." +bytes=$((blocks_needed * blksz)) + +echo "Create a many-block file" +echo "creating $blocks_needed blocks..." >> "$seqres.full" +_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full" +echo "punching..." >> "$seqres.full" +"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full" +seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do + _reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full +done +echo "...done" >> "$seqres.full" +_scratch_cycle_mount + +echo "Reflink the big file" +echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full" +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" + +echo "Defrag the big file" +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) + +echo "Check extent count" +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" + +# success, all done +status=0 +exit diff --git a/tests/xfs/873.out b/tests/xfs/873.out new file mode 100644 index 0000000..9dddf55 --- /dev/null +++ b/tests/xfs/873.out @@ -0,0 +1,6 @@ +QA output created by 873 +Format and mount +Create a many-block file +Reflink the big file +Defrag the big file +Check extent count diff --git a/tests/xfs/874 b/tests/xfs/874 new file mode 100755 index 0000000..fb31ea8 --- /dev/null +++ b/tests/xfs/874 @@ -0,0 +1,99 @@ +#! /bin/bash +# FS QA Test No. 874 +# +# Ensure that xfs_fsr handles errors correctly while defragging files. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink +. ./common/quota +. ./common/inject + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" +_require_xfs_io_error_injection "bmap_finish_one" +_require_xfs_scratch_rmapbt + +_repquota() { + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' +} + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +testdir="$SCRATCH_MNT/test-$seq" +blksz=65536 +blks=3 +mkdir "$testdir" + +echo "Create a many-block file" +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full +_scratch_cycle_mount +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full + +echo "Inject error" +_scratch_inject_error "bmap_finish_one" + +echo "Defrag the file" +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1 + +echo "FS should be shut down, touch will fail" +touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch + +echo "Remount to replay log" | tee /dev/ttyprintk +_scratch_inject_logprint >> $seqres.full + +echo "Check extent count" | tee /dev/ttyprintk +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full + +echo "FS should be online, touch should succeed" +touch $SCRATCH_MNT/goodfs +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/874.out b/tests/xfs/874.out new file mode 100644 index 0000000..dbc0f49 --- /dev/null +++ b/tests/xfs/874.out @@ -0,0 +1,10 @@ +QA output created by 874 +Format and mount +Create a many-block file +Inject error +Defrag the file +FS should be shut down, touch will fail +touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error +Remount to replay log +Check extent count +FS should be online, touch should succeed diff --git a/tests/xfs/875 b/tests/xfs/875 new file mode 100755 index 0000000..17c28db --- /dev/null +++ b/tests/xfs/875 @@ -0,0 +1,100 @@ +#! /bin/bash +# FS QA Test No. 875 +# +# Ensure that xfs_fsr handles quota correctly while defragging files. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink +. ./common/quota + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" +_require_quota +_require_nobody + +_repquota() { + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' +} + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" +_scratch_mount >> "$seqres.full" 2>&1 +quotacheck -u -g $SCRATCH_MNT 2> /dev/null +quotaon $SCRATCH_MNT 2> /dev/null + +testdir="$SCRATCH_MNT/test-$seq" +blksz=65536 +blks=3 +mkdir "$testdir" + +echo "Create a many-block file" +touch $testdir/file1 +chown nobody $testdir/file1 +touch $testdir/file2 +chown nobody $testdir/file2 +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full +_repquota +_scratch_cycle_mount + +echo "Defrag the file" +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) +_repquota + +echo "Remount the FS to see if accounting changes" +_scratch_cycle_mount +_repquota + +echo "Check extent count" +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" + +# success, all done +status=0 +exit diff --git a/tests/xfs/875.out b/tests/xfs/875.out new file mode 100644 index 0000000..57653e9 --- /dev/null +++ b/tests/xfs/875.out @@ -0,0 +1,12 @@ +QA output created by 875 +Format and mount +Create a many-block file +root -- 0 0 0 4 0 0 +nobody -- 256 0 0 2 0 0 +Defrag the file +root -- 0 0 0 4 0 0 +nobody -- 256 0 0 2 0 0 +Remount the FS to see if accounting changes +root -- 0 0 0 4 0 0 +nobody -- 256 0 0 2 0 0 +Check extent count diff --git a/tests/xfs/group b/tests/xfs/group index 5ccf3d6..16f7947 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -306,3 +306,6 @@ 325 auto quick clone 326 auto quick clone 327 auto quick clone +873 auto quick clone fsr +874 auto quick clone fsr +875 auto quick clone fsr quota _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
More tests for the reverse mapping functionality. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/876 | 76 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/876.out | 4 ++ tests/xfs/877 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/877.out | 10 ++++++ tests/xfs/group | 4 ++ 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100755 tests/xfs/876 create mode 100644 tests/xfs/876.out create mode 100755 tests/xfs/877 create mode 100644 tests/xfs/877.out diff --git a/tests/xfs/876 b/tests/xfs/876 new file mode 100755 index 0000000..cf73d40 --- /dev/null +++ b/tests/xfs/876 @@ -0,0 +1,76 @@ +#! /bin/bash +# FS QA Test No. 876 +# +# Create a big enough rmapbt that we tickle a fdblocks accounting bug. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch +_require_xfs_scratch_rmapbt +_require_scratch_reflink +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "+ create scratch fs" +_scratch_mkfs > "$seqres.full" 2>&1 + +echo "+ mount fs image" +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +bt_ptrs=$(( (blksz - 56) / 44 )) +bt_recs=$(( (blksz - 56) / 24 )) + +blocks=$((bt_ptrs * bt_recs + 1)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +len=$((blocks * blksz)) + +echo "+ make some files" +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" + +# success, all done +status=0 +exit diff --git a/tests/xfs/876.out b/tests/xfs/876.out new file mode 100644 index 0000000..96c1970 --- /dev/null +++ b/tests/xfs/876.out @@ -0,0 +1,4 @@ +QA output created by 876 ++ create scratch fs ++ mount fs image ++ make some files diff --git a/tests/xfs/877 b/tests/xfs/877 new file mode 100755 index 0000000..9700263 --- /dev/null +++ b/tests/xfs/877 @@ -0,0 +1,85 @@ +#! /bin/bash +# FS QA Test No. 877 +# +# Make sure query_range returns -EINVAL if lowkey > highkey. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz=65536 +blocks=16 +len=$((blocks * blksz)) + +echo "Create some files" +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Manipulate file" +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ + -c "fzero $((3 * blksz)) $blksz" \ + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ + -c "fpunch $((7 * blksz)) $blksz" \ + -c "fsync" \ + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ + -c "fcollapse $((9 * blksz)) $blksz" \ + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Check file" +md5sum $SCRATCH_MNT/f1 | _filter_scratch +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full + +echo "Unmount" +_scratch_unmount + +echo "Try a regular fsmap" +$XFS_DB_PROG -c 'fsmap' $SCRATCH_DEV >> $seqres.full +$XFS_DB_PROG -c 'fsmap 0 5' $SCRATCH_DEV >> $seqres.full + +echo "Try a bad fsmap" +$XFS_DB_PROG -c 'fsmap 5 4' $SCRATCH_DEV + +# success, all done +status=0 +exit diff --git a/tests/xfs/877.out b/tests/xfs/877.out new file mode 100644 index 0000000..4a2242f --- /dev/null +++ b/tests/xfs/877.out @@ -0,0 +1,10 @@ +QA output created by 877 +Format and mount +Create some files +Manipulate file +Check file +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 +Unmount +Try a regular fsmap +Try a bad fsmap +Error 22 while querying fsmap btree. diff --git a/tests/xfs/group b/tests/xfs/group index 16f7947..f81f899 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -3,8 +3,8 @@ 003 db auto quick 004 db auto quick 005 auto quick -007 auto quota quick 006 auto quick mount +007 auto quota quick 008 rw ioctl auto quick 009 rw ioctl auto prealloc quick 010 auto quick repair @@ -309,3 +309,5 @@ 873 auto quick clone fsr 874 auto quick clone fsr 875 auto quick clone fsr quota +876 auto quick rmap clone +877 auto quick rmap clone
More tests for the reverse mapping functionality. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/876 | 76 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/876.out | 4 ++ tests/xfs/877 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/877.out | 10 ++++++ tests/xfs/group | 4 ++ 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100755 tests/xfs/876 create mode 100644 tests/xfs/876.out create mode 100755 tests/xfs/877 create mode 100644 tests/xfs/877.out diff --git a/tests/xfs/876 b/tests/xfs/876 new file mode 100755 index 0000000..cf73d40 --- /dev/null +++ b/tests/xfs/876 @@ -0,0 +1,76 @@ +#! /bin/bash +# FS QA Test No. 876 +# +# Create a big enough rmapbt that we tickle a fdblocks accounting bug. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch +_require_xfs_scratch_rmapbt +_require_scratch_reflink +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "+ create scratch fs" +_scratch_mkfs > "$seqres.full" 2>&1 + +echo "+ mount fs image" +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +bt_ptrs=$(( (blksz - 56) / 44 )) +bt_recs=$(( (blksz - 56) / 24 )) + +blocks=$((bt_ptrs * bt_recs + 1)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +len=$((blocks * blksz)) + +echo "+ make some files" +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" + +# success, all done +status=0 +exit diff --git a/tests/xfs/876.out b/tests/xfs/876.out new file mode 100644 index 0000000..96c1970 --- /dev/null +++ b/tests/xfs/876.out @@ -0,0 +1,4 @@ +QA output created by 876 ++ create scratch fs ++ mount fs image ++ make some files diff --git a/tests/xfs/877 b/tests/xfs/877 new file mode 100755 index 0000000..9700263 --- /dev/null +++ b/tests/xfs/877 @@ -0,0 +1,85 @@ +#! /bin/bash +# FS QA Test No. 877 +# +# Make sure query_range returns -EINVAL if lowkey > highkey. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz=65536 +blocks=16 +len=$((blocks * blksz)) + +echo "Create some files" +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Manipulate file" +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ + -c "fzero $((3 * blksz)) $blksz" \ + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ + -c "fpunch $((7 * blksz)) $blksz" \ + -c "fsync" \ + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ + -c "fcollapse $((9 * blksz)) $blksz" \ + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Check file" +md5sum $SCRATCH_MNT/f1 | _filter_scratch +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full + +echo "Unmount" +_scratch_unmount + +echo "Try a regular fsmap" +$XFS_DB_PROG -c 'fsmap' $SCRATCH_DEV >> $seqres.full +$XFS_DB_PROG -c 'fsmap 0 5' $SCRATCH_DEV >> $seqres.full + +echo "Try a bad fsmap" +$XFS_DB_PROG -c 'fsmap 5 4' $SCRATCH_DEV + +# success, all done +status=0 +exit diff --git a/tests/xfs/877.out b/tests/xfs/877.out new file mode 100644 index 0000000..4a2242f --- /dev/null +++ b/tests/xfs/877.out @@ -0,0 +1,10 @@ +QA output created by 877 +Format and mount +Create some files +Manipulate file +Check file +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 +Unmount +Try a regular fsmap +Try a bad fsmap +Error 22 while querying fsmap btree. diff --git a/tests/xfs/group b/tests/xfs/group index 16f7947..f81f899 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -3,8 +3,8 @@ 003 db auto quick 004 db auto quick 005 auto quick -007 auto quota quick 006 auto quick mount +007 auto quota quick 008 rw ioctl auto quick 009 rw ioctl auto prealloc quick 010 auto quick repair @@ -309,3 +309,5 @@ 873 auto quick clone fsr 874 auto quick clone fsr 875 auto quick clone fsr quota +876 auto quick rmap clone +877 auto quick rmap clone _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Teach _check_xfs_filesystem to scrub mounted filesystems before unmounting and fscking them. This is mostly to test the online scrub tool... Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- README | 3 +++ common/config | 1 + common/rc | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/README b/README index 4509cc1..c19fcb1 100644 --- a/README +++ b/README @@ -84,6 +84,9 @@ Preparing system for tests (IRIX and Linux): run xfs_repair -n to check the filesystem; xfs_repair to rebuild metadata indexes; and xfs_repair -n (a third time) to check the results of the rebuilding. + - set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run + xfs_scrub -vd to scrub the filesystem metadata online before + unmounting to run the offline check. - or add a case to the switch in common/config assigning these variables based on the hostname of your test diff --git a/common/config b/common/config index 08d5d80..168f46c 100644 --- a/common/config +++ b/common/config @@ -163,6 +163,7 @@ export XFS_REPAIR_PROG="`set_prog_path xfs_repair`" export XFS_DB_PROG="`set_prog_path xfs_db`" export XFS_GROWFS_PROG=`set_prog_path xfs_growfs` export XFS_IO_PROG="`set_prog_path xfs_io`" +export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`" export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`" export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`" export __XFSDUMP_PROG="`set_prog_path xfsdump`" diff --git a/common/rc b/common/rc index 3b45578..861a721 100644 --- a/common/rc +++ b/common/rc @@ -2391,6 +2391,13 @@ _check_xfs_filesystem() if [ "$type" = "xfs" ] then + if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then + "$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full + if [ $? -ne 0 ]; then + echo "filesystem on $device failed scrub (see $seqres.full)" + ok=0 + fi + fi # mounted ... mountpoint=`_umount_or_remount_ro $device` fi
Teach _check_xfs_filesystem to scrub mounted filesystems before unmounting and fscking them. This is mostly to test the online scrub tool... Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- README | 3 +++ common/config | 1 + common/rc | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/README b/README index 4509cc1..c19fcb1 100644 --- a/README +++ b/README @@ -84,6 +84,9 @@ Preparing system for tests (IRIX and Linux): run xfs_repair -n to check the filesystem; xfs_repair to rebuild metadata indexes; and xfs_repair -n (a third time) to check the results of the rebuilding. + - set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run + xfs_scrub -vd to scrub the filesystem metadata online before + unmounting to run the offline check. - or add a case to the switch in common/config assigning these variables based on the hostname of your test diff --git a/common/config b/common/config index 08d5d80..168f46c 100644 --- a/common/config +++ b/common/config @@ -163,6 +163,7 @@ export XFS_REPAIR_PROG="`set_prog_path xfs_repair`" export XFS_DB_PROG="`set_prog_path xfs_db`" export XFS_GROWFS_PROG=`set_prog_path xfs_growfs` export XFS_IO_PROG="`set_prog_path xfs_io`" +export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`" export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`" export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`" export __XFSDUMP_PROG="`set_prog_path xfsdump`" diff --git a/common/rc b/common/rc index 3b45578..861a721 100644 --- a/common/rc +++ b/common/rc @@ -2391,6 +2391,13 @@ _check_xfs_filesystem() if [ "$type" = "xfs" ] then + if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then + "$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full + if [ $? -ne 0 ]; then + echo "filesystem on $device failed scrub (see $seqres.full)" + ok=0 + fi + fi # mounted ... mountpoint=`_umount_or_remount_ro $device` fi _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Add the on-disk structures added by the realtime rmapbt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/122.out | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index c4ed725..b20011e 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -44,6 +44,7 @@ offsetof(xfs_sb_t, sb_rextents) = 24 offsetof(xfs_sb_t, sb_rextsize) = 80 offsetof(xfs_sb_t, sb_rextslog) = 125 offsetof(xfs_sb_t, sb_rootino) = 56 +offsetof(xfs_sb_t, sb_rrmapino) = 264 offsetof(xfs_sb_t, sb_rsumino) = 72 offsetof(xfs_sb_t, sb_sectlog) = 121 offsetof(xfs_sb_t, sb_sectsize) = 102 @@ -86,6 +87,9 @@ sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rtrmap_key) = 24 +sizeof(struct xfs_rtrmap_rec) = 32 +sizeof(struct xfs_rtrmap_root) = 4 sizeof(struct xfs_rud_log_format) = 48 sizeof(struct xfs_rui_log_format) = 48 sizeof(xfs_agf_t) = 224 @@ -130,7 +134,7 @@ sizeof(xfs_dir2_sf_off_t) = 2 sizeof(xfs_disk_dquot_t) = 104 sizeof(xfs_dq_logformat_t) = 24 sizeof(xfs_dqblk_t) = 136 -sizeof(xfs_dsb_t) = 264 +sizeof(xfs_dsb_t) = 272 sizeof(xfs_efd_log_format_32_t) = 28 sizeof(xfs_efd_log_format_64_t) = 32 sizeof(xfs_efi_log_format_32_t) = 28
Add the on-disk structures added by the realtime rmapbt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/122.out | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index c4ed725..b20011e 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -44,6 +44,7 @@ offsetof(xfs_sb_t, sb_rextents) = 24 offsetof(xfs_sb_t, sb_rextsize) = 80 offsetof(xfs_sb_t, sb_rextslog) = 125 offsetof(xfs_sb_t, sb_rootino) = 56 +offsetof(xfs_sb_t, sb_rrmapino) = 264 offsetof(xfs_sb_t, sb_rsumino) = 72 offsetof(xfs_sb_t, sb_sectlog) = 121 offsetof(xfs_sb_t, sb_sectsize) = 102 @@ -86,6 +87,9 @@ sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rtrmap_key) = 24 +sizeof(struct xfs_rtrmap_rec) = 32 +sizeof(struct xfs_rtrmap_root) = 4 sizeof(struct xfs_rud_log_format) = 48 sizeof(struct xfs_rui_log_format) = 48 sizeof(xfs_agf_t) = 224 @@ -130,7 +134,7 @@ sizeof(xfs_dir2_sf_off_t) = 2 sizeof(xfs_disk_dquot_t) = 104 sizeof(xfs_dq_logformat_t) = 24 sizeof(xfs_dqblk_t) = 136 -sizeof(xfs_dsb_t) = 264 +sizeof(xfs_dsb_t) = 272 sizeof(xfs_efd_log_format_32_t) = 28 sizeof(xfs_efd_log_format_64_t) = 32 sizeof(xfs_efi_log_format_32_t) = 28 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Test the realtime rmap btree code by exercising various IO patterns on realtime files. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/878 | 88 +++++++++++++++++++++++++++++++++++++++++++ tests/xfs/878.out | 9 ++++ tests/xfs/879 | 67 +++++++++++++++++++++++++++++++++ tests/xfs/879.out | 7 +++ tests/xfs/880 | 86 ++++++++++++++++++++++++++++++++++++++++++ tests/xfs/880.out | 7 +++ tests/xfs/881 | 95 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/881.out | 8 ++++ tests/xfs/882 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/882.out | 11 +++++ tests/xfs/883 | 89 ++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/883.out | 10 +++++ tests/xfs/884 | 91 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/884.out | 9 ++++ tests/xfs/885 | 94 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/885.out | 10 +++++ tests/xfs/886 | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/886.out | 7 +++ tests/xfs/887 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/887.out | 7 +++ tests/xfs/888 | 76 +++++++++++++++++++++++++++++++++++++ tests/xfs/888.out | 6 +++ tests/xfs/group | 11 +++++ 23 files changed, 1107 insertions(+) create mode 100644 tests/xfs/878 create mode 100644 tests/xfs/878.out create mode 100755 tests/xfs/879 create mode 100644 tests/xfs/879.out create mode 100755 tests/xfs/880 create mode 100644 tests/xfs/880.out create mode 100755 tests/xfs/881 create mode 100644 tests/xfs/881.out create mode 100755 tests/xfs/882 create mode 100644 tests/xfs/882.out create mode 100755 tests/xfs/883 create mode 100644 tests/xfs/883.out create mode 100755 tests/xfs/884 create mode 100644 tests/xfs/884.out create mode 100755 tests/xfs/885 create mode 100644 tests/xfs/885.out create mode 100755 tests/xfs/886 create mode 100644 tests/xfs/886.out create mode 100755 tests/xfs/887 create mode 100644 tests/xfs/887.out create mode 100755 tests/xfs/888 create mode 100644 tests/xfs/888.out diff --git a/tests/xfs/878 b/tests/xfs/878 new file mode 100644 index 0000000..b1f2672 --- /dev/null +++ b/tests/xfs/878 @@ -0,0 +1,88 @@ +#! /bin/bash +# FS QA Test No. 878 +# +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +SCRATCH_RTDEV= USE_EXTERNAL= _scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +$XFS_DB_PROG -x -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full +_scratch_mount + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/878.out b/tests/xfs/878.out new file mode 100644 index 0000000..e134506 --- /dev/null +++ b/tests/xfs/878.out @@ -0,0 +1,9 @@ +QA output created by 878 +Format and mount +Create some files +Corrupt fs +Check files +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/879 b/tests/xfs/879 new file mode 100755 index 0000000..0cbaf09 --- /dev/null +++ b/tests/xfs/879 @@ -0,0 +1,67 @@ +#! /bin/bash +# FS QA Test No. 879 +# +# Ensure that we can create a few realtime files on a rmapbt filesystem. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create a few files" +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full +_scratch_cycle_mount + +echo "Grab contents" +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch + +echo "Remove one file" +rm -rf $SCRATCH_MNT/f2 + +# success, all done +status=0 +exit diff --git a/tests/xfs/879.out b/tests/xfs/879.out new file mode 100644 index 0000000..9dfe48b --- /dev/null +++ b/tests/xfs/879.out @@ -0,0 +1,7 @@ +QA output created by 879 +Format and mount +Create a few files +Grab contents +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f1 +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f2 +Remove one file diff --git a/tests/xfs/880 b/tests/xfs/880 new file mode 100755 index 0000000..2056097 --- /dev/null +++ b/tests/xfs/880 @@ -0,0 +1,86 @@ +#! /bin/bash +# FS QA Test No. 880 +# +# Exercise expanding and shrinking the realtime rmap btree. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +echo "Create a three-level rtrmapbt" +i_ptrs=$(( (isize - 176) / 56 )) +bt_ptrs=$(( (blksz - 56) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_ptrs * bt_recs)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create big file" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full + +echo "Explode the rtrmapbt" +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +_scratch_cycle_mount + +echo "Remove half the records" +rm -rf $SCRATCH_MNT/f1 +_scratch_cycle_mount + +echo "Remove the rest of the records" +rm -rf $SCRATCH_MNT/f2 + +# success, all done +status=0 +exit diff --git a/tests/xfs/880.out b/tests/xfs/880.out new file mode 100644 index 0000000..b87665b --- /dev/null +++ b/tests/xfs/880.out @@ -0,0 +1,7 @@ +QA output created by 880 +Format and mount +Create a three-level rtrmapbt +Create big file +Explode the rtrmapbt +Remove half the records +Remove the rest of the records diff --git a/tests/xfs/881 b/tests/xfs/881 new file mode 100755 index 0000000..c7474f5 --- /dev/null +++ b/tests/xfs/881 @@ -0,0 +1,95 @@ +#! /bin/bash +# FS QA Test No. 881 +# +# Exercise metadump on realtime rmapbt preservation. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +metadump_file=$TEST_DIR/${seq}_metadump +rm -rf $metadump_file + +echo "Create a three-level rtrmapbt" +i_ptrs=$(( (isize - 176) / 56 )) +bt_ptrs=$(( (blksz - 56) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_ptrs * bt_recs)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create big file" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full + +echo "Explode the rtrmapbt" +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +_scratch_cycle_mount + +echo "Create metadump file" +_scratch_unmount +_scratch_metadump $metadump_file + +# Now restore the obfuscated one back and take a look around +echo "Restore metadump" +xfs_mdrestore $metadump_file $TEST_DIR/image +SCRATCH_DEV=$TEST_DIR/image _scratch_mount +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount + +echo "Check restored fs" +_check_generic_filesystem $metadump_file + +# success, all done +status=0 +exit diff --git a/tests/xfs/881.out b/tests/xfs/881.out new file mode 100644 index 0000000..6ad156c --- /dev/null +++ b/tests/xfs/881.out @@ -0,0 +1,8 @@ +QA output created by 881 +Format and mount +Create a three-level rtrmapbt +Create big file +Explode the rtrmapbt +Create metadump file +Restore metadump +Check restored fs diff --git a/tests/xfs/882 b/tests/xfs/882 new file mode 100755 index 0000000..569a560 --- /dev/null +++ b/tests/xfs/882 @@ -0,0 +1,108 @@ +#! /bin/bash +# FS QA Test No. 882 +# +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "+ create scratch fs" +_scratch_mkfs > "$seqres.full" 2>&1 + +echo "+ mount fs image" +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +i_ptrs=$(( (isize - 176) / 56 )) +bt_ptrs=$(( (blksz - 56) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +len=$((blocks * blksz)) + +echo "+ make some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +_scratch_unmount + +echo "+ check fs" +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail" + +echo "+ corrupt image" +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" -c "stack" \ + -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" $SCRATCH_DEV >> $seqres.full 2>&1 + +echo "+ mount image" +_scratch_mount + +echo "+ copy more" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1 +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree" +_scratch_unmount + +echo "+ repair fs" +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "+ mount image (2)" +_scratch_mount + +echo "+ copy more (2)" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/882.out b/tests/xfs/882.out new file mode 100644 index 0000000..5ebe620 --- /dev/null +++ b/tests/xfs/882.out @@ -0,0 +1,11 @@ +QA output created by 882 ++ create scratch fs ++ mount fs image ++ make some files ++ check fs ++ corrupt image ++ mount image ++ copy more ++ repair fs ++ mount image (2) ++ copy more (2) diff --git a/tests/xfs/883 b/tests/xfs/883 new file mode 100755 index 0000000..403ef35 --- /dev/null +++ b/tests/xfs/883 @@ -0,0 +1,89 @@ +#! /bin/bash +# FS QA Test No. 883 +# +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +_scratch_unmount + +echo "Corrupt fs" +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c 'write core.nlinkv2 0' \ + -c 'write core.mode 0' -c 'sb 0' -c 'write rrmapino 0' $SCRATCH_DEV >> $seqres.full +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/883.out b/tests/xfs/883.out new file mode 100644 index 0000000..6e75ac1 --- /dev/null +++ b/tests/xfs/883.out @@ -0,0 +1,10 @@ +QA output created by 883 +Format and mount +Create some files +Corrupt fs +Check files +md5sum: SCRATCH_MNT/f1: No such file or directory +Try to create more files +Repair fs +umount: SCRATCH_DEV: not mounted +Try to create more files (again) diff --git a/tests/xfs/884 b/tests/xfs/884 new file mode 100755 index 0000000..ad648b8 --- /dev/null +++ b/tests/xfs/884 @@ -0,0 +1,91 @@ +#! /bin/bash +# FS QA Test No. 884 +# +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +echo garbage > $SCRATCH_MNT/f3 +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 +_scratch_unmount + +echo "Corrupt fs" +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \ + -c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" $SCRATCH_DEV >> $seqres.full +_scratch_mount + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/884.out b/tests/xfs/884.out new file mode 100644 index 0000000..17a73ef --- /dev/null +++ b/tests/xfs/884.out @@ -0,0 +1,9 @@ +QA output created by 884 +Format and mount +Create some files +Corrupt fs +Check files +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/885 b/tests/xfs/885 new file mode 100755 index 0000000..b5880bd --- /dev/null +++ b/tests/xfs/885 @@ -0,0 +1,94 @@ +#! /bin/bash +# FS QA Test No. 885 +# +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') +$XFS_DB_PROG -x -c "inode $rrmapino" -c 'write core.format 2' \ + -c 'write core.size 0' -c 'write core.nblocks 0' \ + -c 'sb 0' -c 'addr rootino' -c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \ + -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/885.out b/tests/xfs/885.out new file mode 100644 index 0000000..df04f79 --- /dev/null +++ b/tests/xfs/885.out @@ -0,0 +1,10 @@ +QA output created by 885 +Format and mount +Create some files +Corrupt fs +Check files +md5sum: SCRATCH_MNT/f1: No such file or directory +Try to create more files +Repair fs +umount: SCRATCH_DEV: not mounted +Try to create more files (again) diff --git a/tests/xfs/886 b/tests/xfs/886 new file mode 100755 index 0000000..57edb3d --- /dev/null +++ b/tests/xfs/886 @@ -0,0 +1,104 @@ +#! /bin/bash +# FS QA Test No. 886 +# +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +i_ptrs=$(( (isize - 176) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_recs + 1)) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' $SCRATCH_DEV | \ + sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g') + +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c "write u3.rtrmapbt.ptrs[1] $fsbno" \ + -c 'p' $SCRATCH_DEV >> $seqres.full +_scratch_mount + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/886.out b/tests/xfs/886.out new file mode 100644 index 0000000..7f00c5d --- /dev/null +++ b/tests/xfs/886.out @@ -0,0 +1,7 @@ +QA output created by 886 +Format and mount +Create some files +Corrupt fs +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/887 b/tests/xfs/887 new file mode 100755 index 0000000..cdf2707 --- /dev/null +++ b/tests/xfs/887 @@ -0,0 +1,107 @@ +#! /bin/bash +# FS QA Test No. 887 +# +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +i_ptrs=$(( (isize - 176) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_recs + 1)) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' $SCRATCH_DEV >> $seqres.full + +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' \ + $SCRATCH_DEV | sed -e 's/^.*://g') +$XFS_DB_PROG -x -c "inode $ino" -c "write u3.bmx[0].startblock $fsbno" \ + $SCRATCH_DEV >> $seqres.full +_scratch_mount + +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/887.out b/tests/xfs/887.out new file mode 100644 index 0000000..30cf032 --- /dev/null +++ b/tests/xfs/887.out @@ -0,0 +1,7 @@ +QA output created by 887 +Format and mount +Create some files +Corrupt fs +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/888 b/tests/xfs/888 new file mode 100755 index 0000000..15bec80 --- /dev/null +++ b/tests/xfs/888 @@ -0,0 +1,76 @@ +#! /bin/bash +# FS QA Test No. 888 +# +# Basic rmap manipulation tests for realtime files. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz=65536 +blocks=16 +len=$((blocks * blksz)) + +echo "Create some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Manipulate file" +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ + -c "fzero $((3 * blksz)) $blksz" \ + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ + -c "fpunch $((7 * blksz)) $blksz" \ + -c "fsync" \ + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ + -c "fcollapse $((9 * blksz)) $blksz" \ + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Check file" +md5sum $SCRATCH_MNT/f1 | _filter_scratch +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/888.out b/tests/xfs/888.out new file mode 100644 index 0000000..2587697 --- /dev/null +++ b/tests/xfs/888.out @@ -0,0 +1,6 @@ +QA output created by 888 +Format and mount +Create some files +Manipulate file +Check file +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 diff --git a/tests/xfs/group b/tests/xfs/group index f81f899..6fa2eb6 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -311,3 +311,14 @@ 875 auto quick clone fsr quota 876 auto quick rmap clone 877 auto quick rmap clone +878 auto quick rmap +879 auto quick rmap +880 auto quick rmap +881 auto quick rmap +882 fuzzers rmap +883 auto quick rmap +884 auto quick rmap +885 auto quick rmap +886 auto quick rmap +887 auto quick rmap +888 auto quick rmap
Test the realtime rmap btree code by exercising various IO patterns on realtime files. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/878 | 88 +++++++++++++++++++++++++++++++++++++++++++ tests/xfs/878.out | 9 ++++ tests/xfs/879 | 67 +++++++++++++++++++++++++++++++++ tests/xfs/879.out | 7 +++ tests/xfs/880 | 86 ++++++++++++++++++++++++++++++++++++++++++ tests/xfs/880.out | 7 +++ tests/xfs/881 | 95 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/881.out | 8 ++++ tests/xfs/882 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/882.out | 11 +++++ tests/xfs/883 | 89 ++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/883.out | 10 +++++ tests/xfs/884 | 91 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/884.out | 9 ++++ tests/xfs/885 | 94 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/885.out | 10 +++++ tests/xfs/886 | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/886.out | 7 +++ tests/xfs/887 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/887.out | 7 +++ tests/xfs/888 | 76 +++++++++++++++++++++++++++++++++++++ tests/xfs/888.out | 6 +++ tests/xfs/group | 11 +++++ 23 files changed, 1107 insertions(+) create mode 100644 tests/xfs/878 create mode 100644 tests/xfs/878.out create mode 100755 tests/xfs/879 create mode 100644 tests/xfs/879.out create mode 100755 tests/xfs/880 create mode 100644 tests/xfs/880.out create mode 100755 tests/xfs/881 create mode 100644 tests/xfs/881.out create mode 100755 tests/xfs/882 create mode 100644 tests/xfs/882.out create mode 100755 tests/xfs/883 create mode 100644 tests/xfs/883.out create mode 100755 tests/xfs/884 create mode 100644 tests/xfs/884.out create mode 100755 tests/xfs/885 create mode 100644 tests/xfs/885.out create mode 100755 tests/xfs/886 create mode 100644 tests/xfs/886.out create mode 100755 tests/xfs/887 create mode 100644 tests/xfs/887.out create mode 100755 tests/xfs/888 create mode 100644 tests/xfs/888.out diff --git a/tests/xfs/878 b/tests/xfs/878 new file mode 100644 index 0000000..b1f2672 --- /dev/null +++ b/tests/xfs/878 @@ -0,0 +1,88 @@ +#! /bin/bash +# FS QA Test No. 878 +# +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +SCRATCH_RTDEV= USE_EXTERNAL= _scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +$XFS_DB_PROG -x -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full +_scratch_mount + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/878.out b/tests/xfs/878.out new file mode 100644 index 0000000..e134506 --- /dev/null +++ b/tests/xfs/878.out @@ -0,0 +1,9 @@ +QA output created by 878 +Format and mount +Create some files +Corrupt fs +Check files +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/879 b/tests/xfs/879 new file mode 100755 index 0000000..0cbaf09 --- /dev/null +++ b/tests/xfs/879 @@ -0,0 +1,67 @@ +#! /bin/bash +# FS QA Test No. 879 +# +# Ensure that we can create a few realtime files on a rmapbt filesystem. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create a few files" +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full +_scratch_cycle_mount + +echo "Grab contents" +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch + +echo "Remove one file" +rm -rf $SCRATCH_MNT/f2 + +# success, all done +status=0 +exit diff --git a/tests/xfs/879.out b/tests/xfs/879.out new file mode 100644 index 0000000..9dfe48b --- /dev/null +++ b/tests/xfs/879.out @@ -0,0 +1,7 @@ +QA output created by 879 +Format and mount +Create a few files +Grab contents +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f1 +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f2 +Remove one file diff --git a/tests/xfs/880 b/tests/xfs/880 new file mode 100755 index 0000000..2056097 --- /dev/null +++ b/tests/xfs/880 @@ -0,0 +1,86 @@ +#! /bin/bash +# FS QA Test No. 880 +# +# Exercise expanding and shrinking the realtime rmap btree. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +echo "Create a three-level rtrmapbt" +i_ptrs=$(( (isize - 176) / 56 )) +bt_ptrs=$(( (blksz - 56) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_ptrs * bt_recs)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create big file" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full + +echo "Explode the rtrmapbt" +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +_scratch_cycle_mount + +echo "Remove half the records" +rm -rf $SCRATCH_MNT/f1 +_scratch_cycle_mount + +echo "Remove the rest of the records" +rm -rf $SCRATCH_MNT/f2 + +# success, all done +status=0 +exit diff --git a/tests/xfs/880.out b/tests/xfs/880.out new file mode 100644 index 0000000..b87665b --- /dev/null +++ b/tests/xfs/880.out @@ -0,0 +1,7 @@ +QA output created by 880 +Format and mount +Create a three-level rtrmapbt +Create big file +Explode the rtrmapbt +Remove half the records +Remove the rest of the records diff --git a/tests/xfs/881 b/tests/xfs/881 new file mode 100755 index 0000000..c7474f5 --- /dev/null +++ b/tests/xfs/881 @@ -0,0 +1,95 @@ +#! /bin/bash +# FS QA Test No. 881 +# +# Exercise metadump on realtime rmapbt preservation. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +metadump_file=$TEST_DIR/${seq}_metadump +rm -rf $metadump_file + +echo "Create a three-level rtrmapbt" +i_ptrs=$(( (isize - 176) / 56 )) +bt_ptrs=$(( (blksz - 56) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_ptrs * bt_recs)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create big file" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full + +echo "Explode the rtrmapbt" +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +_scratch_cycle_mount + +echo "Create metadump file" +_scratch_unmount +_scratch_metadump $metadump_file + +# Now restore the obfuscated one back and take a look around +echo "Restore metadump" +xfs_mdrestore $metadump_file $TEST_DIR/image +SCRATCH_DEV=$TEST_DIR/image _scratch_mount +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount + +echo "Check restored fs" +_check_generic_filesystem $metadump_file + +# success, all done +status=0 +exit diff --git a/tests/xfs/881.out b/tests/xfs/881.out new file mode 100644 index 0000000..6ad156c --- /dev/null +++ b/tests/xfs/881.out @@ -0,0 +1,8 @@ +QA output created by 881 +Format and mount +Create a three-level rtrmapbt +Create big file +Explode the rtrmapbt +Create metadump file +Restore metadump +Check restored fs diff --git a/tests/xfs/882 b/tests/xfs/882 new file mode 100755 index 0000000..569a560 --- /dev/null +++ b/tests/xfs/882 @@ -0,0 +1,108 @@ +#! /bin/bash +# FS QA Test No. 882 +# +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "+ create scratch fs" +_scratch_mkfs > "$seqres.full" 2>&1 + +echo "+ mount fs image" +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +i_ptrs=$(( (isize - 176) / 56 )) +bt_ptrs=$(( (blksz - 56) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1)) +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) +len=$((blocks * blksz)) + +echo "+ make some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +_scratch_unmount + +echo "+ check fs" +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail" + +echo "+ corrupt image" +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" -c "stack" \ + -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" $SCRATCH_DEV >> $seqres.full 2>&1 + +echo "+ mount image" +_scratch_mount + +echo "+ copy more" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1 +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree" +_scratch_unmount + +echo "+ repair fs" +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "+ mount image (2)" +_scratch_mount + +echo "+ copy more (2)" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/882.out b/tests/xfs/882.out new file mode 100644 index 0000000..5ebe620 --- /dev/null +++ b/tests/xfs/882.out @@ -0,0 +1,11 @@ +QA output created by 882 ++ create scratch fs ++ mount fs image ++ make some files ++ check fs ++ corrupt image ++ mount image ++ copy more ++ repair fs ++ mount image (2) ++ copy more (2) diff --git a/tests/xfs/883 b/tests/xfs/883 new file mode 100755 index 0000000..403ef35 --- /dev/null +++ b/tests/xfs/883 @@ -0,0 +1,89 @@ +#! /bin/bash +# FS QA Test No. 883 +# +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +_scratch_unmount + +echo "Corrupt fs" +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c 'write core.nlinkv2 0' \ + -c 'write core.mode 0' -c 'sb 0' -c 'write rrmapino 0' $SCRATCH_DEV >> $seqres.full +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/883.out b/tests/xfs/883.out new file mode 100644 index 0000000..6e75ac1 --- /dev/null +++ b/tests/xfs/883.out @@ -0,0 +1,10 @@ +QA output created by 883 +Format and mount +Create some files +Corrupt fs +Check files +md5sum: SCRATCH_MNT/f1: No such file or directory +Try to create more files +Repair fs +umount: SCRATCH_DEV: not mounted +Try to create more files (again) diff --git a/tests/xfs/884 b/tests/xfs/884 new file mode 100755 index 0000000..ad648b8 --- /dev/null +++ b/tests/xfs/884 @@ -0,0 +1,91 @@ +#! /bin/bash +# FS QA Test No. 884 +# +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +echo garbage > $SCRATCH_MNT/f3 +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 +_scratch_unmount + +echo "Corrupt fs" +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \ + -c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" $SCRATCH_DEV >> $seqres.full +_scratch_mount + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/884.out b/tests/xfs/884.out new file mode 100644 index 0000000..17a73ef --- /dev/null +++ b/tests/xfs/884.out @@ -0,0 +1,9 @@ +QA output created by 884 +Format and mount +Create some files +Corrupt fs +Check files +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/885 b/tests/xfs/885 new file mode 100755 index 0000000..b5880bd --- /dev/null +++ b/tests/xfs/885 @@ -0,0 +1,94 @@ +#! /bin/bash +# FS QA Test No. 885 +# +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount + +echo "Create some files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') +$XFS_DB_PROG -x -c "inode $rrmapino" -c 'write core.format 2' \ + -c 'write core.size 0' -c 'write core.nblocks 0' \ + -c 'sb 0' -c 'addr rootino' -c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \ + -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" + +echo "Check files" +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/885.out b/tests/xfs/885.out new file mode 100644 index 0000000..df04f79 --- /dev/null +++ b/tests/xfs/885.out @@ -0,0 +1,10 @@ +QA output created by 885 +Format and mount +Create some files +Corrupt fs +Check files +md5sum: SCRATCH_MNT/f1: No such file or directory +Try to create more files +Repair fs +umount: SCRATCH_DEV: not mounted +Try to create more files (again) diff --git a/tests/xfs/886 b/tests/xfs/886 new file mode 100755 index 0000000..57edb3d --- /dev/null +++ b/tests/xfs/886 @@ -0,0 +1,104 @@ +#! /bin/bash +# FS QA Test No. 886 +# +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +i_ptrs=$(( (isize - 176) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_recs + 1)) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' $SCRATCH_DEV | \ + sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g') + +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c "write u3.rtrmapbt.ptrs[1] $fsbno" \ + -c 'p' $SCRATCH_DEV >> $seqres.full +_scratch_mount + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/886.out b/tests/xfs/886.out new file mode 100644 index 0000000..7f00c5d --- /dev/null +++ b/tests/xfs/886.out @@ -0,0 +1,7 @@ +QA output created by 886 +Format and mount +Create some files +Corrupt fs +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/887 b/tests/xfs/887 new file mode 100755 index 0000000..cdf2707 --- /dev/null +++ b/tests/xfs/887 @@ -0,0 +1,107 @@ +#! /bin/bash +# FS QA Test No. 887 +# +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt +_require_test_program "punch-alternating" + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz="$(stat -f $SCRATCH_MNT -c '%S')" +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') + +i_ptrs=$(( (isize - 176) / 56 )) +bt_recs=$(( (blksz - 56) / 32 )) + +blocks=$((i_ptrs * bt_recs + 1)) +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') +len=$((blocks * rtblksz)) + +echo "Create some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" +echo garbage > $SCRATCH_MNT/f3 +ino=$(stat -c '%i' $SCRATCH_MNT/f3) +_scratch_unmount + +echo "Corrupt fs" +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' $SCRATCH_DEV >> $seqres.full + +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' \ + $SCRATCH_DEV | sed -e 's/^.*://g') +$XFS_DB_PROG -x -c "inode $ino" -c "write u3.bmx[0].startblock $fsbno" \ + $SCRATCH_DEV >> $seqres.full +_scratch_mount + +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full + +echo "Try to create more files" +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5" + +echo "Repair fs" +_scratch_unmount 2>&1 | _filter_scratch +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ + | tee $tmp.logprint | grep -q "<CLEAN>" +if [ $? -ne 0 ]; then + echo "Dirty log, zeroing..." >> $seqres.full + _scratch_xfs_repair -L >> $seqres.full 2>&1 +else + _scratch_xfs_repair >> $seqres.full 2>&1 +fi +_scratch_xfs_repair >> $seqres.full 2>&1 + +echo "Try to create more files (again)" +_scratch_mount +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/887.out b/tests/xfs/887.out new file mode 100644 index 0000000..30cf032 --- /dev/null +++ b/tests/xfs/887.out @@ -0,0 +1,7 @@ +QA output created by 887 +Format and mount +Create some files +Corrupt fs +Try to create more files +Repair fs +Try to create more files (again) diff --git a/tests/xfs/888 b/tests/xfs/888 new file mode 100755 index 0000000..15bec80 --- /dev/null +++ b/tests/xfs/888 @@ -0,0 +1,76 @@ +#! /bin/bash +# FS QA Test No. 888 +# +# Basic rmap manipulation tests for realtime files. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016, Oracle and/or its affiliates. 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* $metadump_file +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_os Linux +_require_realtime +_require_xfs_scratch_rmapbt + +rm -f "$seqres.full" + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +blksz=65536 +blocks=16 +len=$((blocks * blksz)) + +echo "Create some files" +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Manipulate file" +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ + -c "fzero $((3 * blksz)) $blksz" \ + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ + -c "fpunch $((7 * blksz)) $blksz" \ + -c "fsync" \ + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ + -c "fcollapse $((9 * blksz)) $blksz" \ + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full + +echo "Check file" +md5sum $SCRATCH_MNT/f1 | _filter_scratch +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full + +# success, all done +status=0 +exit diff --git a/tests/xfs/888.out b/tests/xfs/888.out new file mode 100644 index 0000000..2587697 --- /dev/null +++ b/tests/xfs/888.out @@ -0,0 +1,6 @@ +QA output created by 888 +Format and mount +Create some files +Manipulate file +Check file +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 diff --git a/tests/xfs/group b/tests/xfs/group index f81f899..6fa2eb6 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -311,3 +311,14 @@ 875 auto quick clone fsr quota 876 auto quick rmap clone 877 auto quick rmap clone +878 auto quick rmap +879 auto quick rmap +880 auto quick rmap +881 auto quick rmap +882 fuzzers rmap +883 auto quick rmap +884 auto quick rmap +885 auto quick rmap +886 auto quick rmap +887 auto quick rmap +888 auto quick rmap _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:46:21PM -0700, Darrick J. Wong wrote:
> These two tests were accidentally double-added as xfs/30[78], but the
> newer versions have fixed up helper usage and fewer whitespace
> problems, so nuke the old tests.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:46:21PM -0700, Darrick J. Wong wrote: > These two tests were accidentally double-added as xfs/30[78], but the > newer versions have fixed up helper usage and fewer whitespace > problems, so nuke the old tests. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:46:29PM -0700, Darrick J. Wong wrote:
> Don't open-code _notrun checks for the rmapbt, just use the helper.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:46:29PM -0700, Darrick J. Wong wrote: > Don't open-code _notrun checks for the rmapbt, just use the helper. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:46:35PM -0700, Darrick J. Wong wrote:
> Fix the calculation of the dmhuge size. The previous calculation
> tried to calculate the size correctly, but got it wrong for 1k
> block sizes. Therefore, clean the whole mess up.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:46:35PM -0700, Darrick J. Wong wrote: > Fix the calculation of the dmhuge size. The previous calculation > tried to calculate the size correctly, but got it wrong for 1k > block sizes. Therefore, clean the whole mess up. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:46:42PM -0700, Darrick J. Wong wrote:
> List the new log redo items. These should have stable sizes.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:46:42PM -0700, Darrick J. Wong wrote: > List the new log redo items. These should have stable sizes. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:46:48PM -0700, Darrick J. Wong wrote:
> In _require_scratch_dedupe, test the scratch device, not the testdev.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:46:48PM -0700, Darrick J. Wong wrote: > In _require_scratch_dedupe, test the scratch device, not the testdev. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote:
> Run xfs_repair twice at the end of each test -- once to rebuild
> the btree indices, and again with -n to check the rebuild work.
This looks fine to me in general, but shouldn't we have specific
tests that test the rebuilding in a normal auto run?
On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote: > Run xfs_repair twice at the end of each test -- once to rebuild > the btree indices, and again with -n to check the rebuild work. This looks fine to me in general, but shouldn't we have specific tests that test the rebuilding in a normal auto run? _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:01PM -0700, Darrick J. Wong wrote:
> This test uses the scratch device, so cycle that, not the test dev.
> This is also a xfs_fsr test, so put it in the fsr group.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:47:01PM -0700, Darrick J. Wong wrote: > This test uses the scratch device, so cycle that, not the test dev. > This is also a xfs_fsr test, so put it in the fsr group. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:07PM -0700, Darrick J. Wong wrote:
> Use the standard _scratch_mount to mount the filesystem from the restored
> image, instead of trying to call mount directly. This is needed in case
> we had custom mount options (like rtdev).
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:47:07PM -0700, Darrick J. Wong wrote: > Use the standard _scratch_mount to mount the filesystem from the restored > image, instead of trying to call mount directly. This is needed in case > we had custom mount options (like rtdev). > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:13PM -0700, Darrick J. Wong wrote:
> Calling _mount doesn't work when we want to add mount options
> such as realtime devices. Since it's just a normal scratch device
> mount except for the source device, just call _scratch_mount with
> SCRATCH_DEV set to the dmerror device.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:47:13PM -0700, Darrick J. Wong wrote: > Calling _mount doesn't work when we want to add mount options > such as realtime devices. Since it's just a normal scratch device > mount except for the source device, just call _scratch_mount with > SCRATCH_DEV set to the dmerror device. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:19PM -0700, Darrick J. Wong wrote:
> Use the helper functions for scratch devices. This fixes a problem
> where xfs/179 fails when there's a realtime device.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:47:19PM -0700, Darrick J. Wong wrote: > Use the helper functions for scratch devices. This fixes a problem > where xfs/179 fails when there's a realtime device. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:26PM -0700, Darrick J. Wong wrote:
> Use the helper functions for scratch devices. This fixes a problem
> where xfs/234 fails when there's a realtime device.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:47:26PM -0700, Darrick J. Wong wrote: > Use the helper functions for scratch devices. This fixes a problem > where xfs/234 fails when there's a realtime device. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:32PM -0700, Darrick J. Wong wrote:
> Test sharing blocks via reflink and dedupe between two different
> mountpoints of the same filesystem. This shouldn't work, since
> we don't allow cross-mountpoint functions.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:47:32PM -0700, Darrick J. Wong wrote: > Test sharing blocks via reflink and dedupe between two different > mountpoints of the same filesystem. This shouldn't work, since > we don't allow cross-mountpoint functions. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:48:00PM -0700, Darrick J. Wong wrote:
> Add the on-disk structures added by the realtime rmapbt.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jul 21, 2016 at 04:48:00PM -0700, Darrick J. Wong wrote: > Add the on-disk structures added by the realtime rmapbt. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Sun, Jul 31, 2016 at 11:27:19PM -0700, Christoph Hellwig wrote:
> On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote:
> > Run xfs_repair twice at the end of each test -- once to rebuild
> > the btree indices, and again with -n to check the rebuild work.
>
> This looks fine to me in general, but shouldn't we have specific
> tests that test the rebuilding in a normal auto run?
We do have specific tests that examine the outputs of rebuilding the
indices (all the fuzzer group tests do this too); this patch enables a
test runner to expand that coverage to all tests. Running a
rebuilding xfs_repair for all the tests shook out some bugs in the
xfs_repair rmap handling code that only triggered under some of the
non-rmap non-reflink stressor tests.
--D
On Sun, Jul 31, 2016 at 11:27:19PM -0700, Christoph Hellwig wrote: > On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote: > > Run xfs_repair twice at the end of each test -- once to rebuild > > the btree indices, and again with -n to check the rebuild work. > > This looks fine to me in general, but shouldn't we have specific > tests that test the rebuilding in a normal auto run? We do have specific tests that examine the outputs of rebuilding the indices (all the fuzzer group tests do this too); this patch enables a test runner to expand that coverage to all tests. Running a rebuilding xfs_repair for all the tests shook out some bugs in the xfs_repair rmap handling code that only triggered under some of the non-rmap non-reflink stressor tests. --D _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
> We do have specific tests that examine the outputs of rebuilding the
> indices (all the fuzzer group tests do this too); this patch enables a
> test runner to expand that coverage to all tests. Running a
> rebuilding xfs_repair for all the tests shook out some bugs in the
> xfs_repair rmap handling code that only triggered under some of the
> non-rmap non-reflink stressor tests.
Ok, looks fine then:
Reviewed-by: Christoph Hellwig <hch@lst.de>
> We do have specific tests that examine the outputs of rebuilding the > indices (all the fuzzer group tests do this too); this patch enables a > test runner to expand that coverage to all tests. Running a > rebuilding xfs_repair for all the tests shook out some bugs in the > xfs_repair rmap handling code that only triggered under some of the > non-rmap non-reflink stressor tests. Ok, looks fine then: Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote: > Run xfs_repair twice at the end of each test -- once to rebuild > the btree indices, and again with -n to check the rebuild work. Seems like it's two more xfs_repair, three in total :) > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > README | 4 ++++ > common/rc | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+) > > > diff --git a/README b/README > index 2647e12..4509cc1 100644 > --- a/README > +++ b/README > @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): > added to the end of fsstresss and fsx invocations, respectively, > in case you wish to exclude certain operational modes from these > tests. > + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem > + run xfs_repair -n to check the filesystem; xfs_repair to rebuild > + metadata indexes; and xfs_repair -n (a third time) to check the > + results of the rebuilding. > > - or add a case to the switch in common/config assigning > these variables based on the hostname of your test > diff --git a/common/rc b/common/rc > index 7c79bf8..3b45578 100644 > --- a/common/rc > +++ b/common/rc > @@ -2428,6 +2428,36 @@ _check_xfs_filesystem() > ok=0 > fi > > + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then > + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > + if [ $? -ne 0 ] > + then > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > + > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > + echo "*** xfs_repair -n output ***" >>$seqres.full > + cat $tmp.repair | _fix_malloc >>$seqres.full > + echo "*** end xfs_repair output" >>$seqres.full > + > + ok=0 > + fi > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > + > + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > + if [ $? -ne 0 ] > + then > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > + > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > + echo "*** xfs_repair -n output ***" >>$seqres.full > + cat $tmp.repair | _fix_malloc >>$seqres.full > + echo "*** end xfs_repair output" >>$seqres.full > + > + ok=0 > + fi > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > + fi > + I think we can move this hunk after the original xfs_repair and swap the xfs_repair order, i.e. xfs_repair -n # this is the original repair check if <check_rebuild>; then xfs_repair # do rebuild without -n xfs_repair -n # check rebuild result fi This seems more clear to me and we can mark which repair is failing more easily (right now the three xfs_repairs are all marked as "(r)", it's hard to say which one is failing), e.g. xfs_repair -n # marked as "(r)", means "repair" if <check_rebuild>; then xfs_repair # mark as "(rb)", means "rebuild"? xfs_repair -n # mark as "(rr)", means "repair rebuild"? fi Thanks, Eryu > $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > if [ $? -ne 0 ] > then >
On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote: > Run xfs_repair twice at the end of each test -- once to rebuild > the btree indices, and again with -n to check the rebuild work. Seems like it's two more xfs_repair, three in total :) > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > README | 4 ++++ > common/rc | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+) > > > diff --git a/README b/README > index 2647e12..4509cc1 100644 > --- a/README > +++ b/README > @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): > added to the end of fsstresss and fsx invocations, respectively, > in case you wish to exclude certain operational modes from these > tests. > + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem > + run xfs_repair -n to check the filesystem; xfs_repair to rebuild > + metadata indexes; and xfs_repair -n (a third time) to check the > + results of the rebuilding. > > - or add a case to the switch in common/config assigning > these variables based on the hostname of your test > diff --git a/common/rc b/common/rc > index 7c79bf8..3b45578 100644 > --- a/common/rc > +++ b/common/rc > @@ -2428,6 +2428,36 @@ _check_xfs_filesystem() > ok=0 > fi > > + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then > + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > + if [ $? -ne 0 ] > + then > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > + > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > + echo "*** xfs_repair -n output ***" >>$seqres.full > + cat $tmp.repair | _fix_malloc >>$seqres.full > + echo "*** end xfs_repair output" >>$seqres.full > + > + ok=0 > + fi > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > + > + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > + if [ $? -ne 0 ] > + then > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > + > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > + echo "*** xfs_repair -n output ***" >>$seqres.full > + cat $tmp.repair | _fix_malloc >>$seqres.full > + echo "*** end xfs_repair output" >>$seqres.full > + > + ok=0 > + fi > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > + fi > + I think we can move this hunk after the original xfs_repair and swap the xfs_repair order, i.e. xfs_repair -n # this is the original repair check if <check_rebuild>; then xfs_repair # do rebuild without -n xfs_repair -n # check rebuild result fi This seems more clear to me and we can mark which repair is failing more easily (right now the three xfs_repairs are all marked as "(r)", it's hard to say which one is failing), e.g. xfs_repair -n # marked as "(r)", means "repair" if <check_rebuild>; then xfs_repair # mark as "(rb)", means "rebuild"? xfs_repair -n # mark as "(rr)", means "repair rebuild"? fi Thanks, Eryu > $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > if [ $? -ne 0 ] > then > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:01PM -0700, Darrick J. Wong wrote: > This test uses the scratch device, so cycle that, not the test dev. > This is also a xfs_fsr test, so put it in the fsr group. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/128 | 7 ++++--- > tests/xfs/group | 2 +- > 2 files changed, 5 insertions(+), 4 deletions(-) > > > diff --git a/tests/xfs/128 b/tests/xfs/128 > index 8758d7e..2e756d5 100755 > --- a/tests/xfs/128 > +++ b/tests/xfs/128 > @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full > _cp_reflink $testdir/file1 $testdir/file2 > _cp_reflink $testdir/file2 $testdir/file3 > _cp_reflink $testdir/file3 $testdir/file4 > -_test_cycle_mount > +_scratch_cycle_mount > free_blocks1=$(stat -f $testdir -c '%f') > > md5sum $testdir/file1 | _filter_scratch > @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) > echo "CoW the reflink copies" > _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full > _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full > -_test_cycle_mount > +_scratch_cycle_mount > free_blocks2=$(stat -f $testdir -c '%f') > > md5sum $testdir/file1 | _filter_scratch > @@ -97,11 +97,12 @@ c14=$(_md5_checksum $testdir/file4) > > echo "Defragment" > lsattr -l $testdir/ | _filter_scratch | _filter_spaces > +filefrag -v $testdir/file* >> $seqres.full Is this intentional? Use $FILEFRAG_PROG instead and add _require_command "$FILEFRAG_PROG" "filefrag" at the beginning of the test? Thanks, Eryu > $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link > $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link > $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file > -_test_cycle_mount > +_scratch_cycle_mount > free_blocks3=$(stat -f $testdir -c '%f') > > md5sum $testdir/file1 | _filter_scratch > diff --git a/tests/xfs/group b/tests/xfs/group > index aa3b3ec..5ccf3d6 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -125,7 +125,7 @@ > 125 fuzzers > 126 fuzzers > 127 auto quick clone > -128 auto quick clone > +128 auto quick clone fsr > 129 auto quick clone > 130 fuzzers clone > 131 auto quick clone >
On Thu, Jul 21, 2016 at 04:47:01PM -0700, Darrick J. Wong wrote: > This test uses the scratch device, so cycle that, not the test dev. > This is also a xfs_fsr test, so put it in the fsr group. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/128 | 7 ++++--- > tests/xfs/group | 2 +- > 2 files changed, 5 insertions(+), 4 deletions(-) > > > diff --git a/tests/xfs/128 b/tests/xfs/128 > index 8758d7e..2e756d5 100755 > --- a/tests/xfs/128 > +++ b/tests/xfs/128 > @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full > _cp_reflink $testdir/file1 $testdir/file2 > _cp_reflink $testdir/file2 $testdir/file3 > _cp_reflink $testdir/file3 $testdir/file4 > -_test_cycle_mount > +_scratch_cycle_mount > free_blocks1=$(stat -f $testdir -c '%f') > > md5sum $testdir/file1 | _filter_scratch > @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) > echo "CoW the reflink copies" > _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full > _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full > -_test_cycle_mount > +_scratch_cycle_mount > free_blocks2=$(stat -f $testdir -c '%f') > > md5sum $testdir/file1 | _filter_scratch > @@ -97,11 +97,12 @@ c14=$(_md5_checksum $testdir/file4) > > echo "Defragment" > lsattr -l $testdir/ | _filter_scratch | _filter_spaces > +filefrag -v $testdir/file* >> $seqres.full Is this intentional? Use $FILEFRAG_PROG instead and add _require_command "$FILEFRAG_PROG" "filefrag" at the beginning of the test? Thanks, Eryu > $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link > $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link > $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file > -_test_cycle_mount > +_scratch_cycle_mount > free_blocks3=$(stat -f $testdir -c '%f') > > md5sum $testdir/file1 | _filter_scratch > diff --git a/tests/xfs/group b/tests/xfs/group > index aa3b3ec..5ccf3d6 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -125,7 +125,7 @@ > 125 fuzzers > 126 fuzzers > 127 auto quick clone > -128 auto quick clone > +128 auto quick clone fsr > 129 auto quick clone > 130 fuzzers clone > 131 auto quick clone > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:13PM -0700, Darrick J. Wong wrote: > Calling _mount doesn't work when we want to add mount options > such as realtime devices. Since it's just a normal scratch device > mount except for the source device, just call _scratch_mount with > SCRATCH_DEV set to the dmerror device. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > common/dmerror | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > > diff --git a/common/dmerror b/common/dmerror > index 5ad9994..22b9ea9 100644 > --- a/common/dmerror > +++ b/common/dmerror > @@ -41,14 +41,9 @@ _dmerror_init() > DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" > } > > -_dmerror_mount_options() > -{ > - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT > -} > - > _dmerror_mount() > { > - _mount -t $FSTYP `_dmerror_mount_options $*` > + SCRATCH_DEV=$DMERROR_DEV _scratch_mount $* Perhaps you can add "_scratch_options mount" to _dmerror_mount then mount with $SCRATCH_OPTIONS? Like what _mount_delay does in common/dmdelay. Thanks, Eryu > } > > _dmerror_unmount() >
On Thu, Jul 21, 2016 at 04:47:13PM -0700, Darrick J. Wong wrote: > Calling _mount doesn't work when we want to add mount options > such as realtime devices. Since it's just a normal scratch device > mount except for the source device, just call _scratch_mount with > SCRATCH_DEV set to the dmerror device. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > common/dmerror | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > > diff --git a/common/dmerror b/common/dmerror > index 5ad9994..22b9ea9 100644 > --- a/common/dmerror > +++ b/common/dmerror > @@ -41,14 +41,9 @@ _dmerror_init() > DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" > } > > -_dmerror_mount_options() > -{ > - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT > -} > - > _dmerror_mount() > { > - _mount -t $FSTYP `_dmerror_mount_options $*` > + SCRATCH_DEV=$DMERROR_DEV _scratch_mount $* Perhaps you can add "_scratch_options mount" to _dmerror_mount then mount with $SCRATCH_OPTIONS? Like what _mount_delay does in common/dmdelay. Thanks, Eryu > } > > _dmerror_unmount() > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Wed, Aug 03, 2016 at 05:15:42PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote: > > Run xfs_repair twice at the end of each test -- once to rebuild > > the btree indices, and again with -n to check the rebuild work. > > Seems like it's two more xfs_repair, three in total :) Ok, how about this new commit message? "xfs: optionally test xfs_repair index rebuilding at the end of each test "Run xfs_repair twice more at the end of each test -- once to rebuild the btree indices, and again with -n to check the rebuild work. This is in addition to the regular dry-run spot check." > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > README | 4 ++++ > > common/rc | 30 ++++++++++++++++++++++++++++++ > > 2 files changed, 34 insertions(+) > > > > > > diff --git a/README b/README > > index 2647e12..4509cc1 100644 > > --- a/README > > +++ b/README > > @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): > > added to the end of fsstresss and fsx invocations, respectively, > > in case you wish to exclude certain operational modes from these > > tests. > > + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem > > + run xfs_repair -n to check the filesystem; xfs_repair to rebuild > > + metadata indexes; and xfs_repair -n (a third time) to check the > > + results of the rebuilding. > > > > - or add a case to the switch in common/config assigning > > these variables based on the hostname of your test > > diff --git a/common/rc b/common/rc > > index 7c79bf8..3b45578 100644 > > --- a/common/rc > > +++ b/common/rc > > @@ -2428,6 +2428,36 @@ _check_xfs_filesystem() > > ok=0 > > fi > > > > + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then > > + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > > + if [ $? -ne 0 ] > > + then > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > > + > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > > + echo "*** xfs_repair -n output ***" >>$seqres.full > > + cat $tmp.repair | _fix_malloc >>$seqres.full > > + echo "*** end xfs_repair output" >>$seqres.full > > + > > + ok=0 > > + fi > > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > > + > > + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > > + if [ $? -ne 0 ] > > + then > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > > + > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > > + echo "*** xfs_repair -n output ***" >>$seqres.full > > + cat $tmp.repair | _fix_malloc >>$seqres.full > > + echo "*** end xfs_repair output" >>$seqres.full > > + > > + ok=0 > > + fi > > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > > + fi > > + > > I think we can move this hunk after the original xfs_repair and swap the > xfs_repair order, i.e. > > xfs_repair -n # this is the original repair check > if <check_rebuild>; then > xfs_repair # do rebuild without -n > xfs_repair -n # check rebuild result > fi Ok. > This seems more clear to me and we can mark which repair is failing more > easily (right now the three xfs_repairs are all marked as "(r)", it's > hard to say which one is failing), e.g. > > xfs_repair -n # marked as "(r)", means "repair" > if <check_rebuild>; then > xfs_repair # mark as "(rb)", means "rebuild"? > xfs_repair -n # mark as "(rr)", means "repair rebuild"? We might as well use a full word to state which repair run failed. "filesystem on /dev/sdX is inconsistent (rebuild)" "filesystem on /dev/sdX is inconsistent (rebuild-reverify)" --D > fi > > Thanks, > Eryu > > > $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > > if [ $? -ne 0 ] > > then > >
On Wed, Aug 03, 2016 at 05:15:42PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:46:54PM -0700, Darrick J. Wong wrote: > > Run xfs_repair twice at the end of each test -- once to rebuild > > the btree indices, and again with -n to check the rebuild work. > > Seems like it's two more xfs_repair, three in total :) Ok, how about this new commit message? "xfs: optionally test xfs_repair index rebuilding at the end of each test "Run xfs_repair twice more at the end of each test -- once to rebuild the btree indices, and again with -n to check the rebuild work. This is in addition to the regular dry-run spot check." > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > README | 4 ++++ > > common/rc | 30 ++++++++++++++++++++++++++++++ > > 2 files changed, 34 insertions(+) > > > > > > diff --git a/README b/README > > index 2647e12..4509cc1 100644 > > --- a/README > > +++ b/README > > @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): > > added to the end of fsstresss and fsx invocations, respectively, > > in case you wish to exclude certain operational modes from these > > tests. > > + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem > > + run xfs_repair -n to check the filesystem; xfs_repair to rebuild > > + metadata indexes; and xfs_repair -n (a third time) to check the > > + results of the rebuilding. > > > > - or add a case to the switch in common/config assigning > > these variables based on the hostname of your test > > diff --git a/common/rc b/common/rc > > index 7c79bf8..3b45578 100644 > > --- a/common/rc > > +++ b/common/rc > > @@ -2428,6 +2428,36 @@ _check_xfs_filesystem() > > ok=0 > > fi > > > > + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then > > + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > > + if [ $? -ne 0 ] > > + then > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > > + > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > > + echo "*** xfs_repair -n output ***" >>$seqres.full > > + cat $tmp.repair | _fix_malloc >>$seqres.full > > + echo "*** end xfs_repair output" >>$seqres.full > > + > > + ok=0 > > + fi > > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > > + > > + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > > + if [ $? -ne 0 ] > > + then > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)" > > + > > + echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full > > + echo "*** xfs_repair -n output ***" >>$seqres.full > > + cat $tmp.repair | _fix_malloc >>$seqres.full > > + echo "*** end xfs_repair output" >>$seqres.full > > + > > + ok=0 > > + fi > > + rm -f $tmp.fs_check $tmp.logprint $tmp.repair > > + fi > > + > > I think we can move this hunk after the original xfs_repair and swap the > xfs_repair order, i.e. > > xfs_repair -n # this is the original repair check > if <check_rebuild>; then > xfs_repair # do rebuild without -n > xfs_repair -n # check rebuild result > fi Ok. > This seems more clear to me and we can mark which repair is failing more > easily (right now the three xfs_repairs are all marked as "(r)", it's > hard to say which one is failing), e.g. > > xfs_repair -n # marked as "(r)", means "repair" > if <check_rebuild>; then > xfs_repair # mark as "(rb)", means "rebuild"? > xfs_repair -n # mark as "(rr)", means "repair rebuild"? We might as well use a full word to state which repair run failed. "filesystem on /dev/sdX is inconsistent (rebuild)" "filesystem on /dev/sdX is inconsistent (rebuild-reverify)" --D > fi > > Thanks, > Eryu > > > $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 > > if [ $? -ne 0 ] > > then > > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Wed, Aug 03, 2016 at 05:37:55PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:01PM -0700, Darrick J. Wong wrote: > > This test uses the scratch device, so cycle that, not the test dev. > > This is also a xfs_fsr test, so put it in the fsr group. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/128 | 7 ++++--- > > tests/xfs/group | 2 +- > > 2 files changed, 5 insertions(+), 4 deletions(-) > > > > > > diff --git a/tests/xfs/128 b/tests/xfs/128 > > index 8758d7e..2e756d5 100755 > > --- a/tests/xfs/128 > > +++ b/tests/xfs/128 > > @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full > > _cp_reflink $testdir/file1 $testdir/file2 > > _cp_reflink $testdir/file2 $testdir/file3 > > _cp_reflink $testdir/file3 $testdir/file4 > > -_test_cycle_mount > > +_scratch_cycle_mount > > free_blocks1=$(stat -f $testdir -c '%f') > > > > md5sum $testdir/file1 | _filter_scratch > > @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) > > echo "CoW the reflink copies" > > _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full > > _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full > > -_test_cycle_mount > > +_scratch_cycle_mount > > free_blocks2=$(stat -f $testdir -c '%f') > > > > md5sum $testdir/file1 | _filter_scratch > > @@ -97,11 +97,12 @@ c14=$(_md5_checksum $testdir/file4) > > > > echo "Defragment" > > lsattr -l $testdir/ | _filter_scratch | _filter_spaces > > +filefrag -v $testdir/file* >> $seqres.full > > Is this intentional? Use $FILEFRAG_PROG instead and add > > _require_command "$FILEFRAG_PROG" "filefrag" > > at the beginning of the test? Oops, that was a mistake. Good catch! --D > > Thanks, > Eryu > > > $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > > $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link > > $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link > > $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file > > -_test_cycle_mount > > +_scratch_cycle_mount > > free_blocks3=$(stat -f $testdir -c '%f') > > > > md5sum $testdir/file1 | _filter_scratch > > diff --git a/tests/xfs/group b/tests/xfs/group > > index aa3b3ec..5ccf3d6 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -125,7 +125,7 @@ > > 125 fuzzers > > 126 fuzzers > > 127 auto quick clone > > -128 auto quick clone > > +128 auto quick clone fsr > > 129 auto quick clone > > 130 fuzzers clone > > 131 auto quick clone > >
On Wed, Aug 03, 2016 at 05:37:55PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:01PM -0700, Darrick J. Wong wrote: > > This test uses the scratch device, so cycle that, not the test dev. > > This is also a xfs_fsr test, so put it in the fsr group. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/128 | 7 ++++--- > > tests/xfs/group | 2 +- > > 2 files changed, 5 insertions(+), 4 deletions(-) > > > > > > diff --git a/tests/xfs/128 b/tests/xfs/128 > > index 8758d7e..2e756d5 100755 > > --- a/tests/xfs/128 > > +++ b/tests/xfs/128 > > @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full > > _cp_reflink $testdir/file1 $testdir/file2 > > _cp_reflink $testdir/file2 $testdir/file3 > > _cp_reflink $testdir/file3 $testdir/file4 > > -_test_cycle_mount > > +_scratch_cycle_mount > > free_blocks1=$(stat -f $testdir -c '%f') > > > > md5sum $testdir/file1 | _filter_scratch > > @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) > > echo "CoW the reflink copies" > > _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full > > _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full > > -_test_cycle_mount > > +_scratch_cycle_mount > > free_blocks2=$(stat -f $testdir -c '%f') > > > > md5sum $testdir/file1 | _filter_scratch > > @@ -97,11 +97,12 @@ c14=$(_md5_checksum $testdir/file4) > > > > echo "Defragment" > > lsattr -l $testdir/ | _filter_scratch | _filter_spaces > > +filefrag -v $testdir/file* >> $seqres.full > > Is this intentional? Use $FILEFRAG_PROG instead and add > > _require_command "$FILEFRAG_PROG" "filefrag" > > at the beginning of the test? Oops, that was a mistake. Good catch! --D > > Thanks, > Eryu > > > $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > > $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link > > $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link > > $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file > > -_test_cycle_mount > > +_scratch_cycle_mount > > free_blocks3=$(stat -f $testdir -c '%f') > > > > md5sum $testdir/file1 | _filter_scratch > > diff --git a/tests/xfs/group b/tests/xfs/group > > index aa3b3ec..5ccf3d6 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -125,7 +125,7 @@ > > 125 fuzzers > > 126 fuzzers > > 127 auto quick clone > > -128 auto quick clone > > +128 auto quick clone fsr > > 129 auto quick clone > > 130 fuzzers clone > > 131 auto quick clone > > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Wed, Aug 03, 2016 at 06:38:00PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:13PM -0700, Darrick J. Wong wrote: > > Calling _mount doesn't work when we want to add mount options > > such as realtime devices. Since it's just a normal scratch device > > mount except for the source device, just call _scratch_mount with > > SCRATCH_DEV set to the dmerror device. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > common/dmerror | 7 +------ > > 1 file changed, 1 insertion(+), 6 deletions(-) > > > > > > diff --git a/common/dmerror b/common/dmerror > > index 5ad9994..22b9ea9 100644 > > --- a/common/dmerror > > +++ b/common/dmerror > > @@ -41,14 +41,9 @@ _dmerror_init() > > DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" > > } > > > > -_dmerror_mount_options() > > -{ > > - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT > > -} > > - > > _dmerror_mount() > > { > > - _mount -t $FSTYP `_dmerror_mount_options $*` > > + SCRATCH_DEV=$DMERROR_DEV _scratch_mount $* > > Perhaps you can add "_scratch_options mount" to _dmerror_mount then > mount with $SCRATCH_OPTIONS? Like what _mount_delay does in > common/dmdelay. Oh, yeah, that makes sense. --D > > Thanks, > Eryu > > > } > > > > _dmerror_unmount() > >
On Wed, Aug 03, 2016 at 06:38:00PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:13PM -0700, Darrick J. Wong wrote: > > Calling _mount doesn't work when we want to add mount options > > such as realtime devices. Since it's just a normal scratch device > > mount except for the source device, just call _scratch_mount with > > SCRATCH_DEV set to the dmerror device. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > common/dmerror | 7 +------ > > 1 file changed, 1 insertion(+), 6 deletions(-) > > > > > > diff --git a/common/dmerror b/common/dmerror > > index 5ad9994..22b9ea9 100644 > > --- a/common/dmerror > > +++ b/common/dmerror > > @@ -41,14 +41,9 @@ _dmerror_init() > > DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" > > } > > > > -_dmerror_mount_options() > > -{ > > - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT > > -} > > - > > _dmerror_mount() > > { > > - _mount -t $FSTYP `_dmerror_mount_options $*` > > + SCRATCH_DEV=$DMERROR_DEV _scratch_mount $* > > Perhaps you can add "_scratch_options mount" to _dmerror_mount then > mount with $SCRATCH_OPTIONS? Like what _mount_delay does in > common/dmdelay. Oh, yeah, that makes sense. --D > > Thanks, > Eryu > > > } > > > > _dmerror_unmount() > > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Run xfs_repair twice more at the end of each test -- once to rebuild the btree indices, and again with -n to check the rebuild work. This is in addition to the regular dry-run spot check. v2: Reorder the repair invocations and label them better in the output. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- README | 4 ++++ common/rc | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/README b/README index 2647e12..4509cc1 100644 --- a/README +++ b/README @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): added to the end of fsstresss and fsx invocations, respectively, in case you wish to exclude certain operational modes from these tests. + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem + run xfs_repair -n to check the filesystem; xfs_repair to rebuild + metadata indexes; and xfs_repair -n (a third time) to check the + results of the rebuilding. - or add a case to the switch in common/config assigning these variables based on the hostname of your test diff --git a/common/rc b/common/rc index 0ff72f2..eca9b9d 100644 --- a/common/rc +++ b/common/rc @@ -2452,6 +2452,37 @@ _check_xfs_filesystem() fi rm -f $tmp.fs_check $tmp.logprint $tmp.repair + # Optionally test the index rebuilding behavior. + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild)" >>$seqres.full + echo "*** xfs_repair output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild-reverify) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild-reverify)" >>$seqres.full + echo "*** xfs_repair -n output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + fi + if [ $ok -eq 0 ] then echo "*** mount output ***" >>$seqres.full
Run xfs_repair twice more at the end of each test -- once to rebuild the btree indices, and again with -n to check the rebuild work. This is in addition to the regular dry-run spot check. v2: Reorder the repair invocations and label them better in the output. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- README | 4 ++++ common/rc | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/README b/README index 2647e12..4509cc1 100644 --- a/README +++ b/README @@ -80,6 +80,10 @@ Preparing system for tests (IRIX and Linux): added to the end of fsstresss and fsx invocations, respectively, in case you wish to exclude certain operational modes from these tests. + - set TEST_XFS_REPAIR_REBUILD=1 to have _check_xfs_filesystem + run xfs_repair -n to check the filesystem; xfs_repair to rebuild + metadata indexes; and xfs_repair -n (a third time) to check the + results of the rebuilding. - or add a case to the switch in common/config assigning these variables based on the hostname of your test diff --git a/common/rc b/common/rc index 0ff72f2..eca9b9d 100644 --- a/common/rc +++ b/common/rc @@ -2452,6 +2452,37 @@ _check_xfs_filesystem() fi rm -f $tmp.fs_check $tmp.logprint $tmp.repair + # Optionally test the index rebuilding behavior. + if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then + $XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild)" >>$seqres.full + echo "*** xfs_repair output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + + $XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1 + if [ $? -ne 0 ] + then + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild-reverify) (see $seqres.full)" + + echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild-reverify)" >>$seqres.full + echo "*** xfs_repair -n output ***" >>$seqres.full + cat $tmp.repair | _fix_malloc >>$seqres.full + echo "*** end xfs_repair output" >>$seqres.full + + ok=0 + fi + rm -f $tmp.fs_check $tmp.logprint $tmp.repair + fi + if [ $ok -eq 0 ] then echo "*** mount output ***" >>$seqres.full _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
This test uses the scratch device, so cycle that, not the test dev. This is also a xfs_fsr test, so put it in the fsr group. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/128 | 6 +++--- tests/xfs/group | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/xfs/128 b/tests/xfs/128 index 8758d7e..04633a1 100755 --- a/tests/xfs/128 +++ b/tests/xfs/128 @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file2 _cp_reflink $testdir/file2 $testdir/file3 _cp_reflink $testdir/file3 $testdir/file4 -_test_cycle_mount +_scratch_cycle_mount free_blocks1=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) echo "CoW the reflink copies" _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full -_test_cycle_mount +_scratch_cycle_mount free_blocks2=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -101,7 +101,7 @@ $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file -_test_cycle_mount +_scratch_cycle_mount free_blocks3=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch diff --git a/tests/xfs/group b/tests/xfs/group index 05571e4..ff0efa5 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -125,7 +125,7 @@ 125 fuzzers 126 fuzzers 127 auto quick clone -128 auto quick clone +128 auto quick clone fsr 129 auto quick clone 130 fuzzers clone 131 auto quick clone
This test uses the scratch device, so cycle that, not the test dev. This is also a xfs_fsr test, so put it in the fsr group. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/128 | 6 +++--- tests/xfs/group | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/xfs/128 b/tests/xfs/128 index 8758d7e..04633a1 100755 --- a/tests/xfs/128 +++ b/tests/xfs/128 @@ -66,7 +66,7 @@ _pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full _cp_reflink $testdir/file1 $testdir/file2 _cp_reflink $testdir/file2 $testdir/file3 _cp_reflink $testdir/file3 $testdir/file4 -_test_cycle_mount +_scratch_cycle_mount free_blocks1=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -82,7 +82,7 @@ c04=$(_md5_checksum $testdir/file4) echo "CoW the reflink copies" _pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full _pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full -_test_cycle_mount +_scratch_cycle_mount free_blocks2=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch @@ -101,7 +101,7 @@ $XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full $XFS_FSR_PROG -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link $XFS_FSR_PROG -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file -_test_cycle_mount +_scratch_cycle_mount free_blocks3=$(stat -f $testdir -c '%f') md5sum $testdir/file1 | _filter_scratch diff --git a/tests/xfs/group b/tests/xfs/group index 05571e4..ff0efa5 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -125,7 +125,7 @@ 125 fuzzers 126 fuzzers 127 auto quick clone -128 auto quick clone +128 auto quick clone fsr 129 auto quick clone 130 fuzzers clone 131 auto quick clone _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Calling _mount doesn't work when we want to add mount options such as realtime devices. Since it's just a normal scratch device mount except for the source device, just call _scratch_mount with SCRATCH_DEV set to the dmerror device. v2: Use the standard _scratch_options for mounting. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/dmerror | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/dmerror b/common/dmerror index 5ad9994..d05c4c8 100644 --- a/common/dmerror +++ b/common/dmerror @@ -41,14 +41,10 @@ _dmerror_init() DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" } -_dmerror_mount_options() -{ - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT -} - _dmerror_mount() { - _mount -t $FSTYP `_dmerror_mount_options $*` + _scratch_options mount + $MOUNT_PROG -t $FSTYP `_common_dev_mount_options $*` $SCRATCH_OPTIONS \ } _dmerror_unmount()
Calling _mount doesn't work when we want to add mount options such as realtime devices. Since it's just a normal scratch device mount except for the source device, just call _scratch_mount with SCRATCH_DEV set to the dmerror device. v2: Use the standard _scratch_options for mounting. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/dmerror | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/dmerror b/common/dmerror index 5ad9994..d05c4c8 100644 --- a/common/dmerror +++ b/common/dmerror @@ -41,14 +41,10 @@ _dmerror_init() DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" } -_dmerror_mount_options() -{ - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT -} - _dmerror_mount() { - _mount -t $FSTYP `_dmerror_mount_options $*` + _scratch_options mount + $MOUNT_PROG -t $FSTYP `_common_dev_mount_options $*` $SCRATCH_OPTIONS \ } _dmerror_unmount() _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Wed, Aug 03, 2016 at 03:50:04PM -0700, Darrick J. Wong wrote: > Calling _mount doesn't work when we want to add mount options > such as realtime devices. Since it's just a normal scratch device > mount except for the source device, just call _scratch_mount with > SCRATCH_DEV set to the dmerror device. > > v2: Use the standard _scratch_options for mounting. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > common/dmerror | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/common/dmerror b/common/dmerror > index 5ad9994..d05c4c8 100644 > --- a/common/dmerror > +++ b/common/dmerror > @@ -41,14 +41,10 @@ _dmerror_init() > DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" > } > > -_dmerror_mount_options() > -{ > - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT > -} > - > _dmerror_mount() > { > - _mount -t $FSTYP `_dmerror_mount_options $*` > + _scratch_options mount > + $MOUNT_PROG -t $FSTYP `_common_dev_mount_options $*` $SCRATCH_OPTIONS \ ...aaand of course the next line accidentally got erased. Sigh. v3 it is. --D > } > > _dmerror_unmount() > -- > To unsubscribe from this list: send the line "unsubscribe fstests" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 03, 2016 at 03:50:04PM -0700, Darrick J. Wong wrote: > Calling _mount doesn't work when we want to add mount options > such as realtime devices. Since it's just a normal scratch device > mount except for the source device, just call _scratch_mount with > SCRATCH_DEV set to the dmerror device. > > v2: Use the standard _scratch_options for mounting. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > common/dmerror | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/common/dmerror b/common/dmerror > index 5ad9994..d05c4c8 100644 > --- a/common/dmerror > +++ b/common/dmerror > @@ -41,14 +41,10 @@ _dmerror_init() > DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" > } > > -_dmerror_mount_options() > -{ > - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT > -} > - > _dmerror_mount() > { > - _mount -t $FSTYP `_dmerror_mount_options $*` > + _scratch_options mount > + $MOUNT_PROG -t $FSTYP `_common_dev_mount_options $*` $SCRATCH_OPTIONS \ ...aaand of course the next line accidentally got erased. Sigh. v3 it is. --D > } > > _dmerror_unmount() > -- > To unsubscribe from this list: send the line "unsubscribe fstests" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Calling _mount doesn't work when we want to add mount options such as realtime devices. Since it's just a normal scratch device mount except for the source device, just call _scratch_mount with SCRATCH_DEV set to the dmerror device. v2: Use the standard _scratch_options for mounting. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/dmerror | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/common/dmerror b/common/dmerror index 5ad9994..d46c5d0 100644 --- a/common/dmerror +++ b/common/dmerror @@ -41,14 +41,11 @@ _dmerror_init() DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" } -_dmerror_mount_options() -{ - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT -} - _dmerror_mount() { - _mount -t $FSTYP `_dmerror_mount_options $*` + _scratch_options mount + $MOUNT_PROG -t $FSTYP `_common_dev_mount_options $*` $SCRATCH_OPTIONS \ + $DMERROR_DEV $SCRATCH_MNT } _dmerror_unmount()
Calling _mount doesn't work when we want to add mount options such as realtime devices. Since it's just a normal scratch device mount except for the source device, just call _scratch_mount with SCRATCH_DEV set to the dmerror device. v2: Use the standard _scratch_options for mounting. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- common/dmerror | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/common/dmerror b/common/dmerror index 5ad9994..d46c5d0 100644 --- a/common/dmerror +++ b/common/dmerror @@ -41,14 +41,11 @@ _dmerror_init() DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" } -_dmerror_mount_options() -{ - echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT -} - _dmerror_mount() { - _mount -t $FSTYP `_dmerror_mount_options $*` + _scratch_options mount + $MOUNT_PROG -t $FSTYP `_common_dev_mount_options $*` $SCRATCH_OPTIONS \ + $DMERROR_DEV $SCRATCH_MNT } _dmerror_unmount() _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:32PM -0700, Darrick J. Wong wrote: > Test sharing blocks via reflink and dedupe between two different > mountpoints of the same filesystem. This shouldn't work, since > we don't allow cross-mountpoint functions. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > + > +# real QA test starts here > +_supported_os Linux I added "_supported_fs generic" > +_require_scratch_reflink > +_require_cp_reflink > + > +filter_md5() { and move "{" to a new line. Also made the same changes to 928 and queued the patch up. Thanks, Eryu
On Thu, Jul 21, 2016 at 04:47:32PM -0700, Darrick J. Wong wrote: > Test sharing blocks via reflink and dedupe between two different > mountpoints of the same filesystem. This shouldn't work, since > we don't allow cross-mountpoint functions. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > + > +# real QA test starts here > +_supported_os Linux I added "_supported_fs generic" > +_require_scratch_reflink > +_require_cp_reflink > + > +filter_md5() { and move "{" to a new line. Also made the same changes to 928 and queued the patch up. Thanks, Eryu _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote: > Add a few tests to stress the new swapext code for reflink and rmap. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/873 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/873.out | 6 +++ > tests/xfs/874 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/874.out | 10 +++++ > tests/xfs/875 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/875.out | 12 ++++++ > tests/xfs/group | 3 + > 7 files changed, 337 insertions(+) > create mode 100755 tests/xfs/873 > create mode 100644 tests/xfs/873.out > create mode 100755 tests/xfs/874 > create mode 100644 tests/xfs/874.out > create mode 100755 tests/xfs/875 > create mode 100644 tests/xfs/875.out > > > diff --git a/tests/xfs/873 b/tests/xfs/873 > new file mode 100755 > index 0000000..a980148 > --- /dev/null > +++ b/tests/xfs/873 > @@ -0,0 +1,107 @@ > +#! /bin/bash > +# FS QA Test No. 873 > +# > +# See how well xfs_fsr handles "defragging" a file with a hojillion extents. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > +. ./common/reflink > + > +# real QA test starts here > +_supported_os Linux _supported_fs xfs (next two tests need this as well) > +_require_scratch_reflink > +_require_cp_reflink > +_require_test_program "punch-alternating" > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" This can be replaced by (applies to next two tests): _require_command "$XFS_FSR_PROG" "xfs_fsr" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount >> "$seqres.full" 2>&1 > + > +testdir="$SCRATCH_MNT/test-$seq" > +mkdir "$testdir" > + > +# Setup for 16000 blocks, but we'll accept stress testing down to > +# 2^10 blocks... that should be plenty for anyone. > +fnr=$((12 + LOAD_FACTOR)) > +free_blocks=$(stat -f -c '%a' "$testdir") > +blksz=$(stat -f -c '%S' "$testdir") > +space_avail=$((free_blocks * blksz)) > +calc_space() { > + blocks_needed=$(( 2 ** (fnr + 1) )) > + space_needed=$((blocks_needed * blksz * 5 / 4)) > +} > +calc_space > +while test $space_needed -gt $space_avail; do > + fnr=$((fnr - 1)) > + calc_space > +done > +test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents." > +bytes=$((blocks_needed * blksz)) > + > +echo "Create a many-block file" > +echo "creating $blocks_needed blocks..." >> "$seqres.full" > +_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full > +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full" > +echo "punching..." >> "$seqres.full" > +"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full" > +seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do > + _reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full > +done > +echo "...done" >> "$seqres.full" > +_scratch_cycle_mount > + > +echo "Reflink the big file" > +echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full" > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" > + > +echo "Defrag the big file" > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) There's a "_count_extents" helper, does that work for this case? > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > + > +echo "Check extent count" > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > + > +# success, all done > +status=0 > +exit And 873 fails the post-test fs check on "-m reflink=1,rmapbt=1" XFS, test passed if rmapbt=0, just FYI (tested with your djwong-experimental branch kernel and xfsprogs). _check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent *** xfs_repair -n output *** Phase 1 - find and verify superblock... Phase 2 - using internal log - zero log... - scan filesystem freespace and inode maps... sb_fdblocks 3903040, counted 3903229 - found root inode chunk Phase 3 - for each AG... - scan (but don't clear) agi unlinked lists... - process known inodes and perform inode discovery... - agno = 0 - agno = 1 - agno = 2 - agno = 3 - process newly discovered inodes... Phase 4 - check for duplicate blocks... - setting up duplicate extent list... - check for inodes claiming duplicate blocks... - agno = 0 - agno = 1 - agno = 2 - agno = 3 No modify flag set, skipping phase 5 Phase 6 - check inode connectivity... - traversing filesystem ... - traversal finished ... - moving disconnected inodes to lost+found ... Phase 7 - verify link counts... No modify flag set, skipping filesystem flush and exiting. *** end xfs_repair output > diff --git a/tests/xfs/873.out b/tests/xfs/873.out > new file mode 100644 > index 0000000..9dddf55 > --- /dev/null > +++ b/tests/xfs/873.out > @@ -0,0 +1,6 @@ > +QA output created by 873 > +Format and mount > +Create a many-block file > +Reflink the big file > +Defrag the big file > +Check extent count > diff --git a/tests/xfs/874 b/tests/xfs/874 > new file mode 100755 > index 0000000..fb31ea8 > --- /dev/null > +++ b/tests/xfs/874 > @@ -0,0 +1,99 @@ > +#! /bin/bash > +# FS QA Test No. 874 > +# > +# Ensure that xfs_fsr handles errors correctly while defragging files. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > +. ./common/reflink > +. ./common/quota Seems this is not needed in this test. > +. ./common/inject > + > +# real QA test starts here > +_supported_os Linux > +_require_scratch_reflink > +_require_cp_reflink > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > +_require_xfs_io_error_injection "bmap_finish_one" > +_require_xfs_scratch_rmapbt > + > +_repquota() { > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > +} Not used & needed. > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount >> "$seqres.full" 2>&1 > + > +testdir="$SCRATCH_MNT/test-$seq" > +blksz=65536 > +blks=3 > +mkdir "$testdir" > + > +echo "Create a many-block file" > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > +_scratch_cycle_mount > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > + > +echo "Inject error" > +_scratch_inject_error "bmap_finish_one" > + > +echo "Defrag the file" > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1 > + > +echo "FS should be shut down, touch will fail" > +touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch > + > +echo "Remount to replay log" | tee /dev/ttyprintk > +_scratch_inject_logprint >> $seqres.full > + > +echo "Check extent count" | tee /dev/ttyprintk > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > + > +echo "FS should be online, touch should succeed" > +touch $SCRATCH_MNT/goodfs > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/874.out b/tests/xfs/874.out > new file mode 100644 > index 0000000..dbc0f49 > --- /dev/null > +++ b/tests/xfs/874.out > @@ -0,0 +1,10 @@ > +QA output created by 874 > +Format and mount > +Create a many-block file > +Inject error > +Defrag the file > +FS should be shut down, touch will fail > +touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error > +Remount to replay log > +Check extent count > +FS should be online, touch should succeed > diff --git a/tests/xfs/875 b/tests/xfs/875 > new file mode 100755 > index 0000000..17c28db > --- /dev/null > +++ b/tests/xfs/875 > @@ -0,0 +1,100 @@ > +#! /bin/bash > +# FS QA Test No. 875 > +# > +# Ensure that xfs_fsr handles quota correctly while defragging files. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > +. ./common/reflink > +. ./common/quota > + > +# real QA test starts here > +_supported_os Linux > +_require_scratch_reflink > +_require_cp_reflink > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > +_require_quota > +_require_nobody > + > +_repquota() { > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > +} Helpers starting with "_" are usually from common code, I'd rename it to something like "do_repquota" and put the open brace to a new line. Thanks, Eryu > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" > +_scratch_mount >> "$seqres.full" 2>&1 > +quotacheck -u -g $SCRATCH_MNT 2> /dev/null > +quotaon $SCRATCH_MNT 2> /dev/null > + > +testdir="$SCRATCH_MNT/test-$seq" > +blksz=65536 > +blks=3 > +mkdir "$testdir" > + > +echo "Create a many-block file" > +touch $testdir/file1 > +chown nobody $testdir/file1 > +touch $testdir/file2 > +chown nobody $testdir/file2 > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > +_repquota > +_scratch_cycle_mount > + > +echo "Defrag the file" > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > +_repquota > + > +echo "Remount the FS to see if accounting changes" > +_scratch_cycle_mount > +_repquota > + > +echo "Check extent count" > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/875.out b/tests/xfs/875.out > new file mode 100644 > index 0000000..57653e9 > --- /dev/null > +++ b/tests/xfs/875.out > @@ -0,0 +1,12 @@ > +QA output created by 875 > +Format and mount > +Create a many-block file > +root -- 0 0 0 4 0 0 > +nobody -- 256 0 0 2 0 0 > +Defrag the file > +root -- 0 0 0 4 0 0 > +nobody -- 256 0 0 2 0 0 > +Remount the FS to see if accounting changes > +root -- 0 0 0 4 0 0 > +nobody -- 256 0 0 2 0 0 > +Check extent count > diff --git a/tests/xfs/group b/tests/xfs/group > index 5ccf3d6..16f7947 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -306,3 +306,6 @@ > 325 auto quick clone > 326 auto quick clone > 327 auto quick clone > +873 auto quick clone fsr > +874 auto quick clone fsr > +875 auto quick clone fsr quota >
On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote: > Add a few tests to stress the new swapext code for reflink and rmap. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/873 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/873.out | 6 +++ > tests/xfs/874 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/874.out | 10 +++++ > tests/xfs/875 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/875.out | 12 ++++++ > tests/xfs/group | 3 + > 7 files changed, 337 insertions(+) > create mode 100755 tests/xfs/873 > create mode 100644 tests/xfs/873.out > create mode 100755 tests/xfs/874 > create mode 100644 tests/xfs/874.out > create mode 100755 tests/xfs/875 > create mode 100644 tests/xfs/875.out > > > diff --git a/tests/xfs/873 b/tests/xfs/873 > new file mode 100755 > index 0000000..a980148 > --- /dev/null > +++ b/tests/xfs/873 > @@ -0,0 +1,107 @@ > +#! /bin/bash > +# FS QA Test No. 873 > +# > +# See how well xfs_fsr handles "defragging" a file with a hojillion extents. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > +. ./common/reflink > + > +# real QA test starts here > +_supported_os Linux _supported_fs xfs (next two tests need this as well) > +_require_scratch_reflink > +_require_cp_reflink > +_require_test_program "punch-alternating" > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" This can be replaced by (applies to next two tests): _require_command "$XFS_FSR_PROG" "xfs_fsr" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount >> "$seqres.full" 2>&1 > + > +testdir="$SCRATCH_MNT/test-$seq" > +mkdir "$testdir" > + > +# Setup for 16000 blocks, but we'll accept stress testing down to > +# 2^10 blocks... that should be plenty for anyone. > +fnr=$((12 + LOAD_FACTOR)) > +free_blocks=$(stat -f -c '%a' "$testdir") > +blksz=$(stat -f -c '%S' "$testdir") > +space_avail=$((free_blocks * blksz)) > +calc_space() { > + blocks_needed=$(( 2 ** (fnr + 1) )) > + space_needed=$((blocks_needed * blksz * 5 / 4)) > +} > +calc_space > +while test $space_needed -gt $space_avail; do > + fnr=$((fnr - 1)) > + calc_space > +done > +test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents." > +bytes=$((blocks_needed * blksz)) > + > +echo "Create a many-block file" > +echo "creating $blocks_needed blocks..." >> "$seqres.full" > +_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full > +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full" > +echo "punching..." >> "$seqres.full" > +"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full" > +seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do > + _reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full > +done > +echo "...done" >> "$seqres.full" > +_scratch_cycle_mount > + > +echo "Reflink the big file" > +echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full" > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" > + > +echo "Defrag the big file" > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) There's a "_count_extents" helper, does that work for this case? > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > + > +echo "Check extent count" > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > + > +# success, all done > +status=0 > +exit And 873 fails the post-test fs check on "-m reflink=1,rmapbt=1" XFS, test passed if rmapbt=0, just FYI (tested with your djwong-experimental branch kernel and xfsprogs). _check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent *** xfs_repair -n output *** Phase 1 - find and verify superblock... Phase 2 - using internal log - zero log... - scan filesystem freespace and inode maps... sb_fdblocks 3903040, counted 3903229 - found root inode chunk Phase 3 - for each AG... - scan (but don't clear) agi unlinked lists... - process known inodes and perform inode discovery... - agno = 0 - agno = 1 - agno = 2 - agno = 3 - process newly discovered inodes... Phase 4 - check for duplicate blocks... - setting up duplicate extent list... - check for inodes claiming duplicate blocks... - agno = 0 - agno = 1 - agno = 2 - agno = 3 No modify flag set, skipping phase 5 Phase 6 - check inode connectivity... - traversing filesystem ... - traversal finished ... - moving disconnected inodes to lost+found ... Phase 7 - verify link counts... No modify flag set, skipping filesystem flush and exiting. *** end xfs_repair output > diff --git a/tests/xfs/873.out b/tests/xfs/873.out > new file mode 100644 > index 0000000..9dddf55 > --- /dev/null > +++ b/tests/xfs/873.out > @@ -0,0 +1,6 @@ > +QA output created by 873 > +Format and mount > +Create a many-block file > +Reflink the big file > +Defrag the big file > +Check extent count > diff --git a/tests/xfs/874 b/tests/xfs/874 > new file mode 100755 > index 0000000..fb31ea8 > --- /dev/null > +++ b/tests/xfs/874 > @@ -0,0 +1,99 @@ > +#! /bin/bash > +# FS QA Test No. 874 > +# > +# Ensure that xfs_fsr handles errors correctly while defragging files. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > +. ./common/reflink > +. ./common/quota Seems this is not needed in this test. > +. ./common/inject > + > +# real QA test starts here > +_supported_os Linux > +_require_scratch_reflink > +_require_cp_reflink > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > +_require_xfs_io_error_injection "bmap_finish_one" > +_require_xfs_scratch_rmapbt > + > +_repquota() { > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > +} Not used & needed. > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount >> "$seqres.full" 2>&1 > + > +testdir="$SCRATCH_MNT/test-$seq" > +blksz=65536 > +blks=3 > +mkdir "$testdir" > + > +echo "Create a many-block file" > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > +_scratch_cycle_mount > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > + > +echo "Inject error" > +_scratch_inject_error "bmap_finish_one" > + > +echo "Defrag the file" > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1 > + > +echo "FS should be shut down, touch will fail" > +touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch > + > +echo "Remount to replay log" | tee /dev/ttyprintk > +_scratch_inject_logprint >> $seqres.full > + > +echo "Check extent count" | tee /dev/ttyprintk > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > + > +echo "FS should be online, touch should succeed" > +touch $SCRATCH_MNT/goodfs > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/874.out b/tests/xfs/874.out > new file mode 100644 > index 0000000..dbc0f49 > --- /dev/null > +++ b/tests/xfs/874.out > @@ -0,0 +1,10 @@ > +QA output created by 874 > +Format and mount > +Create a many-block file > +Inject error > +Defrag the file > +FS should be shut down, touch will fail > +touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error > +Remount to replay log > +Check extent count > +FS should be online, touch should succeed > diff --git a/tests/xfs/875 b/tests/xfs/875 > new file mode 100755 > index 0000000..17c28db > --- /dev/null > +++ b/tests/xfs/875 > @@ -0,0 +1,100 @@ > +#! /bin/bash > +# FS QA Test No. 875 > +# > +# Ensure that xfs_fsr handles quota correctly while defragging files. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > +. ./common/reflink > +. ./common/quota > + > +# real QA test starts here > +_supported_os Linux > +_require_scratch_reflink > +_require_cp_reflink > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > +_require_quota > +_require_nobody > + > +_repquota() { > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > +} Helpers starting with "_" are usually from common code, I'd rename it to something like "do_repquota" and put the open brace to a new line. Thanks, Eryu > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" > +_scratch_mount >> "$seqres.full" 2>&1 > +quotacheck -u -g $SCRATCH_MNT 2> /dev/null > +quotaon $SCRATCH_MNT 2> /dev/null > + > +testdir="$SCRATCH_MNT/test-$seq" > +blksz=65536 > +blks=3 > +mkdir "$testdir" > + > +echo "Create a many-block file" > +touch $testdir/file1 > +chown nobody $testdir/file1 > +touch $testdir/file2 > +chown nobody $testdir/file2 > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > +_repquota > +_scratch_cycle_mount > + > +echo "Defrag the file" > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > +_repquota > + > +echo "Remount the FS to see if accounting changes" > +_scratch_cycle_mount > +_repquota > + > +echo "Check extent count" > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/875.out b/tests/xfs/875.out > new file mode 100644 > index 0000000..57653e9 > --- /dev/null > +++ b/tests/xfs/875.out > @@ -0,0 +1,12 @@ > +QA output created by 875 > +Format and mount > +Create a many-block file > +root -- 0 0 0 4 0 0 > +nobody -- 256 0 0 2 0 0 > +Defrag the file > +root -- 0 0 0 4 0 0 > +nobody -- 256 0 0 2 0 0 > +Remount the FS to see if accounting changes > +root -- 0 0 0 4 0 0 > +nobody -- 256 0 0 2 0 0 > +Check extent count > diff --git a/tests/xfs/group b/tests/xfs/group > index 5ccf3d6..16f7947 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -306,3 +306,6 @@ > 325 auto quick clone > 326 auto quick clone > 327 auto quick clone > +873 auto quick clone fsr > +874 auto quick clone fsr > +875 auto quick clone fsr quota > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:45PM -0700, Darrick J. Wong wrote: > More tests for the reverse mapping functionality. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/876 | 76 +++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/876.out | 4 ++ > tests/xfs/877 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/877.out | 10 ++++++ > tests/xfs/group | 4 ++ > 5 files changed, 178 insertions(+), 1 deletion(-) > create mode 100755 tests/xfs/876 > create mode 100644 tests/xfs/876.out > create mode 100755 tests/xfs/877 > create mode 100644 tests/xfs/877.out > > > diff --git a/tests/xfs/876 b/tests/xfs/876 > new file mode 100755 > index 0000000..cf73d40 > --- /dev/null > +++ b/tests/xfs/876 > @@ -0,0 +1,76 @@ > +#! /bin/bash > +# FS QA Test No. 876 > +# > +# Create a big enough rmapbt that we tickle a fdblocks accounting bug. This test failed post-test fs check as well "sb_fdblocks 3912360, counted 3912522" Seems like it's a known bug? > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr Seems this is not needed. > +. ./common/reflink > + > +# real QA test starts here > +_supported_os Linux > +_require_scratch > +_require_xfs_scratch_rmapbt > +_require_scratch_reflink > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "+ create scratch fs" > +_scratch_mkfs > "$seqres.full" 2>&1 > + > +echo "+ mount fs image" > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') We usually get isize from the output of _filter_mkfs, e.g. _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs Then all mkfs info is set accordingly, including $isize But in this test, isize is got but not used. Remove the line? > + > +bt_ptrs=$(( (blksz - 56) / 44 )) > +bt_recs=$(( (blksz - 56) / 24 )) > + > +blocks=$((bt_ptrs * bt_recs + 1)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +len=$((blocks * blksz)) > + > +echo "+ make some files" > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/876.out b/tests/xfs/876.out > new file mode 100644 > index 0000000..96c1970 > --- /dev/null > +++ b/tests/xfs/876.out > @@ -0,0 +1,4 @@ > +QA output created by 876 > ++ create scratch fs > ++ mount fs image > ++ make some files > diff --git a/tests/xfs/877 b/tests/xfs/877 > new file mode 100755 > index 0000000..9700263 > --- /dev/null > +++ b/tests/xfs/877 > @@ -0,0 +1,85 @@ > +#! /bin/bash > +# FS QA Test No. 877 > +# > +# Make sure query_range returns -EINVAL if lowkey > highkey. This test failed too, is this expected (again, tested with your djwong-experimental branck kernel and xfsprogs)? [root@dhcp-66-86-11 xfstests]# diff -u tests/xfs/877.out /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad --- tests/xfs/877.out 2016-08-08 16:22:35.151000000 +0800 +++ /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad 2016-08-08 16:23:12.405000000 +0800 @@ -7,4 +7,3 @@ Unmount Try a regular fsmap Try a bad fsmap -Error 22 while querying fsmap btree. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr Seems this is not needed. > + > +# real QA test starts here > +_supported_os Linux _supported_fs xfs > +_require_xfs_scratch_rmapbt _require_xfs_io_command commands used in this test? e.g. falloc, fpunch, fcollapse and finsert And '_require_command "$XFS_DB_PROG" "xfs_db"' > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz=65536 > +blocks=16 > +len=$((blocks * blksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Manipulate file" > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > + -c "fzero $((3 * blksz)) $blksz" \ > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > + -c "fpunch $((7 * blksz)) $blksz" \ > + -c "fsync" \ > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > + -c "fcollapse $((9 * blksz)) $blksz" \ > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Check file" > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Unmount" > +_scratch_unmount > + > +echo "Try a regular fsmap" > +$XFS_DB_PROG -c 'fsmap' $SCRATCH_DEV >> $seqres.full > +$XFS_DB_PROG -c 'fsmap 0 5' $SCRATCH_DEV >> $seqres.full > + > +echo "Try a bad fsmap" > +$XFS_DB_PROG -c 'fsmap 5 4' $SCRATCH_DEV > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/877.out b/tests/xfs/877.out > new file mode 100644 > index 0000000..4a2242f > --- /dev/null > +++ b/tests/xfs/877.out > @@ -0,0 +1,10 @@ > +QA output created by 877 > +Format and mount > +Create some files > +Manipulate file > +Check file > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > +Unmount > +Try a regular fsmap > +Try a bad fsmap > +Error 22 while querying fsmap btree. > diff --git a/tests/xfs/group b/tests/xfs/group > index 16f7947..f81f899 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -3,8 +3,8 @@ > 003 db auto quick > 004 db auto quick > 005 auto quick > -007 auto quota quick > 006 auto quick mount > +007 auto quota quick This is already fixed in upstream, not needed. Thanks, Eryu > 008 rw ioctl auto quick > 009 rw ioctl auto prealloc quick > 010 auto quick repair > @@ -309,3 +309,5 @@ > 873 auto quick clone fsr > 874 auto quick clone fsr > 875 auto quick clone fsr quota > +876 auto quick rmap clone > +877 auto quick rmap clone >
On Thu, Jul 21, 2016 at 04:47:45PM -0700, Darrick J. Wong wrote: > More tests for the reverse mapping functionality. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/876 | 76 +++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/876.out | 4 ++ > tests/xfs/877 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/877.out | 10 ++++++ > tests/xfs/group | 4 ++ > 5 files changed, 178 insertions(+), 1 deletion(-) > create mode 100755 tests/xfs/876 > create mode 100644 tests/xfs/876.out > create mode 100755 tests/xfs/877 > create mode 100644 tests/xfs/877.out > > > diff --git a/tests/xfs/876 b/tests/xfs/876 > new file mode 100755 > index 0000000..cf73d40 > --- /dev/null > +++ b/tests/xfs/876 > @@ -0,0 +1,76 @@ > +#! /bin/bash > +# FS QA Test No. 876 > +# > +# Create a big enough rmapbt that we tickle a fdblocks accounting bug. This test failed post-test fs check as well "sb_fdblocks 3912360, counted 3912522" Seems like it's a known bug? > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr Seems this is not needed. > +. ./common/reflink > + > +# real QA test starts here > +_supported_os Linux > +_require_scratch > +_require_xfs_scratch_rmapbt > +_require_scratch_reflink > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "+ create scratch fs" > +_scratch_mkfs > "$seqres.full" 2>&1 > + > +echo "+ mount fs image" > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') We usually get isize from the output of _filter_mkfs, e.g. _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs Then all mkfs info is set accordingly, including $isize But in this test, isize is got but not used. Remove the line? > + > +bt_ptrs=$(( (blksz - 56) / 44 )) > +bt_recs=$(( (blksz - 56) / 24 )) > + > +blocks=$((bt_ptrs * bt_recs + 1)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +len=$((blocks * blksz)) > + > +echo "+ make some files" > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/876.out b/tests/xfs/876.out > new file mode 100644 > index 0000000..96c1970 > --- /dev/null > +++ b/tests/xfs/876.out > @@ -0,0 +1,4 @@ > +QA output created by 876 > ++ create scratch fs > ++ mount fs image > ++ make some files > diff --git a/tests/xfs/877 b/tests/xfs/877 > new file mode 100755 > index 0000000..9700263 > --- /dev/null > +++ b/tests/xfs/877 > @@ -0,0 +1,85 @@ > +#! /bin/bash > +# FS QA Test No. 877 > +# > +# Make sure query_range returns -EINVAL if lowkey > highkey. This test failed too, is this expected (again, tested with your djwong-experimental branck kernel and xfsprogs)? [root@dhcp-66-86-11 xfstests]# diff -u tests/xfs/877.out /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad --- tests/xfs/877.out 2016-08-08 16:22:35.151000000 +0800 +++ /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad 2016-08-08 16:23:12.405000000 +0800 @@ -7,4 +7,3 @@ Unmount Try a regular fsmap Try a bad fsmap -Error 22 while querying fsmap btree. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr Seems this is not needed. > + > +# real QA test starts here > +_supported_os Linux _supported_fs xfs > +_require_xfs_scratch_rmapbt _require_xfs_io_command commands used in this test? e.g. falloc, fpunch, fcollapse and finsert And '_require_command "$XFS_DB_PROG" "xfs_db"' > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz=65536 > +blocks=16 > +len=$((blocks * blksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Manipulate file" > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > + -c "fzero $((3 * blksz)) $blksz" \ > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > + -c "fpunch $((7 * blksz)) $blksz" \ > + -c "fsync" \ > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > + -c "fcollapse $((9 * blksz)) $blksz" \ > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Check file" > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Unmount" > +_scratch_unmount > + > +echo "Try a regular fsmap" > +$XFS_DB_PROG -c 'fsmap' $SCRATCH_DEV >> $seqres.full > +$XFS_DB_PROG -c 'fsmap 0 5' $SCRATCH_DEV >> $seqres.full > + > +echo "Try a bad fsmap" > +$XFS_DB_PROG -c 'fsmap 5 4' $SCRATCH_DEV > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/877.out b/tests/xfs/877.out > new file mode 100644 > index 0000000..4a2242f > --- /dev/null > +++ b/tests/xfs/877.out > @@ -0,0 +1,10 @@ > +QA output created by 877 > +Format and mount > +Create some files > +Manipulate file > +Check file > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > +Unmount > +Try a regular fsmap > +Try a bad fsmap > +Error 22 while querying fsmap btree. > diff --git a/tests/xfs/group b/tests/xfs/group > index 16f7947..f81f899 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -3,8 +3,8 @@ > 003 db auto quick > 004 db auto quick > 005 auto quick > -007 auto quota quick > 006 auto quick mount > +007 auto quota quick This is already fixed in upstream, not needed. Thanks, Eryu > 008 rw ioctl auto quick > 009 rw ioctl auto prealloc quick > 010 auto quick repair > @@ -309,3 +309,5 @@ > 873 auto quick clone fsr > 874 auto quick clone fsr > 875 auto quick clone fsr quota > +876 auto quick rmap clone > +877 auto quick rmap clone > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:47:51PM -0700, Darrick J. Wong wrote: > Teach _check_xfs_filesystem to scrub mounted filesystems before > unmounting and fscking them. This is mostly to test the online > scrub tool... > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > README | 3 +++ > common/config | 1 + > common/rc | 7 +++++++ > 3 files changed, 11 insertions(+) > > > diff --git a/README b/README > index 4509cc1..c19fcb1 100644 > --- a/README > +++ b/README > @@ -84,6 +84,9 @@ Preparing system for tests (IRIX and Linux): > run xfs_repair -n to check the filesystem; xfs_repair to rebuild > metadata indexes; and xfs_repair -n (a third time) to check the > results of the rebuilding. > + - set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run > + xfs_scrub -vd to scrub the filesystem metadata online before > + unmounting to run the offline check. Mixed space and tab in above lines, I can fix it at commit time. Thanks, Eryu > > - or add a case to the switch in common/config assigning > these variables based on the hostname of your test > diff --git a/common/config b/common/config > index 08d5d80..168f46c 100644 > --- a/common/config > +++ b/common/config > @@ -163,6 +163,7 @@ export XFS_REPAIR_PROG="`set_prog_path xfs_repair`" > export XFS_DB_PROG="`set_prog_path xfs_db`" > export XFS_GROWFS_PROG=`set_prog_path xfs_growfs` > export XFS_IO_PROG="`set_prog_path xfs_io`" > +export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`" > export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`" > export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`" > export __XFSDUMP_PROG="`set_prog_path xfsdump`" > diff --git a/common/rc b/common/rc > index 3b45578..861a721 100644 > --- a/common/rc > +++ b/common/rc > @@ -2391,6 +2391,13 @@ _check_xfs_filesystem() > > if [ "$type" = "xfs" ] > then > + if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then > + "$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full > + if [ $? -ne 0 ]; then > + echo "filesystem on $device failed scrub (see $seqres.full)" > + ok=0 > + fi > + fi > # mounted ... > mountpoint=`_umount_or_remount_ro $device` > fi >
On Thu, Jul 21, 2016 at 04:47:51PM -0700, Darrick J. Wong wrote: > Teach _check_xfs_filesystem to scrub mounted filesystems before > unmounting and fscking them. This is mostly to test the online > scrub tool... > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > README | 3 +++ > common/config | 1 + > common/rc | 7 +++++++ > 3 files changed, 11 insertions(+) > > > diff --git a/README b/README > index 4509cc1..c19fcb1 100644 > --- a/README > +++ b/README > @@ -84,6 +84,9 @@ Preparing system for tests (IRIX and Linux): > run xfs_repair -n to check the filesystem; xfs_repair to rebuild > metadata indexes; and xfs_repair -n (a third time) to check the > results of the rebuilding. > + - set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run > + xfs_scrub -vd to scrub the filesystem metadata online before > + unmounting to run the offline check. Mixed space and tab in above lines, I can fix it at commit time. Thanks, Eryu > > - or add a case to the switch in common/config assigning > these variables based on the hostname of your test > diff --git a/common/config b/common/config > index 08d5d80..168f46c 100644 > --- a/common/config > +++ b/common/config > @@ -163,6 +163,7 @@ export XFS_REPAIR_PROG="`set_prog_path xfs_repair`" > export XFS_DB_PROG="`set_prog_path xfs_db`" > export XFS_GROWFS_PROG=`set_prog_path xfs_growfs` > export XFS_IO_PROG="`set_prog_path xfs_io`" > +export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`" > export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`" > export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`" > export __XFSDUMP_PROG="`set_prog_path xfsdump`" > diff --git a/common/rc b/common/rc > index 3b45578..861a721 100644 > --- a/common/rc > +++ b/common/rc > @@ -2391,6 +2391,13 @@ _check_xfs_filesystem() > > if [ "$type" = "xfs" ] > then > + if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then > + "$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full > + if [ $? -ne 0 ]; then > + echo "filesystem on $device failed scrub (see $seqres.full)" > + ok=0 > + fi > + fi > # mounted ... > mountpoint=`_umount_or_remount_ro $device` > fi > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Thu, Jul 21, 2016 at 04:48:07PM -0700, Darrick J. Wong wrote: > Test the realtime rmap btree code by exercising various IO patterns > on realtime files. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/878 | 88 +++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/878.out | 9 ++++ > tests/xfs/879 | 67 +++++++++++++++++++++++++++++++++ > tests/xfs/879.out | 7 +++ > tests/xfs/880 | 86 ++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/880.out | 7 +++ > tests/xfs/881 | 95 +++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/881.out | 8 ++++ > tests/xfs/882 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/882.out | 11 +++++ > tests/xfs/883 | 89 ++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/883.out | 10 +++++ > tests/xfs/884 | 91 +++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/884.out | 9 ++++ > tests/xfs/885 | 94 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/885.out | 10 +++++ > tests/xfs/886 | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/886.out | 7 +++ > tests/xfs/887 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/887.out | 7 +++ > tests/xfs/888 | 76 +++++++++++++++++++++++++++++++++++++ > tests/xfs/888.out | 6 +++ > tests/xfs/group | 11 +++++ > 23 files changed, 1107 insertions(+) > create mode 100644 tests/xfs/878 Need the mode of test file to be 755 > create mode 100644 tests/xfs/878.out > create mode 100755 tests/xfs/879 > create mode 100644 tests/xfs/879.out > create mode 100755 tests/xfs/880 > create mode 100644 tests/xfs/880.out > create mode 100755 tests/xfs/881 > create mode 100644 tests/xfs/881.out > create mode 100755 tests/xfs/882 > create mode 100644 tests/xfs/882.out > create mode 100755 tests/xfs/883 > create mode 100644 tests/xfs/883.out > create mode 100755 tests/xfs/884 > create mode 100644 tests/xfs/884.out > create mode 100755 tests/xfs/885 > create mode 100644 tests/xfs/885.out > create mode 100755 tests/xfs/886 > create mode 100644 tests/xfs/886.out > create mode 100755 tests/xfs/887 > create mode 100644 tests/xfs/887.out > create mode 100755 tests/xfs/888 > create mode 100644 tests/xfs/888.out > > > diff --git a/tests/xfs/878 b/tests/xfs/878 > new file mode 100644 > index 0000000..b1f2672 > --- /dev/null > +++ b/tests/xfs/878 > @@ -0,0 +1,88 @@ > +#! /bin/bash > +# FS QA Test No. 878 > +# > +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux _supported_fs xfs (also apply to all tests in this patch) > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +SCRATCH_RTDEV= USE_EXTERNAL= _scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +$XFS_DB_PROG -x -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch I think there's no need to filter unmount. > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/878.out b/tests/xfs/878.out > new file mode 100644 > index 0000000..e134506 > --- /dev/null > +++ b/tests/xfs/878.out > @@ -0,0 +1,9 @@ > +QA output created by 878 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/879 b/tests/xfs/879 > new file mode 100755 > index 0000000..0cbaf09 > --- /dev/null > +++ b/tests/xfs/879 > @@ -0,0 +1,67 @@ > +#! /bin/bash > +# FS QA Test No. 879 > +# > +# Ensure that we can create a few realtime files on a rmapbt filesystem. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr common/attr seems not needed in this test and other tests in this patch. > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create a few files" > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full > +_scratch_cycle_mount > + > +echo "Grab contents" > +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch > + > +echo "Remove one file" > +rm -rf $SCRATCH_MNT/f2 > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/879.out b/tests/xfs/879.out > new file mode 100644 > index 0000000..9dfe48b > --- /dev/null > +++ b/tests/xfs/879.out > @@ -0,0 +1,7 @@ > +QA output created by 879 > +Format and mount > +Create a few files > +Grab contents > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f1 > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f2 > +Remove one file > diff --git a/tests/xfs/880 b/tests/xfs/880 > new file mode 100755 > index 0000000..2056097 > --- /dev/null > +++ b/tests/xfs/880 > @@ -0,0 +1,86 @@ > +#! /bin/bash > +# FS QA Test No. 880 > +# > +# Exercise expanding and shrinking the realtime rmap btree. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +echo "Create a three-level rtrmapbt" > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_ptrs=$(( (blksz - 56) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') Both isize and rtextsz can be got from _filter_mkfs, as I mentioned in another email. Thanks, Eryu > +len=$((blocks * rtblksz)) > + > +echo "Create big file" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > + > +echo "Explode the rtrmapbt" > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +_scratch_cycle_mount > + > +echo "Remove half the records" > +rm -rf $SCRATCH_MNT/f1 > +_scratch_cycle_mount > + > +echo "Remove the rest of the records" > +rm -rf $SCRATCH_MNT/f2 > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/880.out b/tests/xfs/880.out > new file mode 100644 > index 0000000..b87665b > --- /dev/null > +++ b/tests/xfs/880.out > @@ -0,0 +1,7 @@ > +QA output created by 880 > +Format and mount > +Create a three-level rtrmapbt > +Create big file > +Explode the rtrmapbt > +Remove half the records > +Remove the rest of the records > diff --git a/tests/xfs/881 b/tests/xfs/881 > new file mode 100755 > index 0000000..c7474f5 > --- /dev/null > +++ b/tests/xfs/881 > @@ -0,0 +1,95 @@ > +#! /bin/bash > +# FS QA Test No. 881 > +# > +# Exercise metadump on realtime rmapbt preservation. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +metadump_file=$TEST_DIR/${seq}_metadump > +rm -rf $metadump_file > + > +echo "Create a three-level rtrmapbt" > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_ptrs=$(( (blksz - 56) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > +len=$((blocks * rtblksz)) > + > +echo "Create big file" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > + > +echo "Explode the rtrmapbt" > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +_scratch_cycle_mount > + > +echo "Create metadump file" > +_scratch_unmount > +_scratch_metadump $metadump_file > + > +# Now restore the obfuscated one back and take a look around > +echo "Restore metadump" > +xfs_mdrestore $metadump_file $TEST_DIR/image > +SCRATCH_DEV=$TEST_DIR/image _scratch_mount > +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount > + > +echo "Check restored fs" > +_check_generic_filesystem $metadump_file > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/881.out b/tests/xfs/881.out > new file mode 100644 > index 0000000..6ad156c > --- /dev/null > +++ b/tests/xfs/881.out > @@ -0,0 +1,8 @@ > +QA output created by 881 > +Format and mount > +Create a three-level rtrmapbt > +Create big file > +Explode the rtrmapbt > +Create metadump file > +Restore metadump > +Check restored fs > diff --git a/tests/xfs/882 b/tests/xfs/882 > new file mode 100755 > index 0000000..569a560 > --- /dev/null > +++ b/tests/xfs/882 > @@ -0,0 +1,108 @@ > +#! /bin/bash > +# FS QA Test No. 882 > +# > +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "+ create scratch fs" > +_scratch_mkfs > "$seqres.full" 2>&1 > + > +echo "+ mount fs image" > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_ptrs=$(( (blksz - 56) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +len=$((blocks * blksz)) > + > +echo "+ make some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +_scratch_unmount > + > +echo "+ check fs" > +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail" > + > +echo "+ corrupt image" > +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" -c "stack" \ > + -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" $SCRATCH_DEV >> $seqres.full 2>&1 > + > +echo "+ mount image" > +_scratch_mount > + > +echo "+ copy more" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1 > +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree" > +_scratch_unmount > + > +echo "+ repair fs" > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "+ mount image (2)" > +_scratch_mount > + > +echo "+ copy more (2)" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/882.out b/tests/xfs/882.out > new file mode 100644 > index 0000000..5ebe620 > --- /dev/null > +++ b/tests/xfs/882.out > @@ -0,0 +1,11 @@ > +QA output created by 882 > ++ create scratch fs > ++ mount fs image > ++ make some files > ++ check fs > ++ corrupt image > ++ mount image > ++ copy more > ++ repair fs > ++ mount image (2) > ++ copy more (2) > diff --git a/tests/xfs/883 b/tests/xfs/883 > new file mode 100755 > index 0000000..403ef35 > --- /dev/null > +++ b/tests/xfs/883 > @@ -0,0 +1,89 @@ > +#! /bin/bash > +# FS QA Test No. 883 > +# > +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +_scratch_unmount > + > +echo "Corrupt fs" > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c 'write core.nlinkv2 0' \ > + -c 'write core.mode 0' -c 'sb 0' -c 'write rrmapino 0' $SCRATCH_DEV >> $seqres.full > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/883.out b/tests/xfs/883.out > new file mode 100644 > index 0000000..6e75ac1 > --- /dev/null > +++ b/tests/xfs/883.out > @@ -0,0 +1,10 @@ > +QA output created by 883 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +md5sum: SCRATCH_MNT/f1: No such file or directory > +Try to create more files > +Repair fs > +umount: SCRATCH_DEV: not mounted > +Try to create more files (again) > diff --git a/tests/xfs/884 b/tests/xfs/884 > new file mode 100755 > index 0000000..ad648b8 > --- /dev/null > +++ b/tests/xfs/884 > @@ -0,0 +1,91 @@ > +#! /bin/bash > +# FS QA Test No. 884 > +# > +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +echo garbage > $SCRATCH_MNT/f3 > +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 > +_scratch_unmount > + > +echo "Corrupt fs" > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \ > + -c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/884.out b/tests/xfs/884.out > new file mode 100644 > index 0000000..17a73ef > --- /dev/null > +++ b/tests/xfs/884.out > @@ -0,0 +1,9 @@ > +QA output created by 884 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/885 b/tests/xfs/885 > new file mode 100755 > index 0000000..b5880bd > --- /dev/null > +++ b/tests/xfs/885 > @@ -0,0 +1,94 @@ > +#! /bin/bash > +# FS QA Test No. 885 > +# > +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > +$XFS_DB_PROG -x -c "inode $rrmapino" -c 'write core.format 2' \ > + -c 'write core.size 0' -c 'write core.nblocks 0' \ > + -c 'sb 0' -c 'addr rootino' -c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \ > + -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/885.out b/tests/xfs/885.out > new file mode 100644 > index 0000000..df04f79 > --- /dev/null > +++ b/tests/xfs/885.out > @@ -0,0 +1,10 @@ > +QA output created by 885 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +md5sum: SCRATCH_MNT/f1: No such file or directory > +Try to create more files > +Repair fs > +umount: SCRATCH_DEV: not mounted > +Try to create more files (again) > diff --git a/tests/xfs/886 b/tests/xfs/886 > new file mode 100755 > index 0000000..57edb3d > --- /dev/null > +++ b/tests/xfs/886 > @@ -0,0 +1,104 @@ > +#! /bin/bash > +# FS QA Test No. 886 > +# > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_recs + 1)) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > +len=$((blocks * rtblksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' $SCRATCH_DEV | \ > + sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g') > + > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c "write u3.rtrmapbt.ptrs[1] $fsbno" \ > + -c 'p' $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/886.out b/tests/xfs/886.out > new file mode 100644 > index 0000000..7f00c5d > --- /dev/null > +++ b/tests/xfs/886.out > @@ -0,0 +1,7 @@ > +QA output created by 886 > +Format and mount > +Create some files > +Corrupt fs > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/887 b/tests/xfs/887 > new file mode 100755 > index 0000000..cdf2707 > --- /dev/null > +++ b/tests/xfs/887 > @@ -0,0 +1,107 @@ > +#! /bin/bash > +# FS QA Test No. 887 > +# > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_recs + 1)) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > +len=$((blocks * rtblksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' $SCRATCH_DEV >> $seqres.full > + > +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' \ > + $SCRATCH_DEV | sed -e 's/^.*://g') > +$XFS_DB_PROG -x -c "inode $ino" -c "write u3.bmx[0].startblock $fsbno" \ > + $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/887.out b/tests/xfs/887.out > new file mode 100644 > index 0000000..30cf032 > --- /dev/null > +++ b/tests/xfs/887.out > @@ -0,0 +1,7 @@ > +QA output created by 887 > +Format and mount > +Create some files > +Corrupt fs > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/888 b/tests/xfs/888 > new file mode 100755 > index 0000000..15bec80 > --- /dev/null > +++ b/tests/xfs/888 > @@ -0,0 +1,76 @@ > +#! /bin/bash > +# FS QA Test No. 888 > +# > +# Basic rmap manipulation tests for realtime files. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz=65536 > +blocks=16 > +len=$((blocks * blksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Manipulate file" > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > + -c "fzero $((3 * blksz)) $blksz" \ > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > + -c "fpunch $((7 * blksz)) $blksz" \ > + -c "fsync" \ > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > + -c "fcollapse $((9 * blksz)) $blksz" \ > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Check file" > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/888.out b/tests/xfs/888.out > new file mode 100644 > index 0000000..2587697 > --- /dev/null > +++ b/tests/xfs/888.out > @@ -0,0 +1,6 @@ > +QA output created by 888 > +Format and mount > +Create some files > +Manipulate file > +Check file > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > diff --git a/tests/xfs/group b/tests/xfs/group > index f81f899..6fa2eb6 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -311,3 +311,14 @@ > 875 auto quick clone fsr quota > 876 auto quick rmap clone > 877 auto quick rmap clone > +878 auto quick rmap > +879 auto quick rmap > +880 auto quick rmap > +881 auto quick rmap > +882 fuzzers rmap > +883 auto quick rmap > +884 auto quick rmap > +885 auto quick rmap > +886 auto quick rmap > +887 auto quick rmap > +888 auto quick rmap >
On Thu, Jul 21, 2016 at 04:48:07PM -0700, Darrick J. Wong wrote: > Test the realtime rmap btree code by exercising various IO patterns > on realtime files. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > tests/xfs/878 | 88 +++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/878.out | 9 ++++ > tests/xfs/879 | 67 +++++++++++++++++++++++++++++++++ > tests/xfs/879.out | 7 +++ > tests/xfs/880 | 86 ++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/880.out | 7 +++ > tests/xfs/881 | 95 +++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/881.out | 8 ++++ > tests/xfs/882 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/882.out | 11 +++++ > tests/xfs/883 | 89 ++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/883.out | 10 +++++ > tests/xfs/884 | 91 +++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/884.out | 9 ++++ > tests/xfs/885 | 94 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/885.out | 10 +++++ > tests/xfs/886 | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/886.out | 7 +++ > tests/xfs/887 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/xfs/887.out | 7 +++ > tests/xfs/888 | 76 +++++++++++++++++++++++++++++++++++++ > tests/xfs/888.out | 6 +++ > tests/xfs/group | 11 +++++ > 23 files changed, 1107 insertions(+) > create mode 100644 tests/xfs/878 Need the mode of test file to be 755 > create mode 100644 tests/xfs/878.out > create mode 100755 tests/xfs/879 > create mode 100644 tests/xfs/879.out > create mode 100755 tests/xfs/880 > create mode 100644 tests/xfs/880.out > create mode 100755 tests/xfs/881 > create mode 100644 tests/xfs/881.out > create mode 100755 tests/xfs/882 > create mode 100644 tests/xfs/882.out > create mode 100755 tests/xfs/883 > create mode 100644 tests/xfs/883.out > create mode 100755 tests/xfs/884 > create mode 100644 tests/xfs/884.out > create mode 100755 tests/xfs/885 > create mode 100644 tests/xfs/885.out > create mode 100755 tests/xfs/886 > create mode 100644 tests/xfs/886.out > create mode 100755 tests/xfs/887 > create mode 100644 tests/xfs/887.out > create mode 100755 tests/xfs/888 > create mode 100644 tests/xfs/888.out > > > diff --git a/tests/xfs/878 b/tests/xfs/878 > new file mode 100644 > index 0000000..b1f2672 > --- /dev/null > +++ b/tests/xfs/878 > @@ -0,0 +1,88 @@ > +#! /bin/bash > +# FS QA Test No. 878 > +# > +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux _supported_fs xfs (also apply to all tests in this patch) > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +SCRATCH_RTDEV= USE_EXTERNAL= _scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +$XFS_DB_PROG -x -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch I think there's no need to filter unmount. > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/878.out b/tests/xfs/878.out > new file mode 100644 > index 0000000..e134506 > --- /dev/null > +++ b/tests/xfs/878.out > @@ -0,0 +1,9 @@ > +QA output created by 878 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/879 b/tests/xfs/879 > new file mode 100755 > index 0000000..0cbaf09 > --- /dev/null > +++ b/tests/xfs/879 > @@ -0,0 +1,67 @@ > +#! /bin/bash > +# FS QA Test No. 879 > +# > +# Ensure that we can create a few realtime files on a rmapbt filesystem. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr common/attr seems not needed in this test and other tests in this patch. > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create a few files" > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full > +_scratch_cycle_mount > + > +echo "Grab contents" > +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch > + > +echo "Remove one file" > +rm -rf $SCRATCH_MNT/f2 > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/879.out b/tests/xfs/879.out > new file mode 100644 > index 0000000..9dfe48b > --- /dev/null > +++ b/tests/xfs/879.out > @@ -0,0 +1,7 @@ > +QA output created by 879 > +Format and mount > +Create a few files > +Grab contents > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f1 > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f2 > +Remove one file > diff --git a/tests/xfs/880 b/tests/xfs/880 > new file mode 100755 > index 0000000..2056097 > --- /dev/null > +++ b/tests/xfs/880 > @@ -0,0 +1,86 @@ > +#! /bin/bash > +# FS QA Test No. 880 > +# > +# Exercise expanding and shrinking the realtime rmap btree. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +echo "Create a three-level rtrmapbt" > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_ptrs=$(( (blksz - 56) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') Both isize and rtextsz can be got from _filter_mkfs, as I mentioned in another email. Thanks, Eryu > +len=$((blocks * rtblksz)) > + > +echo "Create big file" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > + > +echo "Explode the rtrmapbt" > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +_scratch_cycle_mount > + > +echo "Remove half the records" > +rm -rf $SCRATCH_MNT/f1 > +_scratch_cycle_mount > + > +echo "Remove the rest of the records" > +rm -rf $SCRATCH_MNT/f2 > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/880.out b/tests/xfs/880.out > new file mode 100644 > index 0000000..b87665b > --- /dev/null > +++ b/tests/xfs/880.out > @@ -0,0 +1,7 @@ > +QA output created by 880 > +Format and mount > +Create a three-level rtrmapbt > +Create big file > +Explode the rtrmapbt > +Remove half the records > +Remove the rest of the records > diff --git a/tests/xfs/881 b/tests/xfs/881 > new file mode 100755 > index 0000000..c7474f5 > --- /dev/null > +++ b/tests/xfs/881 > @@ -0,0 +1,95 @@ > +#! /bin/bash > +# FS QA Test No. 881 > +# > +# Exercise metadump on realtime rmapbt preservation. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +metadump_file=$TEST_DIR/${seq}_metadump > +rm -rf $metadump_file > + > +echo "Create a three-level rtrmapbt" > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_ptrs=$(( (blksz - 56) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > +len=$((blocks * rtblksz)) > + > +echo "Create big file" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > + > +echo "Explode the rtrmapbt" > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +_scratch_cycle_mount > + > +echo "Create metadump file" > +_scratch_unmount > +_scratch_metadump $metadump_file > + > +# Now restore the obfuscated one back and take a look around > +echo "Restore metadump" > +xfs_mdrestore $metadump_file $TEST_DIR/image > +SCRATCH_DEV=$TEST_DIR/image _scratch_mount > +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount > + > +echo "Check restored fs" > +_check_generic_filesystem $metadump_file > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/881.out b/tests/xfs/881.out > new file mode 100644 > index 0000000..6ad156c > --- /dev/null > +++ b/tests/xfs/881.out > @@ -0,0 +1,8 @@ > +QA output created by 881 > +Format and mount > +Create a three-level rtrmapbt > +Create big file > +Explode the rtrmapbt > +Create metadump file > +Restore metadump > +Check restored fs > diff --git a/tests/xfs/882 b/tests/xfs/882 > new file mode 100755 > index 0000000..569a560 > --- /dev/null > +++ b/tests/xfs/882 > @@ -0,0 +1,108 @@ > +#! /bin/bash > +# FS QA Test No. 882 > +# > +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "+ create scratch fs" > +_scratch_mkfs > "$seqres.full" 2>&1 > + > +echo "+ mount fs image" > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_ptrs=$(( (blksz - 56) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1)) > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > +len=$((blocks * blksz)) > + > +echo "+ make some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +_scratch_unmount > + > +echo "+ check fs" > +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail" > + > +echo "+ corrupt image" > +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" -c "stack" \ > + -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" $SCRATCH_DEV >> $seqres.full 2>&1 > + > +echo "+ mount image" > +_scratch_mount > + > +echo "+ copy more" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1 > +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree" > +_scratch_unmount > + > +echo "+ repair fs" > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "+ mount image (2)" > +_scratch_mount > + > +echo "+ copy more (2)" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/882.out b/tests/xfs/882.out > new file mode 100644 > index 0000000..5ebe620 > --- /dev/null > +++ b/tests/xfs/882.out > @@ -0,0 +1,11 @@ > +QA output created by 882 > ++ create scratch fs > ++ mount fs image > ++ make some files > ++ check fs > ++ corrupt image > ++ mount image > ++ copy more > ++ repair fs > ++ mount image (2) > ++ copy more (2) > diff --git a/tests/xfs/883 b/tests/xfs/883 > new file mode 100755 > index 0000000..403ef35 > --- /dev/null > +++ b/tests/xfs/883 > @@ -0,0 +1,89 @@ > +#! /bin/bash > +# FS QA Test No. 883 > +# > +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +_scratch_unmount > + > +echo "Corrupt fs" > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c 'write core.nlinkv2 0' \ > + -c 'write core.mode 0' -c 'sb 0' -c 'write rrmapino 0' $SCRATCH_DEV >> $seqres.full > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/883.out b/tests/xfs/883.out > new file mode 100644 > index 0000000..6e75ac1 > --- /dev/null > +++ b/tests/xfs/883.out > @@ -0,0 +1,10 @@ > +QA output created by 883 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +md5sum: SCRATCH_MNT/f1: No such file or directory > +Try to create more files > +Repair fs > +umount: SCRATCH_DEV: not mounted > +Try to create more files (again) > diff --git a/tests/xfs/884 b/tests/xfs/884 > new file mode 100755 > index 0000000..ad648b8 > --- /dev/null > +++ b/tests/xfs/884 > @@ -0,0 +1,91 @@ > +#! /bin/bash > +# FS QA Test No. 884 > +# > +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +echo garbage > $SCRATCH_MNT/f3 > +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 > +_scratch_unmount > + > +echo "Corrupt fs" > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \ > + -c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/884.out b/tests/xfs/884.out > new file mode 100644 > index 0000000..17a73ef > --- /dev/null > +++ b/tests/xfs/884.out > @@ -0,0 +1,9 @@ > +QA output created by 884 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/885 b/tests/xfs/885 > new file mode 100755 > index 0000000..b5880bd > --- /dev/null > +++ b/tests/xfs/885 > @@ -0,0 +1,94 @@ > +#! /bin/bash > +# FS QA Test No. 885 > +# > +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > +$XFS_DB_PROG -x -c "inode $rrmapino" -c 'write core.format 2' \ > + -c 'write core.size 0' -c 'write core.nblocks 0' \ > + -c 'sb 0' -c 'addr rootino' -c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \ > + -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > + > +echo "Check files" > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/885.out b/tests/xfs/885.out > new file mode 100644 > index 0000000..df04f79 > --- /dev/null > +++ b/tests/xfs/885.out > @@ -0,0 +1,10 @@ > +QA output created by 885 > +Format and mount > +Create some files > +Corrupt fs > +Check files > +md5sum: SCRATCH_MNT/f1: No such file or directory > +Try to create more files > +Repair fs > +umount: SCRATCH_DEV: not mounted > +Try to create more files (again) > diff --git a/tests/xfs/886 b/tests/xfs/886 > new file mode 100755 > index 0000000..57edb3d > --- /dev/null > +++ b/tests/xfs/886 > @@ -0,0 +1,104 @@ > +#! /bin/bash > +# FS QA Test No. 886 > +# > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_recs + 1)) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > +len=$((blocks * rtblksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' $SCRATCH_DEV | \ > + sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g') > + > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c "write u3.rtrmapbt.ptrs[1] $fsbno" \ > + -c 'p' $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/886.out b/tests/xfs/886.out > new file mode 100644 > index 0000000..7f00c5d > --- /dev/null > +++ b/tests/xfs/886.out > @@ -0,0 +1,7 @@ > +QA output created by 886 > +Format and mount > +Create some files > +Corrupt fs > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/887 b/tests/xfs/887 > new file mode 100755 > index 0000000..cdf2707 > --- /dev/null > +++ b/tests/xfs/887 > @@ -0,0 +1,107 @@ > +#! /bin/bash > +# FS QA Test No. 887 > +# > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > +_require_test_program "punch-alternating" > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > + > +i_ptrs=$(( (isize - 176) / 56 )) > +bt_recs=$(( (blksz - 56) / 32 )) > + > +blocks=$((i_ptrs * bt_recs + 1)) > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > +len=$((blocks * rtblksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > +echo garbage > $SCRATCH_MNT/f3 > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > +_scratch_unmount > + > +echo "Corrupt fs" > +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' $SCRATCH_DEV >> $seqres.full > + > +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' \ > + $SCRATCH_DEV | sed -e 's/^.*://g') > +$XFS_DB_PROG -x -c "inode $ino" -c "write u3.bmx[0].startblock $fsbno" \ > + $SCRATCH_DEV >> $seqres.full > +_scratch_mount > + > +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full > + > +echo "Try to create more files" > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5" > + > +echo "Repair fs" > +_scratch_unmount 2>&1 | _filter_scratch > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > + | tee $tmp.logprint | grep -q "<CLEAN>" > +if [ $? -ne 0 ]; then > + echo "Dirty log, zeroing..." >> $seqres.full > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > +else > + _scratch_xfs_repair >> $seqres.full 2>&1 > +fi > +_scratch_xfs_repair >> $seqres.full 2>&1 > + > +echo "Try to create more files (again)" > +_scratch_mount > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/887.out b/tests/xfs/887.out > new file mode 100644 > index 0000000..30cf032 > --- /dev/null > +++ b/tests/xfs/887.out > @@ -0,0 +1,7 @@ > +QA output created by 887 > +Format and mount > +Create some files > +Corrupt fs > +Try to create more files > +Repair fs > +Try to create more files (again) > diff --git a/tests/xfs/888 b/tests/xfs/888 > new file mode 100755 > index 0000000..15bec80 > --- /dev/null > +++ b/tests/xfs/888 > @@ -0,0 +1,76 @@ > +#! /bin/bash > +# FS QA Test No. 888 > +# > +# Basic rmap manipulation tests for realtime files. > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > + > +here=`pwd` > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + cd / > + rm -rf "$tmp".* $metadump_file > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/attr > + > +# real QA test starts here > +_supported_os Linux > +_require_realtime > +_require_xfs_scratch_rmapbt > + > +rm -f "$seqres.full" > + > +echo "Format and mount" > +_scratch_mkfs > "$seqres.full" 2>&1 > +_scratch_mount > +blksz=65536 > +blocks=16 > +len=$((blocks * blksz)) > + > +echo "Create some files" > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Manipulate file" > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > + -c "fzero $((3 * blksz)) $blksz" \ > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > + -c "fpunch $((7 * blksz)) $blksz" \ > + -c "fsync" \ > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > + -c "fcollapse $((9 * blksz)) $blksz" \ > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > + > +echo "Check file" > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/888.out b/tests/xfs/888.out > new file mode 100644 > index 0000000..2587697 > --- /dev/null > +++ b/tests/xfs/888.out > @@ -0,0 +1,6 @@ > +QA output created by 888 > +Format and mount > +Create some files > +Manipulate file > +Check file > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > diff --git a/tests/xfs/group b/tests/xfs/group > index f81f899..6fa2eb6 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -311,3 +311,14 @@ > 875 auto quick clone fsr quota > 876 auto quick rmap clone > 877 auto quick rmap clone > +878 auto quick rmap > +879 auto quick rmap > +880 auto quick rmap > +881 auto quick rmap > +882 fuzzers rmap > +883 auto quick rmap > +884 auto quick rmap > +885 auto quick rmap > +886 auto quick rmap > +887 auto quick rmap > +888 auto quick rmap > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Mon, Aug 08, 2016 at 03:56:01PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:32PM -0700, Darrick J. Wong wrote: > > Test sharing blocks via reflink and dedupe between two different > > mountpoints of the same filesystem. This shouldn't work, since > > we don't allow cross-mountpoint functions. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > > + > > +# real QA test starts here > > +_supported_os Linux > > I added "_supported_fs generic" > > > +_require_scratch_reflink > > +_require_cp_reflink > > > + > > +filter_md5() { > > and move "{" to a new line. Also made the same changes to 928 and queued > the patch up. Ok, thx. :) --D > > Thanks, > Eryu
On Mon, Aug 08, 2016 at 03:56:01PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:32PM -0700, Darrick J. Wong wrote: > > Test sharing blocks via reflink and dedupe between two different > > mountpoints of the same filesystem. This shouldn't work, since > > we don't allow cross-mountpoint functions. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > > + > > +# real QA test starts here > > +_supported_os Linux > > I added "_supported_fs generic" > > > +_require_scratch_reflink > > +_require_cp_reflink > > > + > > +filter_md5() { > > and move "{" to a new line. Also made the same changes to 928 and queued > the patch up. Ok, thx. :) --D > > Thanks, > Eryu _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Mon, Aug 08, 2016 at 04:13:59PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote: > > Add a few tests to stress the new swapext code for reflink and rmap. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/873 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/873.out | 6 +++ > > tests/xfs/874 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/874.out | 10 +++++ > > tests/xfs/875 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/875.out | 12 ++++++ > > tests/xfs/group | 3 + > > 7 files changed, 337 insertions(+) > > create mode 100755 tests/xfs/873 > > create mode 100644 tests/xfs/873.out > > create mode 100755 tests/xfs/874 > > create mode 100644 tests/xfs/874.out > > create mode 100755 tests/xfs/875 > > create mode 100644 tests/xfs/875.out > > > > > > diff --git a/tests/xfs/873 b/tests/xfs/873 > > new file mode 100755 > > index 0000000..a980148 > > --- /dev/null > > +++ b/tests/xfs/873 > > @@ -0,0 +1,107 @@ > > +#! /bin/bash > > +# FS QA Test No. 873 > > +# > > +# See how well xfs_fsr handles "defragging" a file with a hojillion extents. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > +. ./common/reflink > > + > > +# real QA test starts here > > +_supported_os Linux > > _supported_fs xfs (next two tests need this as well) > > > +_require_scratch_reflink > > +_require_cp_reflink > > +_require_test_program "punch-alternating" > > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > > This can be replaced by (applies to next two tests): > > _require_command "$XFS_FSR_PROG" "xfs_fsr" Ok, will fix both of these. > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount >> "$seqres.full" 2>&1 > > + > > +testdir="$SCRATCH_MNT/test-$seq" > > +mkdir "$testdir" > > + > > +# Setup for 16000 blocks, but we'll accept stress testing down to > > +# 2^10 blocks... that should be plenty for anyone. > > +fnr=$((12 + LOAD_FACTOR)) > > +free_blocks=$(stat -f -c '%a' "$testdir") > > +blksz=$(stat -f -c '%S' "$testdir") > > +space_avail=$((free_blocks * blksz)) > > +calc_space() { > > + blocks_needed=$(( 2 ** (fnr + 1) )) > > + space_needed=$((blocks_needed * blksz * 5 / 4)) > > +} > > +calc_space > > +while test $space_needed -gt $space_avail; do > > + fnr=$((fnr - 1)) > > + calc_space > > +done > > +test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents." > > +bytes=$((blocks_needed * blksz)) > > + > > +echo "Create a many-block file" > > +echo "creating $blocks_needed blocks..." >> "$seqres.full" > > +_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full > > +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full" > > +echo "punching..." >> "$seqres.full" > > +"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full" > > +seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do > > + _reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full > > +done > > +echo "...done" >> "$seqres.full" > > +_scratch_cycle_mount > > + > > +echo "Reflink the big file" > > +echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full" > > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" > > + > > +echo "Defrag the big file" > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > There's a "_count_extents" helper, does that work for this case? It can, though stat -v reports GETFSXATTR results, which should be faster than _count_extents because the latter FIEMAPs the entire file and counts lines. Seeing as XFS records the extent count in the inode, we might as well use it. > > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > + > > +echo "Check extent count" > > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > > + > > +# success, all done > > +status=0 > > +exit > > And 873 fails the post-test fs check on "-m reflink=1,rmapbt=1" XFS, > test passed if rmapbt=0, just FYI (tested with your djwong-experimental > branch kernel and xfsprogs). Yes, this should be fixed in the -wtf branches. Sorry about that, I should have yelled a little louder about that. The -wtf branch is kind of a mess, but it does have all the latest fixes and the AGF btree block counters that will go into 4.8-rc2. > _check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent > *** xfs_repair -n output *** > Phase 1 - find and verify superblock... > Phase 2 - using internal log > - zero log... > - scan filesystem freespace and inode maps... > sb_fdblocks 3903040, counted 3903229 > - found root inode chunk > Phase 3 - for each AG... > - scan (but don't clear) agi unlinked lists... > - process known inodes and perform inode discovery... > - agno = 0 > - agno = 1 > - agno = 2 > - agno = 3 > - process newly discovered inodes... > Phase 4 - check for duplicate blocks... > - setting up duplicate extent list... > - check for inodes claiming duplicate blocks... > - agno = 0 > - agno = 1 > - agno = 2 > - agno = 3 > No modify flag set, skipping phase 5 > Phase 6 - check inode connectivity... > - traversing filesystem ... > - traversal finished ... > - moving disconnected inodes to lost+found ... > Phase 7 - verify link counts... > No modify flag set, skipping filesystem flush and exiting. > *** end xfs_repair output > > > diff --git a/tests/xfs/873.out b/tests/xfs/873.out > > new file mode 100644 > > index 0000000..9dddf55 > > --- /dev/null > > +++ b/tests/xfs/873.out > > @@ -0,0 +1,6 @@ > > +QA output created by 873 > > +Format and mount > > +Create a many-block file > > +Reflink the big file > > +Defrag the big file > > +Check extent count > > diff --git a/tests/xfs/874 b/tests/xfs/874 > > new file mode 100755 > > index 0000000..fb31ea8 > > --- /dev/null > > +++ b/tests/xfs/874 > > @@ -0,0 +1,99 @@ > > +#! /bin/bash > > +# FS QA Test No. 874 > > +# > > +# Ensure that xfs_fsr handles errors correctly while defragging files. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > +. ./common/reflink > > +. ./common/quota > > Seems this is not needed in this test. > > > +. ./common/inject > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_scratch_reflink > > +_require_cp_reflink > > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > > +_require_xfs_io_error_injection "bmap_finish_one" > > +_require_xfs_scratch_rmapbt > > + > > +_repquota() { > > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > > +} > > Not used & needed. Will remove both. > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount >> "$seqres.full" 2>&1 > > + > > +testdir="$SCRATCH_MNT/test-$seq" > > +blksz=65536 > > +blks=3 > > +mkdir "$testdir" > > + > > +echo "Create a many-block file" > > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > > +_scratch_cycle_mount > > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > > + > > +echo "Inject error" > > +_scratch_inject_error "bmap_finish_one" > > + > > +echo "Defrag the file" > > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1 > > + > > +echo "FS should be shut down, touch will fail" > > +touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch > > + > > +echo "Remount to replay log" | tee /dev/ttyprintk > > +_scratch_inject_logprint >> $seqres.full > > + > > +echo "Check extent count" | tee /dev/ttyprintk > > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > > + > > +echo "FS should be online, touch should succeed" > > +touch $SCRATCH_MNT/goodfs > > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/874.out b/tests/xfs/874.out > > new file mode 100644 > > index 0000000..dbc0f49 > > --- /dev/null > > +++ b/tests/xfs/874.out > > @@ -0,0 +1,10 @@ > > +QA output created by 874 > > +Format and mount > > +Create a many-block file > > +Inject error > > +Defrag the file > > +FS should be shut down, touch will fail > > +touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error > > +Remount to replay log > > +Check extent count > > +FS should be online, touch should succeed > > diff --git a/tests/xfs/875 b/tests/xfs/875 > > new file mode 100755 > > index 0000000..17c28db > > --- /dev/null > > +++ b/tests/xfs/875 > > @@ -0,0 +1,100 @@ > > +#! /bin/bash > > +# FS QA Test No. 875 > > +# > > +# Ensure that xfs_fsr handles quota correctly while defragging files. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > +. ./common/reflink > > +. ./common/quota > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_scratch_reflink > > +_require_cp_reflink > > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > > +_require_quota > > +_require_nobody > > + > > +_repquota() { > > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > > +} > > Helpers starting with "_" are usually from common code, I'd rename it to > something like "do_repquota" and put the open brace to a new line. Ok. > Thanks, > Eryu > > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" > > +_scratch_mount >> "$seqres.full" 2>&1 > > +quotacheck -u -g $SCRATCH_MNT 2> /dev/null > > +quotaon $SCRATCH_MNT 2> /dev/null > > + > > +testdir="$SCRATCH_MNT/test-$seq" > > +blksz=65536 > > +blks=3 > > +mkdir "$testdir" > > + > > +echo "Create a many-block file" > > +touch $testdir/file1 > > +chown nobody $testdir/file1 > > +touch $testdir/file2 > > +chown nobody $testdir/file2 > > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > > +_repquota > > +_scratch_cycle_mount > > + > > +echo "Defrag the file" > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > +_repquota > > + > > +echo "Remount the FS to see if accounting changes" > > +_scratch_cycle_mount > > +_repquota > > + > > +echo "Check extent count" > > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/875.out b/tests/xfs/875.out > > new file mode 100644 > > index 0000000..57653e9 > > --- /dev/null > > +++ b/tests/xfs/875.out > > @@ -0,0 +1,12 @@ > > +QA output created by 875 > > +Format and mount > > +Create a many-block file > > +root -- 0 0 0 4 0 0 > > +nobody -- 256 0 0 2 0 0 > > +Defrag the file > > +root -- 0 0 0 4 0 0 > > +nobody -- 256 0 0 2 0 0 > > +Remount the FS to see if accounting changes > > +root -- 0 0 0 4 0 0 > > +nobody -- 256 0 0 2 0 0 > > +Check extent count > > diff --git a/tests/xfs/group b/tests/xfs/group > > index 5ccf3d6..16f7947 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -306,3 +306,6 @@ > > 325 auto quick clone > > 326 auto quick clone > > 327 auto quick clone > > +873 auto quick clone fsr > > +874 auto quick clone fsr > > +875 auto quick clone fsr quota > >
On Mon, Aug 08, 2016 at 04:13:59PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote: > > Add a few tests to stress the new swapext code for reflink and rmap. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/873 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/873.out | 6 +++ > > tests/xfs/874 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/874.out | 10 +++++ > > tests/xfs/875 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/875.out | 12 ++++++ > > tests/xfs/group | 3 + > > 7 files changed, 337 insertions(+) > > create mode 100755 tests/xfs/873 > > create mode 100644 tests/xfs/873.out > > create mode 100755 tests/xfs/874 > > create mode 100644 tests/xfs/874.out > > create mode 100755 tests/xfs/875 > > create mode 100644 tests/xfs/875.out > > > > > > diff --git a/tests/xfs/873 b/tests/xfs/873 > > new file mode 100755 > > index 0000000..a980148 > > --- /dev/null > > +++ b/tests/xfs/873 > > @@ -0,0 +1,107 @@ > > +#! /bin/bash > > +# FS QA Test No. 873 > > +# > > +# See how well xfs_fsr handles "defragging" a file with a hojillion extents. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > +. ./common/reflink > > + > > +# real QA test starts here > > +_supported_os Linux > > _supported_fs xfs (next two tests need this as well) > > > +_require_scratch_reflink > > +_require_cp_reflink > > +_require_test_program "punch-alternating" > > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > > This can be replaced by (applies to next two tests): > > _require_command "$XFS_FSR_PROG" "xfs_fsr" Ok, will fix both of these. > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount >> "$seqres.full" 2>&1 > > + > > +testdir="$SCRATCH_MNT/test-$seq" > > +mkdir "$testdir" > > + > > +# Setup for 16000 blocks, but we'll accept stress testing down to > > +# 2^10 blocks... that should be plenty for anyone. > > +fnr=$((12 + LOAD_FACTOR)) > > +free_blocks=$(stat -f -c '%a' "$testdir") > > +blksz=$(stat -f -c '%S' "$testdir") > > +space_avail=$((free_blocks * blksz)) > > +calc_space() { > > + blocks_needed=$(( 2 ** (fnr + 1) )) > > + space_needed=$((blocks_needed * blksz * 5 / 4)) > > +} > > +calc_space > > +while test $space_needed -gt $space_avail; do > > + fnr=$((fnr - 1)) > > + calc_space > > +done > > +test $fnr -lt 10 && _notrun "Insufficient space for stress test; would only create $blocks_needed extents." > > +bytes=$((blocks_needed * blksz)) > > + > > +echo "Create a many-block file" > > +echo "creating $blocks_needed blocks..." >> "$seqres.full" > > +_pwrite_byte 0x62 0 $blksz $testdir/file0 >> $seqres.full > > +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 -b 4194304 0 $bytes" "$testdir/file1" >> "$seqres.full" > > +echo "punching..." >> "$seqres.full" > > +"$here/src/punch-alternating" "$testdir/file1" >> "$seqres.full" > > +seq 0 2 $((2 ** (fnr + 1) )) | while read lblk; do > > + _reflink_range $testdir/file0 0 $testdir/file1 $((lblk * blksz)) $blksz >> $seqres.full > > +done > > +echo "...done" >> "$seqres.full" > > +_scratch_cycle_mount > > + > > +echo "Reflink the big file" > > +echo "reflinking $((blocks_needed / 2)) blocks, $((bytes / 2)) bytes" >> "$seqres.full" > > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" > > + > > +echo "Defrag the big file" > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > There's a "_count_extents" helper, does that work for this case? It can, though stat -v reports GETFSXATTR results, which should be faster than _count_extents because the latter FIEMAPs the entire file and counts lines. Seeing as XFS records the extent count in the inode, we might as well use it. > > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > + > > +echo "Check extent count" > > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > > + > > +# success, all done > > +status=0 > > +exit > > And 873 fails the post-test fs check on "-m reflink=1,rmapbt=1" XFS, > test passed if rmapbt=0, just FYI (tested with your djwong-experimental > branch kernel and xfsprogs). Yes, this should be fixed in the -wtf branches. Sorry about that, I should have yelled a little louder about that. The -wtf branch is kind of a mess, but it does have all the latest fixes and the AGF btree block counters that will go into 4.8-rc2. > _check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent > *** xfs_repair -n output *** > Phase 1 - find and verify superblock... > Phase 2 - using internal log > - zero log... > - scan filesystem freespace and inode maps... > sb_fdblocks 3903040, counted 3903229 > - found root inode chunk > Phase 3 - for each AG... > - scan (but don't clear) agi unlinked lists... > - process known inodes and perform inode discovery... > - agno = 0 > - agno = 1 > - agno = 2 > - agno = 3 > - process newly discovered inodes... > Phase 4 - check for duplicate blocks... > - setting up duplicate extent list... > - check for inodes claiming duplicate blocks... > - agno = 0 > - agno = 1 > - agno = 2 > - agno = 3 > No modify flag set, skipping phase 5 > Phase 6 - check inode connectivity... > - traversing filesystem ... > - traversal finished ... > - moving disconnected inodes to lost+found ... > Phase 7 - verify link counts... > No modify flag set, skipping filesystem flush and exiting. > *** end xfs_repair output > > > diff --git a/tests/xfs/873.out b/tests/xfs/873.out > > new file mode 100644 > > index 0000000..9dddf55 > > --- /dev/null > > +++ b/tests/xfs/873.out > > @@ -0,0 +1,6 @@ > > +QA output created by 873 > > +Format and mount > > +Create a many-block file > > +Reflink the big file > > +Defrag the big file > > +Check extent count > > diff --git a/tests/xfs/874 b/tests/xfs/874 > > new file mode 100755 > > index 0000000..fb31ea8 > > --- /dev/null > > +++ b/tests/xfs/874 > > @@ -0,0 +1,99 @@ > > +#! /bin/bash > > +# FS QA Test No. 874 > > +# > > +# Ensure that xfs_fsr handles errors correctly while defragging files. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > +. ./common/reflink > > +. ./common/quota > > Seems this is not needed in this test. > > > +. ./common/inject > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_scratch_reflink > > +_require_cp_reflink > > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > > +_require_xfs_io_error_injection "bmap_finish_one" > > +_require_xfs_scratch_rmapbt > > + > > +_repquota() { > > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > > +} > > Not used & needed. Will remove both. > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount >> "$seqres.full" 2>&1 > > + > > +testdir="$SCRATCH_MNT/test-$seq" > > +blksz=65536 > > +blks=3 > > +mkdir "$testdir" > > + > > +echo "Create a many-block file" > > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > > +_scratch_cycle_mount > > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > > + > > +echo "Inject error" > > +_scratch_inject_error "bmap_finish_one" > > + > > +echo "Defrag the file" > > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full 2>&1 > > + > > +echo "FS should be shut down, touch will fail" > > +touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch > > + > > +echo "Remount to replay log" | tee /dev/ttyprintk > > +_scratch_inject_logprint >> $seqres.full > > + > > +echo "Check extent count" | tee /dev/ttyprintk > > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > > + > > +echo "FS should be online, touch should succeed" > > +touch $SCRATCH_MNT/goodfs > > +$XFS_IO_PROG -c 'bmap -v' $testdir/file1 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/874.out b/tests/xfs/874.out > > new file mode 100644 > > index 0000000..dbc0f49 > > --- /dev/null > > +++ b/tests/xfs/874.out > > @@ -0,0 +1,10 @@ > > +QA output created by 874 > > +Format and mount > > +Create a many-block file > > +Inject error > > +Defrag the file > > +FS should be shut down, touch will fail > > +touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error > > +Remount to replay log > > +Check extent count > > +FS should be online, touch should succeed > > diff --git a/tests/xfs/875 b/tests/xfs/875 > > new file mode 100755 > > index 0000000..17c28db > > --- /dev/null > > +++ b/tests/xfs/875 > > @@ -0,0 +1,100 @@ > > +#! /bin/bash > > +# FS QA Test No. 875 > > +# > > +# Ensure that xfs_fsr handles quota correctly while defragging files. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > +. ./common/reflink > > +. ./common/quota > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_scratch_reflink > > +_require_cp_reflink > > +test -x $XFS_FSR_PROG || _notrun "xfs_fsr not found" > > +_require_quota > > +_require_nobody > > + > > +_repquota() { > > + repquota $SCRATCH_MNT | egrep '^(fsgqa|root|nobody)' > > +} > > Helpers starting with "_" are usually from common code, I'd rename it to > something like "do_repquota" and put the open brace to a new line. Ok. > Thanks, > Eryu > > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" > > +_scratch_mount >> "$seqres.full" 2>&1 > > +quotacheck -u -g $SCRATCH_MNT 2> /dev/null > > +quotaon $SCRATCH_MNT 2> /dev/null > > + > > +testdir="$SCRATCH_MNT/test-$seq" > > +blksz=65536 > > +blks=3 > > +mkdir "$testdir" > > + > > +echo "Create a many-block file" > > +touch $testdir/file1 > > +chown nobody $testdir/file1 > > +touch $testdir/file2 > > +chown nobody $testdir/file2 > > +_pwrite_byte 0x62 0 $((blksz * blks)) $testdir/file1 >> $seqres.full > > +_pwrite_byte 0x63 0 $blksz $testdir/file2 >> $seqres.full > > +_reflink_range $testdir/file2 0 $testdir/file1 $blksz $blksz >> $seqres.full > > +_repquota > > +_scratch_cycle_mount > > + > > +echo "Defrag the file" > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > +$XFS_FSR_PROG -v -d $testdir/file1 >> $seqres.full > > +new_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > +_repquota > > + > > +echo "Remount the FS to see if accounting changes" > > +_scratch_cycle_mount > > +_repquota > > + > > +echo "Check extent count" > > +$XFS_IO_PROG -c 'stat -v' $testdir/file1 >> $seqres.full > > +$XFS_IO_PROG -c 'stat -v' $testdir/file2 >> $seqres.full > > +echo "extents: $old_nextents -> $new_nextents" >> $seqres.full > > +test $old_nextents -gt $new_nextents || echo "FAIL: $old_nextents -> $new_nextents" > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/875.out b/tests/xfs/875.out > > new file mode 100644 > > index 0000000..57653e9 > > --- /dev/null > > +++ b/tests/xfs/875.out > > @@ -0,0 +1,12 @@ > > +QA output created by 875 > > +Format and mount > > +Create a many-block file > > +root -- 0 0 0 4 0 0 > > +nobody -- 256 0 0 2 0 0 > > +Defrag the file > > +root -- 0 0 0 4 0 0 > > +nobody -- 256 0 0 2 0 0 > > +Remount the FS to see if accounting changes > > +root -- 0 0 0 4 0 0 > > +nobody -- 256 0 0 2 0 0 > > +Check extent count > > diff --git a/tests/xfs/group b/tests/xfs/group > > index 5ccf3d6..16f7947 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -306,3 +306,6 @@ > > 325 auto quick clone > > 326 auto quick clone > > 327 auto quick clone > > +873 auto quick clone fsr > > +874 auto quick clone fsr > > +875 auto quick clone fsr quota > > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Mon, Aug 08, 2016 at 04:48:14PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:45PM -0700, Darrick J. Wong wrote: > > More tests for the reverse mapping functionality. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/876 | 76 +++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/876.out | 4 ++ > > tests/xfs/877 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/877.out | 10 ++++++ > > tests/xfs/group | 4 ++ > > 5 files changed, 178 insertions(+), 1 deletion(-) > > create mode 100755 tests/xfs/876 > > create mode 100644 tests/xfs/876.out > > create mode 100755 tests/xfs/877 > > create mode 100644 tests/xfs/877.out > > > > > > diff --git a/tests/xfs/876 b/tests/xfs/876 > > new file mode 100755 > > index 0000000..cf73d40 > > --- /dev/null > > +++ b/tests/xfs/876 > > @@ -0,0 +1,76 @@ > > +#! /bin/bash > > +# FS QA Test No. 876 > > +# > > +# Create a big enough rmapbt that we tickle a fdblocks accounting bug. > > This test failed post-test fs check as well > > "sb_fdblocks 3912360, counted 3912522" > > Seems like it's a known bug? (Yes, it should be fixed in the -wtf branch, as noted in a previous reply.) > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > Seems this is not needed. > > > +. ./common/reflink > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_scratch > > +_require_xfs_scratch_rmapbt > > +_require_scratch_reflink > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "+ create scratch fs" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > + > > +echo "+ mount fs image" > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > We usually get isize from the output of _filter_mkfs, e.g. > > _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null > . $tmp.mkfs > > Then all mkfs info is set accordingly, including $isize > > But in this test, isize is got but not used. Remove the line? Ok. > > + > > +bt_ptrs=$(( (blksz - 56) / 44 )) > > +bt_recs=$(( (blksz - 56) / 24 )) > > + > > +blocks=$((bt_ptrs * bt_recs + 1)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +len=$((blocks * blksz)) > > + > > +echo "+ make some files" > > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/876.out b/tests/xfs/876.out > > new file mode 100644 > > index 0000000..96c1970 > > --- /dev/null > > +++ b/tests/xfs/876.out > > @@ -0,0 +1,4 @@ > > +QA output created by 876 > > ++ create scratch fs > > ++ mount fs image > > ++ make some files > > diff --git a/tests/xfs/877 b/tests/xfs/877 > > new file mode 100755 > > index 0000000..9700263 > > --- /dev/null > > +++ b/tests/xfs/877 > > @@ -0,0 +1,85 @@ > > +#! /bin/bash > > +# FS QA Test No. 877 > > +# > > +# Make sure query_range returns -EINVAL if lowkey > highkey. > > This test failed too, is this expected (again, tested with your > djwong-experimental branck kernel and xfsprogs)? > > [root@dhcp-66-86-11 xfstests]# diff -u tests/xfs/877.out /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad > --- tests/xfs/877.out 2016-08-08 16:22:35.151000000 +0800 > +++ /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad 2016-08-08 16:23:12.405000000 +0800 > @@ -7,4 +7,3 @@ > Unmount > Try a regular fsmap > Try a bad fsmap > -Error 22 while querying fsmap btree. During the code review of the XFS function that underlies GETFSMAP (query_range), someone suggested that it should return -EINVAL if someone queries start > end rather than simply returning no results, so this is the xfstest to ensure that happens. (It's in the -wtf branch.) > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > Seems this is not needed. > > > + > > +# real QA test starts here > > +_supported_os Linux > > _supported_fs xfs > > > +_require_xfs_scratch_rmapbt > > _require_xfs_io_command commands used in this test? e.g. falloc, fpunch, fcollapse and finsert Ok. > And '_require_command "$XFS_DB_PROG" "xfs_db"' I'm assuming this is a new requirement to declare explicitly that we're going to use xfs_db? All of the existing tests/xfs/ tests assume that XFS_DB_PROG is always set. > > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz=65536 > > +blocks=16 > > +len=$((blocks * blksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Manipulate file" > > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > > + -c "fzero $((3 * blksz)) $blksz" \ > > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > > + -c "fpunch $((7 * blksz)) $blksz" \ > > + -c "fsync" \ > > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > > + -c "fcollapse $((9 * blksz)) $blksz" \ > > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Check file" > > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Unmount" > > +_scratch_unmount > > + > > +echo "Try a regular fsmap" > > +$XFS_DB_PROG -c 'fsmap' $SCRATCH_DEV >> $seqres.full > > +$XFS_DB_PROG -c 'fsmap 0 5' $SCRATCH_DEV >> $seqres.full > > + > > +echo "Try a bad fsmap" > > +$XFS_DB_PROG -c 'fsmap 5 4' $SCRATCH_DEV > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/877.out b/tests/xfs/877.out > > new file mode 100644 > > index 0000000..4a2242f > > --- /dev/null > > +++ b/tests/xfs/877.out > > @@ -0,0 +1,10 @@ > > +QA output created by 877 > > +Format and mount > > +Create some files > > +Manipulate file > > +Check file > > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > > +Unmount > > +Try a regular fsmap > > +Try a bad fsmap > > +Error 22 while querying fsmap btree. > > diff --git a/tests/xfs/group b/tests/xfs/group > > index 16f7947..f81f899 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -3,8 +3,8 @@ > > 003 db auto quick > > 004 db auto quick > > 005 auto quick > > -007 auto quota quick > > 006 auto quick mount > > +007 auto quota quick > > This is already fixed in upstream, not needed. Ok. It'll probably fix itself when I rebase. --D > > Thanks, > Eryu > > > 008 rw ioctl auto quick > > 009 rw ioctl auto prealloc quick > > 010 auto quick repair > > @@ -309,3 +309,5 @@ > > 873 auto quick clone fsr > > 874 auto quick clone fsr > > 875 auto quick clone fsr quota > > +876 auto quick rmap clone > > +877 auto quick rmap clone > >
On Mon, Aug 08, 2016 at 04:48:14PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:45PM -0700, Darrick J. Wong wrote: > > More tests for the reverse mapping functionality. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/876 | 76 +++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/876.out | 4 ++ > > tests/xfs/877 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/877.out | 10 ++++++ > > tests/xfs/group | 4 ++ > > 5 files changed, 178 insertions(+), 1 deletion(-) > > create mode 100755 tests/xfs/876 > > create mode 100644 tests/xfs/876.out > > create mode 100755 tests/xfs/877 > > create mode 100644 tests/xfs/877.out > > > > > > diff --git a/tests/xfs/876 b/tests/xfs/876 > > new file mode 100755 > > index 0000000..cf73d40 > > --- /dev/null > > +++ b/tests/xfs/876 > > @@ -0,0 +1,76 @@ > > +#! /bin/bash > > +# FS QA Test No. 876 > > +# > > +# Create a big enough rmapbt that we tickle a fdblocks accounting bug. > > This test failed post-test fs check as well > > "sb_fdblocks 3912360, counted 3912522" > > Seems like it's a known bug? (Yes, it should be fixed in the -wtf branch, as noted in a previous reply.) > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > Seems this is not needed. > > > +. ./common/reflink > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_scratch > > +_require_xfs_scratch_rmapbt > > +_require_scratch_reflink > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "+ create scratch fs" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > + > > +echo "+ mount fs image" > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > We usually get isize from the output of _filter_mkfs, e.g. > > _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null > . $tmp.mkfs > > Then all mkfs info is set accordingly, including $isize > > But in this test, isize is got but not used. Remove the line? Ok. > > + > > +bt_ptrs=$(( (blksz - 56) / 44 )) > > +bt_recs=$(( (blksz - 56) / 24 )) > > + > > +blocks=$((bt_ptrs * bt_recs + 1)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +len=$((blocks * blksz)) > > + > > +echo "+ make some files" > > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/876.out b/tests/xfs/876.out > > new file mode 100644 > > index 0000000..96c1970 > > --- /dev/null > > +++ b/tests/xfs/876.out > > @@ -0,0 +1,4 @@ > > +QA output created by 876 > > ++ create scratch fs > > ++ mount fs image > > ++ make some files > > diff --git a/tests/xfs/877 b/tests/xfs/877 > > new file mode 100755 > > index 0000000..9700263 > > --- /dev/null > > +++ b/tests/xfs/877 > > @@ -0,0 +1,85 @@ > > +#! /bin/bash > > +# FS QA Test No. 877 > > +# > > +# Make sure query_range returns -EINVAL if lowkey > highkey. > > This test failed too, is this expected (again, tested with your > djwong-experimental branck kernel and xfsprogs)? > > [root@dhcp-66-86-11 xfstests]# diff -u tests/xfs/877.out /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad > --- tests/xfs/877.out 2016-08-08 16:22:35.151000000 +0800 > +++ /root/workspace/xfstests/results//xfs_reflink/xfs/877.out.bad 2016-08-08 16:23:12.405000000 +0800 > @@ -7,4 +7,3 @@ > Unmount > Try a regular fsmap > Try a bad fsmap > -Error 22 while querying fsmap btree. During the code review of the XFS function that underlies GETFSMAP (query_range), someone suggested that it should return -EINVAL if someone queries start > end rather than simply returning no results, so this is the xfstest to ensure that happens. (It's in the -wtf branch.) > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > Seems this is not needed. > > > + > > +# real QA test starts here > > +_supported_os Linux > > _supported_fs xfs > > > +_require_xfs_scratch_rmapbt > > _require_xfs_io_command commands used in this test? e.g. falloc, fpunch, fcollapse and finsert Ok. > And '_require_command "$XFS_DB_PROG" "xfs_db"' I'm assuming this is a new requirement to declare explicitly that we're going to use xfs_db? All of the existing tests/xfs/ tests assume that XFS_DB_PROG is always set. > > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz=65536 > > +blocks=16 > > +len=$((blocks * blksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Manipulate file" > > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > > + -c "fzero $((3 * blksz)) $blksz" \ > > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > > + -c "fpunch $((7 * blksz)) $blksz" \ > > + -c "fsync" \ > > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > > + -c "fcollapse $((9 * blksz)) $blksz" \ > > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Check file" > > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Unmount" > > +_scratch_unmount > > + > > +echo "Try a regular fsmap" > > +$XFS_DB_PROG -c 'fsmap' $SCRATCH_DEV >> $seqres.full > > +$XFS_DB_PROG -c 'fsmap 0 5' $SCRATCH_DEV >> $seqres.full > > + > > +echo "Try a bad fsmap" > > +$XFS_DB_PROG -c 'fsmap 5 4' $SCRATCH_DEV > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/877.out b/tests/xfs/877.out > > new file mode 100644 > > index 0000000..4a2242f > > --- /dev/null > > +++ b/tests/xfs/877.out > > @@ -0,0 +1,10 @@ > > +QA output created by 877 > > +Format and mount > > +Create some files > > +Manipulate file > > +Check file > > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > > +Unmount > > +Try a regular fsmap > > +Try a bad fsmap > > +Error 22 while querying fsmap btree. > > diff --git a/tests/xfs/group b/tests/xfs/group > > index 16f7947..f81f899 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -3,8 +3,8 @@ > > 003 db auto quick > > 004 db auto quick > > 005 auto quick > > -007 auto quota quick > > 006 auto quick mount > > +007 auto quota quick > > This is already fixed in upstream, not needed. Ok. It'll probably fix itself when I rebase. --D > > Thanks, > Eryu > > > 008 rw ioctl auto quick > > 009 rw ioctl auto prealloc quick > > 010 auto quick repair > > @@ -309,3 +309,5 @@ > > 873 auto quick clone fsr > > 874 auto quick clone fsr > > 875 auto quick clone fsr quota > > +876 auto quick rmap clone > > +877 auto quick rmap clone > > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Mon, Aug 08, 2016 at 04:52:39PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:51PM -0700, Darrick J. Wong wrote: > > Teach _check_xfs_filesystem to scrub mounted filesystems before > > unmounting and fscking them. This is mostly to test the online > > scrub tool... > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > README | 3 +++ > > common/config | 1 + > > common/rc | 7 +++++++ > > 3 files changed, 11 insertions(+) > > > > > > diff --git a/README b/README > > index 4509cc1..c19fcb1 100644 > > --- a/README > > +++ b/README > > @@ -84,6 +84,9 @@ Preparing system for tests (IRIX and Linux): > > run xfs_repair -n to check the filesystem; xfs_repair to rebuild > > metadata indexes; and xfs_repair -n (a third time) to check the > > results of the rebuilding. > > + - set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run > > + xfs_scrub -vd to scrub the filesystem metadata online before > > + unmounting to run the offline check. > > Mixed space and tab in above lines, I can fix it at commit time. Ok. Sorry about that, --D > > Thanks, > Eryu > > > > > - or add a case to the switch in common/config assigning > > these variables based on the hostname of your test > > diff --git a/common/config b/common/config > > index 08d5d80..168f46c 100644 > > --- a/common/config > > +++ b/common/config > > @@ -163,6 +163,7 @@ export XFS_REPAIR_PROG="`set_prog_path xfs_repair`" > > export XFS_DB_PROG="`set_prog_path xfs_db`" > > export XFS_GROWFS_PROG=`set_prog_path xfs_growfs` > > export XFS_IO_PROG="`set_prog_path xfs_io`" > > +export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`" > > export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`" > > export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`" > > export __XFSDUMP_PROG="`set_prog_path xfsdump`" > > diff --git a/common/rc b/common/rc > > index 3b45578..861a721 100644 > > --- a/common/rc > > +++ b/common/rc > > @@ -2391,6 +2391,13 @@ _check_xfs_filesystem() > > > > if [ "$type" = "xfs" ] > > then > > + if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then > > + "$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full > > + if [ $? -ne 0 ]; then > > + echo "filesystem on $device failed scrub (see $seqres.full)" > > + ok=0 > > + fi > > + fi > > # mounted ... > > mountpoint=`_umount_or_remount_ro $device` > > fi > >
On Mon, Aug 08, 2016 at 04:52:39PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:47:51PM -0700, Darrick J. Wong wrote: > > Teach _check_xfs_filesystem to scrub mounted filesystems before > > unmounting and fscking them. This is mostly to test the online > > scrub tool... > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > README | 3 +++ > > common/config | 1 + > > common/rc | 7 +++++++ > > 3 files changed, 11 insertions(+) > > > > > > diff --git a/README b/README > > index 4509cc1..c19fcb1 100644 > > --- a/README > > +++ b/README > > @@ -84,6 +84,9 @@ Preparing system for tests (IRIX and Linux): > > run xfs_repair -n to check the filesystem; xfs_repair to rebuild > > metadata indexes; and xfs_repair -n (a third time) to check the > > results of the rebuilding. > > + - set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run > > + xfs_scrub -vd to scrub the filesystem metadata online before > > + unmounting to run the offline check. > > Mixed space and tab in above lines, I can fix it at commit time. Ok. Sorry about that, --D > > Thanks, > Eryu > > > > > - or add a case to the switch in common/config assigning > > these variables based on the hostname of your test > > diff --git a/common/config b/common/config > > index 08d5d80..168f46c 100644 > > --- a/common/config > > +++ b/common/config > > @@ -163,6 +163,7 @@ export XFS_REPAIR_PROG="`set_prog_path xfs_repair`" > > export XFS_DB_PROG="`set_prog_path xfs_db`" > > export XFS_GROWFS_PROG=`set_prog_path xfs_growfs` > > export XFS_IO_PROG="`set_prog_path xfs_io`" > > +export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`" > > export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`" > > export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`" > > export __XFSDUMP_PROG="`set_prog_path xfsdump`" > > diff --git a/common/rc b/common/rc > > index 3b45578..861a721 100644 > > --- a/common/rc > > +++ b/common/rc > > @@ -2391,6 +2391,13 @@ _check_xfs_filesystem() > > > > if [ "$type" = "xfs" ] > > then > > + if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then > > + "$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full > > + if [ $? -ne 0 ]; then > > + echo "filesystem on $device failed scrub (see $seqres.full)" > > + ok=0 > > + fi > > + fi > > # mounted ... > > mountpoint=`_umount_or_remount_ro $device` > > fi > > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Mon, Aug 08, 2016 at 05:08:00PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:48:07PM -0700, Darrick J. Wong wrote: > > Test the realtime rmap btree code by exercising various IO patterns > > on realtime files. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/878 | 88 +++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/878.out | 9 ++++ > > tests/xfs/879 | 67 +++++++++++++++++++++++++++++++++ > > tests/xfs/879.out | 7 +++ > > tests/xfs/880 | 86 ++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/880.out | 7 +++ > > tests/xfs/881 | 95 +++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/881.out | 8 ++++ > > tests/xfs/882 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/882.out | 11 +++++ > > tests/xfs/883 | 89 ++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/883.out | 10 +++++ > > tests/xfs/884 | 91 +++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/884.out | 9 ++++ > > tests/xfs/885 | 94 ++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/885.out | 10 +++++ > > tests/xfs/886 | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/886.out | 7 +++ > > tests/xfs/887 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/887.out | 7 +++ > > tests/xfs/888 | 76 +++++++++++++++++++++++++++++++++++++ > > tests/xfs/888.out | 6 +++ > > tests/xfs/group | 11 +++++ > > 23 files changed, 1107 insertions(+) > > create mode 100644 tests/xfs/878 > > Need the mode of test file to be 755 D'oh! > > create mode 100644 tests/xfs/878.out > > create mode 100755 tests/xfs/879 > > create mode 100644 tests/xfs/879.out > > create mode 100755 tests/xfs/880 > > create mode 100644 tests/xfs/880.out > > create mode 100755 tests/xfs/881 > > create mode 100644 tests/xfs/881.out > > create mode 100755 tests/xfs/882 > > create mode 100644 tests/xfs/882.out > > create mode 100755 tests/xfs/883 > > create mode 100644 tests/xfs/883.out > > create mode 100755 tests/xfs/884 > > create mode 100644 tests/xfs/884.out > > create mode 100755 tests/xfs/885 > > create mode 100644 tests/xfs/885.out > > create mode 100755 tests/xfs/886 > > create mode 100644 tests/xfs/886.out > > create mode 100755 tests/xfs/887 > > create mode 100644 tests/xfs/887.out > > create mode 100755 tests/xfs/888 > > create mode 100644 tests/xfs/888.out > > > > > > diff --git a/tests/xfs/878 b/tests/xfs/878 > > new file mode 100644 > > index 0000000..b1f2672 > > --- /dev/null > > +++ b/tests/xfs/878 > > @@ -0,0 +1,88 @@ > > +#! /bin/bash > > +# FS QA Test No. 878 > > +# > > +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > _supported_fs xfs (also apply to all tests in this patch) Ok. > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +SCRATCH_RTDEV= USE_EXTERNAL= _scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +$XFS_DB_PROG -x -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > I think there's no need to filter unmount. > > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/878.out b/tests/xfs/878.out > > new file mode 100644 > > index 0000000..e134506 > > --- /dev/null > > +++ b/tests/xfs/878.out > > @@ -0,0 +1,9 @@ > > +QA output created by 878 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/879 b/tests/xfs/879 > > new file mode 100755 > > index 0000000..0cbaf09 > > --- /dev/null > > +++ b/tests/xfs/879 > > @@ -0,0 +1,67 @@ > > +#! /bin/bash > > +# FS QA Test No. 879 > > +# > > +# Ensure that we can create a few realtime files on a rmapbt filesystem. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > common/attr seems not needed in this test and other tests in this patch. Right. I'll remove them. > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create a few files" > > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full > > +_scratch_cycle_mount > > + > > +echo "Grab contents" > > +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch > > + > > +echo "Remove one file" > > +rm -rf $SCRATCH_MNT/f2 > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/879.out b/tests/xfs/879.out > > new file mode 100644 > > index 0000000..9dfe48b > > --- /dev/null > > +++ b/tests/xfs/879.out > > @@ -0,0 +1,7 @@ > > +QA output created by 879 > > +Format and mount > > +Create a few files > > +Grab contents > > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f1 > > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f2 > > +Remove one file > > diff --git a/tests/xfs/880 b/tests/xfs/880 > > new file mode 100755 > > index 0000000..2056097 > > --- /dev/null > > +++ b/tests/xfs/880 > > @@ -0,0 +1,86 @@ > > +#! /bin/bash > > +# FS QA Test No. 880 > > +# > > +# Exercise expanding and shrinking the realtime rmap btree. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +echo "Create a three-level rtrmapbt" > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_ptrs=$(( (blksz - 56) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > Both isize and rtextsz can be got from _filter_mkfs, as I mentioned in > another email. Ok. > > Thanks, > Eryu > > > +len=$((blocks * rtblksz)) > > + > > +echo "Create big file" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > + > > +echo "Explode the rtrmapbt" > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +_scratch_cycle_mount > > + > > +echo "Remove half the records" > > +rm -rf $SCRATCH_MNT/f1 > > +_scratch_cycle_mount > > + > > +echo "Remove the rest of the records" > > +rm -rf $SCRATCH_MNT/f2 > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/880.out b/tests/xfs/880.out > > new file mode 100644 > > index 0000000..b87665b > > --- /dev/null > > +++ b/tests/xfs/880.out > > @@ -0,0 +1,7 @@ > > +QA output created by 880 > > +Format and mount > > +Create a three-level rtrmapbt > > +Create big file > > +Explode the rtrmapbt > > +Remove half the records > > +Remove the rest of the records > > diff --git a/tests/xfs/881 b/tests/xfs/881 > > new file mode 100755 > > index 0000000..c7474f5 > > --- /dev/null > > +++ b/tests/xfs/881 > > @@ -0,0 +1,95 @@ > > +#! /bin/bash > > +# FS QA Test No. 881 > > +# > > +# Exercise metadump on realtime rmapbt preservation. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +metadump_file=$TEST_DIR/${seq}_metadump > > +rm -rf $metadump_file > > + > > +echo "Create a three-level rtrmapbt" > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_ptrs=$(( (blksz - 56) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > +len=$((blocks * rtblksz)) > > + > > +echo "Create big file" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > + > > +echo "Explode the rtrmapbt" > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +_scratch_cycle_mount > > + > > +echo "Create metadump file" > > +_scratch_unmount > > +_scratch_metadump $metadump_file > > + > > +# Now restore the obfuscated one back and take a look around > > +echo "Restore metadump" > > +xfs_mdrestore $metadump_file $TEST_DIR/image > > +SCRATCH_DEV=$TEST_DIR/image _scratch_mount > > +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount > > + > > +echo "Check restored fs" > > +_check_generic_filesystem $metadump_file > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/881.out b/tests/xfs/881.out > > new file mode 100644 > > index 0000000..6ad156c > > --- /dev/null > > +++ b/tests/xfs/881.out > > @@ -0,0 +1,8 @@ > > +QA output created by 881 > > +Format and mount > > +Create a three-level rtrmapbt > > +Create big file > > +Explode the rtrmapbt > > +Create metadump file > > +Restore metadump > > +Check restored fs > > diff --git a/tests/xfs/882 b/tests/xfs/882 > > new file mode 100755 > > index 0000000..569a560 > > --- /dev/null > > +++ b/tests/xfs/882 > > @@ -0,0 +1,108 @@ > > +#! /bin/bash > > +# FS QA Test No. 882 > > +# > > +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "+ create scratch fs" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > + > > +echo "+ mount fs image" > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_ptrs=$(( (blksz - 56) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +len=$((blocks * blksz)) > > + > > +echo "+ make some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +_scratch_unmount > > + > > +echo "+ check fs" > > +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail" > > + > > +echo "+ corrupt image" > > +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" -c "stack" \ > > + -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" $SCRATCH_DEV >> $seqres.full 2>&1 > > + > > +echo "+ mount image" > > +_scratch_mount > > + > > +echo "+ copy more" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1 > > +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree" > > +_scratch_unmount > > + > > +echo "+ repair fs" > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "+ mount image (2)" > > +_scratch_mount > > + > > +echo "+ copy more (2)" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/882.out b/tests/xfs/882.out > > new file mode 100644 > > index 0000000..5ebe620 > > --- /dev/null > > +++ b/tests/xfs/882.out > > @@ -0,0 +1,11 @@ > > +QA output created by 882 > > ++ create scratch fs > > ++ mount fs image > > ++ make some files > > ++ check fs > > ++ corrupt image > > ++ mount image > > ++ copy more > > ++ repair fs > > ++ mount image (2) > > ++ copy more (2) > > diff --git a/tests/xfs/883 b/tests/xfs/883 > > new file mode 100755 > > index 0000000..403ef35 > > --- /dev/null > > +++ b/tests/xfs/883 > > @@ -0,0 +1,89 @@ > > +#! /bin/bash > > +# FS QA Test No. 883 > > +# > > +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c 'write core.nlinkv2 0' \ > > + -c 'write core.mode 0' -c 'sb 0' -c 'write rrmapino 0' $SCRATCH_DEV >> $seqres.full > > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/883.out b/tests/xfs/883.out > > new file mode 100644 > > index 0000000..6e75ac1 > > --- /dev/null > > +++ b/tests/xfs/883.out > > @@ -0,0 +1,10 @@ > > +QA output created by 883 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +md5sum: SCRATCH_MNT/f1: No such file or directory > > +Try to create more files > > +Repair fs > > +umount: SCRATCH_DEV: not mounted > > +Try to create more files (again) > > diff --git a/tests/xfs/884 b/tests/xfs/884 > > new file mode 100755 > > index 0000000..ad648b8 > > --- /dev/null > > +++ b/tests/xfs/884 > > @@ -0,0 +1,91 @@ > > +#! /bin/bash > > +# FS QA Test No. 884 > > +# > > +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +echo garbage > $SCRATCH_MNT/f3 > > +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \ > > + -c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/884.out b/tests/xfs/884.out > > new file mode 100644 > > index 0000000..17a73ef > > --- /dev/null > > +++ b/tests/xfs/884.out > > @@ -0,0 +1,9 @@ > > +QA output created by 884 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/885 b/tests/xfs/885 > > new file mode 100755 > > index 0000000..b5880bd > > --- /dev/null > > +++ b/tests/xfs/885 > > @@ -0,0 +1,94 @@ > > +#! /bin/bash > > +# FS QA Test No. 885 > > +# > > +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > > +$XFS_DB_PROG -x -c "inode $rrmapino" -c 'write core.format 2' \ > > + -c 'write core.size 0' -c 'write core.nblocks 0' \ > > + -c 'sb 0' -c 'addr rootino' -c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \ > > + -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/885.out b/tests/xfs/885.out > > new file mode 100644 > > index 0000000..df04f79 > > --- /dev/null > > +++ b/tests/xfs/885.out > > @@ -0,0 +1,10 @@ > > +QA output created by 885 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +md5sum: SCRATCH_MNT/f1: No such file or directory > > +Try to create more files > > +Repair fs > > +umount: SCRATCH_DEV: not mounted > > +Try to create more files (again) > > diff --git a/tests/xfs/886 b/tests/xfs/886 > > new file mode 100755 > > index 0000000..57edb3d > > --- /dev/null > > +++ b/tests/xfs/886 > > @@ -0,0 +1,104 @@ > > +#! /bin/bash > > +# FS QA Test No. 886 > > +# > > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_recs + 1)) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > +len=$((blocks * rtblksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' $SCRATCH_DEV | \ > > + sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g') > > + > > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c "write u3.rtrmapbt.ptrs[1] $fsbno" \ > > + -c 'p' $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > > +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/886.out b/tests/xfs/886.out > > new file mode 100644 > > index 0000000..7f00c5d > > --- /dev/null > > +++ b/tests/xfs/886.out > > @@ -0,0 +1,7 @@ > > +QA output created by 886 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/887 b/tests/xfs/887 > > new file mode 100755 > > index 0000000..cdf2707 > > --- /dev/null > > +++ b/tests/xfs/887 > > @@ -0,0 +1,107 @@ > > +#! /bin/bash > > +# FS QA Test No. 887 > > +# > > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_recs + 1)) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > +len=$((blocks * rtblksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' $SCRATCH_DEV >> $seqres.full > > + > > +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' \ > > + $SCRATCH_DEV | sed -e 's/^.*://g') > > +$XFS_DB_PROG -x -c "inode $ino" -c "write u3.bmx[0].startblock $fsbno" \ > > + $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > > +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/887.out b/tests/xfs/887.out > > new file mode 100644 > > index 0000000..30cf032 > > --- /dev/null > > +++ b/tests/xfs/887.out > > @@ -0,0 +1,7 @@ > > +QA output created by 887 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/888 b/tests/xfs/888 > > new file mode 100755 > > index 0000000..15bec80 > > --- /dev/null > > +++ b/tests/xfs/888 > > @@ -0,0 +1,76 @@ > > +#! /bin/bash > > +# FS QA Test No. 888 > > +# > > +# Basic rmap manipulation tests for realtime files. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz=65536 > > +blocks=16 > > +len=$((blocks * blksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Manipulate file" > > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > > + -c "fzero $((3 * blksz)) $blksz" \ > > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > > + -c "fpunch $((7 * blksz)) $blksz" \ > > + -c "fsync" \ > > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > > + -c "fcollapse $((9 * blksz)) $blksz" \ > > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Check file" > > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/888.out b/tests/xfs/888.out > > new file mode 100644 > > index 0000000..2587697 > > --- /dev/null > > +++ b/tests/xfs/888.out > > @@ -0,0 +1,6 @@ > > +QA output created by 888 > > +Format and mount > > +Create some files > > +Manipulate file > > +Check file > > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > > diff --git a/tests/xfs/group b/tests/xfs/group > > index f81f899..6fa2eb6 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -311,3 +311,14 @@ > > 875 auto quick clone fsr quota > > 876 auto quick rmap clone > > 877 auto quick rmap clone > > +878 auto quick rmap > > +879 auto quick rmap > > +880 auto quick rmap > > +881 auto quick rmap > > +882 fuzzers rmap > > +883 auto quick rmap > > +884 auto quick rmap > > +885 auto quick rmap > > +886 auto quick rmap > > +887 auto quick rmap > > +888 auto quick rmap > >
On Mon, Aug 08, 2016 at 05:08:00PM +0800, Eryu Guan wrote: > On Thu, Jul 21, 2016 at 04:48:07PM -0700, Darrick J. Wong wrote: > > Test the realtime rmap btree code by exercising various IO patterns > > on realtime files. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > tests/xfs/878 | 88 +++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/878.out | 9 ++++ > > tests/xfs/879 | 67 +++++++++++++++++++++++++++++++++ > > tests/xfs/879.out | 7 +++ > > tests/xfs/880 | 86 ++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/880.out | 7 +++ > > tests/xfs/881 | 95 +++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/881.out | 8 ++++ > > tests/xfs/882 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/882.out | 11 +++++ > > tests/xfs/883 | 89 ++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/883.out | 10 +++++ > > tests/xfs/884 | 91 +++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/884.out | 9 ++++ > > tests/xfs/885 | 94 ++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/885.out | 10 +++++ > > tests/xfs/886 | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/886.out | 7 +++ > > tests/xfs/887 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/887.out | 7 +++ > > tests/xfs/888 | 76 +++++++++++++++++++++++++++++++++++++ > > tests/xfs/888.out | 6 +++ > > tests/xfs/group | 11 +++++ > > 23 files changed, 1107 insertions(+) > > create mode 100644 tests/xfs/878 > > Need the mode of test file to be 755 D'oh! > > create mode 100644 tests/xfs/878.out > > create mode 100755 tests/xfs/879 > > create mode 100644 tests/xfs/879.out > > create mode 100755 tests/xfs/880 > > create mode 100644 tests/xfs/880.out > > create mode 100755 tests/xfs/881 > > create mode 100644 tests/xfs/881.out > > create mode 100755 tests/xfs/882 > > create mode 100644 tests/xfs/882.out > > create mode 100755 tests/xfs/883 > > create mode 100644 tests/xfs/883.out > > create mode 100755 tests/xfs/884 > > create mode 100644 tests/xfs/884.out > > create mode 100755 tests/xfs/885 > > create mode 100644 tests/xfs/885.out > > create mode 100755 tests/xfs/886 > > create mode 100644 tests/xfs/886.out > > create mode 100755 tests/xfs/887 > > create mode 100644 tests/xfs/887.out > > create mode 100755 tests/xfs/888 > > create mode 100644 tests/xfs/888.out > > > > > > diff --git a/tests/xfs/878 b/tests/xfs/878 > > new file mode 100644 > > index 0000000..b1f2672 > > --- /dev/null > > +++ b/tests/xfs/878 > > @@ -0,0 +1,88 @@ > > +#! /bin/bash > > +# FS QA Test No. 878 > > +# > > +# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > _supported_fs xfs (also apply to all tests in this patch) Ok. > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +SCRATCH_RTDEV= USE_EXTERNAL= _scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +$XFS_DB_PROG -x -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > I think there's no need to filter unmount. > > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/878.out b/tests/xfs/878.out > > new file mode 100644 > > index 0000000..e134506 > > --- /dev/null > > +++ b/tests/xfs/878.out > > @@ -0,0 +1,9 @@ > > +QA output created by 878 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/879 b/tests/xfs/879 > > new file mode 100755 > > index 0000000..0cbaf09 > > --- /dev/null > > +++ b/tests/xfs/879 > > @@ -0,0 +1,67 @@ > > +#! /bin/bash > > +# FS QA Test No. 879 > > +# > > +# Ensure that we can create a few realtime files on a rmapbt filesystem. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > common/attr seems not needed in this test and other tests in this patch. Right. I'll remove them. > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create a few files" > > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c 'pwrite -S 0x67 0 50000' -c fsync $SCRATCH_MNT/f2 >> $seqres.full > > +_scratch_cycle_mount > > + > > +echo "Grab contents" > > +md5sum $SCRATCH_MNT/f1 $SCRATCH_MNT/f2 | _filter_scratch > > + > > +echo "Remove one file" > > +rm -rf $SCRATCH_MNT/f2 > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/879.out b/tests/xfs/879.out > > new file mode 100644 > > index 0000000..9dfe48b > > --- /dev/null > > +++ b/tests/xfs/879.out > > @@ -0,0 +1,7 @@ > > +QA output created by 879 > > +Format and mount > > +Create a few files > > +Grab contents > > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f1 > > +10abe2628d19eb1c2ebe18aad7b14820 SCRATCH_MNT/f2 > > +Remove one file > > diff --git a/tests/xfs/880 b/tests/xfs/880 > > new file mode 100755 > > index 0000000..2056097 > > --- /dev/null > > +++ b/tests/xfs/880 > > @@ -0,0 +1,86 @@ > > +#! /bin/bash > > +# FS QA Test No. 880 > > +# > > +# Exercise expanding and shrinking the realtime rmap btree. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +echo "Create a three-level rtrmapbt" > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_ptrs=$(( (blksz - 56) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > Both isize and rtextsz can be got from _filter_mkfs, as I mentioned in > another email. Ok. > > Thanks, > Eryu > > > +len=$((blocks * rtblksz)) > > + > > +echo "Create big file" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > + > > +echo "Explode the rtrmapbt" > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +_scratch_cycle_mount > > + > > +echo "Remove half the records" > > +rm -rf $SCRATCH_MNT/f1 > > +_scratch_cycle_mount > > + > > +echo "Remove the rest of the records" > > +rm -rf $SCRATCH_MNT/f2 > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/880.out b/tests/xfs/880.out > > new file mode 100644 > > index 0000000..b87665b > > --- /dev/null > > +++ b/tests/xfs/880.out > > @@ -0,0 +1,7 @@ > > +QA output created by 880 > > +Format and mount > > +Create a three-level rtrmapbt > > +Create big file > > +Explode the rtrmapbt > > +Remove half the records > > +Remove the rest of the records > > diff --git a/tests/xfs/881 b/tests/xfs/881 > > new file mode 100755 > > index 0000000..c7474f5 > > --- /dev/null > > +++ b/tests/xfs/881 > > @@ -0,0 +1,95 @@ > > +#! /bin/bash > > +# FS QA Test No. 881 > > +# > > +# Exercise metadump on realtime rmapbt preservation. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +metadump_file=$TEST_DIR/${seq}_metadump > > +rm -rf $metadump_file > > + > > +echo "Create a three-level rtrmapbt" > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_ptrs=$(( (blksz - 56) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_ptrs * bt_recs)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > +len=$((blocks * rtblksz)) > > + > > +echo "Create big file" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > + > > +echo "Explode the rtrmapbt" > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +_scratch_cycle_mount > > + > > +echo "Create metadump file" > > +_scratch_unmount > > +_scratch_metadump $metadump_file > > + > > +# Now restore the obfuscated one back and take a look around > > +echo "Restore metadump" > > +xfs_mdrestore $metadump_file $TEST_DIR/image > > +SCRATCH_DEV=$TEST_DIR/image _scratch_mount > > +SCRATCH_DEV=$TEST_DIR/image _scratch_unmount > > + > > +echo "Check restored fs" > > +_check_generic_filesystem $metadump_file > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/881.out b/tests/xfs/881.out > > new file mode 100644 > > index 0000000..6ad156c > > --- /dev/null > > +++ b/tests/xfs/881.out > > @@ -0,0 +1,8 @@ > > +QA output created by 881 > > +Format and mount > > +Create a three-level rtrmapbt > > +Create big file > > +Explode the rtrmapbt > > +Create metadump file > > +Restore metadump > > +Check restored fs > > diff --git a/tests/xfs/882 b/tests/xfs/882 > > new file mode 100755 > > index 0000000..569a560 > > --- /dev/null > > +++ b/tests/xfs/882 > > @@ -0,0 +1,108 @@ > > +#! /bin/bash > > +# FS QA Test No. 882 > > +# > > +# Corrupt the realtime rmapbt and see how the kernel and xfs_repair deal. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "+ create scratch fs" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > + > > +echo "+ mount fs image" > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_ptrs=$(( (blksz - 56) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_ptrs * bt_recs + 1)) > > +_require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) > > +len=$((blocks * blksz)) > > + > > +echo "+ make some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +_scratch_unmount > > + > > +echo "+ check fs" > > +_scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail" > > + > > +echo "+ corrupt image" > > +$XFS_DB_PROG -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" -c "stack" \ > > + -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" $SCRATCH_DEV >> $seqres.full 2>&1 > > + > > +echo "+ mount image" > > +_scratch_mount > > + > > +echo "+ copy more" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e3 >> $seqres.full 2>&1 > > +test -s ${SCRATCH_MNT}/f3 && echo "should not be able to copy with busted rtrmap btree" > > +_scratch_unmount > > + > > +echo "+ repair fs" > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "+ mount image (2)" > > +_scratch_mount > > + > > +echo "+ copy more (2)" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 1" $SCRATCH_MNT/e4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/882.out b/tests/xfs/882.out > > new file mode 100644 > > index 0000000..5ebe620 > > --- /dev/null > > +++ b/tests/xfs/882.out > > @@ -0,0 +1,11 @@ > > +QA output created by 882 > > ++ create scratch fs > > ++ mount fs image > > ++ make some files > > ++ check fs > > ++ corrupt image > > ++ mount image > > ++ copy more > > ++ repair fs > > ++ mount image (2) > > ++ copy more (2) > > diff --git a/tests/xfs/883 b/tests/xfs/883 > > new file mode 100755 > > index 0000000..403ef35 > > --- /dev/null > > +++ b/tests/xfs/883 > > @@ -0,0 +1,89 @@ > > +#! /bin/bash > > +# FS QA Test No. 883 > > +# > > +# Set rrmapino to zero on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c 'write core.nlinkv2 0' \ > > + -c 'write core.mode 0' -c 'sb 0' -c 'write rrmapino 0' $SCRATCH_DEV >> $seqres.full > > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/883.out b/tests/xfs/883.out > > new file mode 100644 > > index 0000000..6e75ac1 > > --- /dev/null > > +++ b/tests/xfs/883.out > > @@ -0,0 +1,10 @@ > > +QA output created by 883 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +md5sum: SCRATCH_MNT/f1: No such file or directory > > +Try to create more files > > +Repair fs > > +umount: SCRATCH_DEV: not mounted > > +Try to create more files (again) > > diff --git a/tests/xfs/884 b/tests/xfs/884 > > new file mode 100755 > > index 0000000..ad648b8 > > --- /dev/null > > +++ b/tests/xfs/884 > > @@ -0,0 +1,91 @@ > > +#! /bin/bash > > +# FS QA Test No. 884 > > +# > > +# Link rrmapino into the rootdir on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +echo garbage > $SCRATCH_MNT/f3 > > +ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rootino' \ > > + -c "write u3.sfdir3.list[3].inumber.i4 $rrmapino" $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/884.out b/tests/xfs/884.out > > new file mode 100644 > > index 0000000..17a73ef > > --- /dev/null > > +++ b/tests/xfs/884.out > > @@ -0,0 +1,9 @@ > > +QA output created by 884 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +8f27047948255cb84872e2dd7c0bc56d SCRATCH_MNT/f1 > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/885 b/tests/xfs/885 > > new file mode 100755 > > index 0000000..b5880bd > > --- /dev/null > > +++ b/tests/xfs/885 > > @@ -0,0 +1,94 @@ > > +#! /bin/bash > > +# FS QA Test No. 885 > > +# > > +# Set rrmapino to another inode on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +rrmapino=$($XFS_DB_PROG -c 'sb 0' -c 'p rrmapino' $SCRATCH_DEV | awk '{print $3}') > > +$XFS_DB_PROG -x -c "inode $rrmapino" -c 'write core.format 2' \ > > + -c 'write core.size 0' -c 'write core.nblocks 0' \ > > + -c 'sb 0' -c 'addr rootino' -c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \ > > + -c 'sb 0' -c "write rrmapino $ino" $SCRATCH_DEV >> $seqres.full > > +_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" > > + > > +echo "Check files" > > +md5sum $SCRATCH_MNT/f1 2>&1 | _filter_scratch > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f3 >> $seqres.full 2>&1 > > +test -e $SCRATCH_MNT/f3 && echo "should not have been able to write f3" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/885.out b/tests/xfs/885.out > > new file mode 100644 > > index 0000000..df04f79 > > --- /dev/null > > +++ b/tests/xfs/885.out > > @@ -0,0 +1,10 @@ > > +QA output created by 885 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Check files > > +md5sum: SCRATCH_MNT/f1: No such file or directory > > +Try to create more files > > +Repair fs > > +umount: SCRATCH_DEV: not mounted > > +Try to create more files (again) > > diff --git a/tests/xfs/886 b/tests/xfs/886 > > new file mode 100755 > > index 0000000..57edb3d > > --- /dev/null > > +++ b/tests/xfs/886 > > @@ -0,0 +1,104 @@ > > +#! /bin/bash > > +# FS QA Test No. 886 > > +# > > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_recs + 1)) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > +len=$((blocks * rtblksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +fsbno=$($XFS_DB_PROG -c "inode $ino" -c 'bmap' $SCRATCH_DEV | \ > > + sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g') > > + > > +$XFS_DB_PROG -x -c 'sb 0' -c 'addr rrmapino' -c "write u3.rtrmapbt.ptrs[1] $fsbno" \ > > + -c 'p' $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > > +test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/886.out b/tests/xfs/886.out > > new file mode 100644 > > index 0000000..7f00c5d > > --- /dev/null > > +++ b/tests/xfs/886.out > > @@ -0,0 +1,7 @@ > > +QA output created by 886 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/887 b/tests/xfs/887 > > new file mode 100755 > > index 0000000..cdf2707 > > --- /dev/null > > +++ b/tests/xfs/887 > > @@ -0,0 +1,107 @@ > > +#! /bin/bash > > +# FS QA Test No. 887 > > +# > > +# Cross-link rrmapino to another inode on an rtrmap fs and see if repair fixes it. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > +_require_test_program "punch-alternating" > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz="$(stat -f $SCRATCH_MNT -c '%S')" > > +isize=$(xfs_info $SCRATCH_MNT | grep isize | sed -e 's/^.*isize=\([0-9]*\).*$/\1/g') > > + > > +i_ptrs=$(( (isize - 176) / 56 )) > > +bt_recs=$(( (blksz - 56) / 32 )) > > + > > +blocks=$((i_ptrs * bt_recs + 1)) > > +rtblksz=$(xfs_info $SCRATCH_MNT | grep '^realtime' | \ > > + sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') > > +len=$((blocks * rtblksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full > > +./src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" > > +./src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" > > +echo garbage > $SCRATCH_MNT/f3 > > +ino=$(stat -c '%i' $SCRATCH_MNT/f3) > > +_scratch_unmount > > + > > +echo "Corrupt fs" > > +$XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' $SCRATCH_DEV >> $seqres.full > > + > > +fsbno=$($XFS_DB_PROG -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' \ > > + $SCRATCH_DEV | sed -e 's/^.*://g') > > +$XFS_DB_PROG -x -c "inode $ino" -c "write u3.bmx[0].startblock $fsbno" \ > > + $SCRATCH_DEV >> $seqres.full > > +_scratch_mount > > + > > +od -tx1 -Ad -c $SCRATCH_MNT/f3 >> $seqres.full > > + > > +echo "Try to create more files" > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 > > +test ! -e $SCRATCH_MNT/f5 && echo "should have been able to write f5" > > + > > +echo "Repair fs" > > +_scratch_unmount 2>&1 | _filter_scratch > > +$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \ > > + | tee $tmp.logprint | grep -q "<CLEAN>" > > +if [ $? -ne 0 ]; then > > + echo "Dirty log, zeroing..." >> $seqres.full > > + _scratch_xfs_repair -L >> $seqres.full 2>&1 > > +else > > + _scratch_xfs_repair >> $seqres.full 2>&1 > > +fi > > +_scratch_xfs_repair >> $seqres.full 2>&1 > > + > > +echo "Try to create more files (again)" > > +_scratch_mount > > +$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f4 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/887.out b/tests/xfs/887.out > > new file mode 100644 > > index 0000000..30cf032 > > --- /dev/null > > +++ b/tests/xfs/887.out > > @@ -0,0 +1,7 @@ > > +QA output created by 887 > > +Format and mount > > +Create some files > > +Corrupt fs > > +Try to create more files > > +Repair fs > > +Try to create more files (again) > > diff --git a/tests/xfs/888 b/tests/xfs/888 > > new file mode 100755 > > index 0000000..15bec80 > > --- /dev/null > > +++ b/tests/xfs/888 > > @@ -0,0 +1,76 @@ > > +#! /bin/bash > > +# FS QA Test No. 888 > > +# > > +# Basic rmap manipulation tests for realtime files. > > +# > > +#----------------------------------------------------------------------- > > +# Copyright (c) 2016, Oracle and/or its affiliates. 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" > > + > > +here=`pwd` > > +tmp=/tmp/$$ > > +status=1 # failure is the default! > > +trap "_cleanup; exit \$status" 0 1 2 3 15 > > + > > +_cleanup() > > +{ > > + cd / > > + rm -rf "$tmp".* $metadump_file > > +} > > + > > +# get standard environment, filters and checks > > +. ./common/rc > > +. ./common/filter > > +. ./common/attr > > + > > +# real QA test starts here > > +_supported_os Linux > > +_require_realtime > > +_require_xfs_scratch_rmapbt > > + > > +rm -f "$seqres.full" > > + > > +echo "Format and mount" > > +_scratch_mkfs > "$seqres.full" 2>&1 > > +_scratch_mount > > +blksz=65536 > > +blocks=16 > > +len=$((blocks * blksz)) > > + > > +echo "Create some files" > > +$XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Manipulate file" > > +$XFS_IO_PROG -c "fpunch $blksz $blksz" \ > > + -c "fzero $((3 * blksz)) $blksz" \ > > + -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \ > > + -c "fpunch $((7 * blksz)) $blksz" \ > > + -c "fsync" \ > > + -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \ > > + -c "fcollapse $((9 * blksz)) $blksz" \ > > + -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full > > + > > +echo "Check file" > > +md5sum $SCRATCH_MNT/f1 | _filter_scratch > > +od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full > > + > > +# success, all done > > +status=0 > > +exit > > diff --git a/tests/xfs/888.out b/tests/xfs/888.out > > new file mode 100644 > > index 0000000..2587697 > > --- /dev/null > > +++ b/tests/xfs/888.out > > @@ -0,0 +1,6 @@ > > +QA output created by 888 > > +Format and mount > > +Create some files > > +Manipulate file > > +Check file > > +e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 > > diff --git a/tests/xfs/group b/tests/xfs/group > > index f81f899..6fa2eb6 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -311,3 +311,14 @@ > > 875 auto quick clone fsr quota > > 876 auto quick rmap clone > > 877 auto quick rmap clone > > +878 auto quick rmap > > +879 auto quick rmap > > +880 auto quick rmap > > +881 auto quick rmap > > +882 fuzzers rmap > > +883 auto quick rmap > > +884 auto quick rmap > > +885 auto quick rmap > > +886 auto quick rmap > > +887 auto quick rmap > > +888 auto quick rmap > > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Mon, Aug 08, 2016 at 10:41:32AM -0700, Darrick J. Wong wrote:
> On Mon, Aug 08, 2016 at 04:13:59PM +0800, Eryu Guan wrote:
> > On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote:
> > > Add a few tests to stress the new swapext code for reflink and rmap.
> > > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full"
> > > +
> > > +echo "Defrag the big file"
> > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3)
> >
> > There's a "_count_extents" helper, does that work for this case?
>
> It can, though stat -v reports GETFSXATTR results, which should be faster than
> _count_extents because the latter FIEMAPs the entire file and counts lines.
> Seeing as XFS records the extent count in the inode, we might as well use it.
perhaps put a special xfs case in _count_extents() that does this
rather than FIEMAP?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
On Mon, Aug 08, 2016 at 10:41:32AM -0700, Darrick J. Wong wrote: > On Mon, Aug 08, 2016 at 04:13:59PM +0800, Eryu Guan wrote: > > On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote: > > > Add a few tests to stress the new swapext code for reflink and rmap. > > > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" > > > + > > > +echo "Defrag the big file" > > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > > > There's a "_count_extents" helper, does that work for this case? > > It can, though stat -v reports GETFSXATTR results, which should be faster than > _count_extents because the latter FIEMAPs the entire file and counts lines. > Seeing as XFS records the extent count in the inode, we might as well use it. perhaps put a special xfs case in _count_extents() that does this rather than FIEMAP? Cheers, Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
On Tue, Aug 09, 2016 at 04:29:43PM +1000, Dave Chinner wrote: > On Mon, Aug 08, 2016 at 10:41:32AM -0700, Darrick J. Wong wrote: > > On Mon, Aug 08, 2016 at 04:13:59PM +0800, Eryu Guan wrote: > > > On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote: > > > > Add a few tests to stress the new swapext code for reflink and rmap. > > > > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" > > > > + > > > > +echo "Defrag the big file" > > > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > > > > > There's a "_count_extents" helper, does that work for this case? > > > > It can, though stat -v reports GETFSXATTR results, which should be faster than > > _count_extents because the latter FIEMAPs the entire file and counts lines. > > Seeing as XFS records the extent count in the inode, we might as well use it. > > perhaps put a special xfs case in _count_extents() that does this > rather than FIEMAP? Ok. Seems simple enough to do. --D > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com
On Tue, Aug 09, 2016 at 04:29:43PM +1000, Dave Chinner wrote: > On Mon, Aug 08, 2016 at 10:41:32AM -0700, Darrick J. Wong wrote: > > On Mon, Aug 08, 2016 at 04:13:59PM +0800, Eryu Guan wrote: > > > On Thu, Jul 21, 2016 at 04:47:38PM -0700, Darrick J. Wong wrote: > > > > Add a few tests to stress the new swapext code for reflink and rmap. > > > > +_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $bytes >> "$seqres.full" > > > > + > > > > +echo "Defrag the big file" > > > > +old_nextents=$(xfs_io -c 'stat -v' $testdir/file1 | grep 'nextents' | cut -d ' ' -f 3) > > > > > > There's a "_count_extents" helper, does that work for this case? > > > > It can, though stat -v reports GETFSXATTR results, which should be faster than > > _count_extents because the latter FIEMAPs the entire file and counts lines. > > Seeing as XFS records the extent count in the inode, we might as well use it. > > perhaps put a special xfs case in _count_extents() that does this > rather than FIEMAP? Ok. Seems simple enough to do. --D > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs