Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 1/8] xfstests: fix btrfs/002 to not use the scratch dev pool
This test doesn''t need the scratch dev pool and it also doesn''t call _require_scratch_dev_pool, so just kick out the scratch dev pool part of the test. Thanks, Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- tests/btrfs/002 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/btrfs/002 b/tests/btrfs/002 index f4389ae..19a62c6 100755 --- a/tests/btrfs/002 +++ b/tests/btrfs/002 @@ -45,9 +45,8 @@ _need_to_be_root _supported_fs btrfs _supported_os Linux _require_scratch -_require_scratch_dev_pool -_scratch_pool_mkfs > /dev/null 2>&1 || _fail "mkfs failed" +_scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" _scratch_mount # Create and save sha256sum -- 1.8.3.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 2/8] xfstests: add regression test for kernel bz 60673
There was a problem with send trying to overwrite a file that wasn''t actually the same. This is a test to check this particular case where receive fails when it should succeed properly. I tested this to verify it fails without my fix and passes with my fix. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- tests/btrfs/015 | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/015.out | 2 + tests/btrfs/group | 1 + 3 files changed, 113 insertions(+) create mode 100644 tests/btrfs/015 create mode 100644 tests/btrfs/015.out diff --git a/tests/btrfs/015 b/tests/btrfs/015 new file mode 100644 index 0000000..f35600f --- /dev/null +++ b/tests/btrfs/015 @@ -0,0 +1,110 @@ +#! /bin/bash +# FS QA Test No. btrfs/015 +# +# btrfs send ENOENT regression test, kernel bugzilla 60673 +# +#----------------------------------------------------------------------- +# Copyright (c) 2013 Fusion IO. 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/$$ +tmp_dir=send_temp_$seq + +status=1 # failure is the default! + +_cleanup() +{ + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap1 > /dev/null 2>&1 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap2 > /dev/null 2>&1 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/send > /dev/null 2>&1 + rm -rf $TEST_DIR/$tmp_dir + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +_scratch_mkfs > /dev/null 2>&1 + +#receive needs to be able to setxattrs, including the selinux context, if we use +#the normal nfs context thing it screws up our ability to set the +#security.selinux xattrs so we need to disable this for this test +export SELINUX_MOUNT_OPTIONS="" + +_scratch_mount + +mkdir $TEST_DIR/$tmp_dir +$BTRFS_UTIL_PROG subvol create $TEST_DIR/$tmp_dir/send \ + > $seqres.full 2>&1 || _fail "failed subvol create" + +cd $TEST_DIR/$tmp_dir/send + +mkdir test +touch test/baz +touch test/blah +mkdir test/foo +touch test/foo/bar + +# cd out in case any of this fails +cd / + +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed snap1" + +$BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send1.dump \ + $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed send" + +$BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send1.dump $SCRATCH_MNT \ + >> $seqres.full 2>&1 || _fail "failed receive" + +#recreate everything exactly the way it was exceptn in a different order so we +#get different inode numbers +cd $TEST_DIR/$tmp_dir/send +rm -rf test +mkdir test +touch test/baz +mkdir test/foo +touch test/foo/bar +touch test/blah +cd / + +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap2 >> $seqres.full 2>&1 || _fail "failed snap2" + +$BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send2.dump \ + $TEST_DIR/$tmp_dir/snap2 -p $TEST_DIR/$tmp_dir/snap1 \ + >> $seqres.full 2>&1 || _fail "failed second send" + +$BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send2.dump $SCRATCH_MNT \ + >> $seqres.full 2>&1 || _fail "failed second receive" + +echo "Silence is golden" +status=0 ; exit diff --git a/tests/btrfs/015.out b/tests/btrfs/015.out new file mode 100644 index 0000000..fee0fcf --- /dev/null +++ b/tests/btrfs/015.out @@ -0,0 +1,2 @@ +QA output created by 015 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index 07df957..a6f1820 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -17,3 +17,4 @@ 012 auto 013 auto quick 014 auto +015 auto quick -- 1.8.3.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 3/8] xfstests: stat the dev we''re removing to make sure its'' really gone V2
I''ve been periodically failing btrfs/003 because my box sometimes takes a little longer to unregister the device when we remove it and so the output from btrfs dev show doesn''t match what we are wanting since it still sees the device. To fix this just stat and sleep if we still see the device node and only continue once udev or whatever actually removes the device node so that we don''t get random failures. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- V1->V2: Take Eric''s suggestion to do this in the helper function common/rc | 9 +++++++++ tests/btrfs/003 | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index b253948..253bd05 100644 --- a/common/rc +++ b/common/rc @@ -2093,7 +2093,16 @@ _require_freeze() # ls -l /sys/class/block/sdd | rev | cut -d "/" -f 3 | rev _devmgt_remove() { + local h=$1 + local disk=$2 + echo 1 > /sys/class/scsi_device/${1}/device/delete || _fail "Remove disk failed" + + stat $disk > /dev/null 2>&1 + while [ $? -eq 0 ]; do + sleep 1 + stat $disk > /dev/null 2>&1 + done } # arg 1 is dev to add and is output of the below eg. diff --git a/tests/btrfs/003 b/tests/btrfs/003 index 262b1d5..15c2cc7 100755 --- a/tests/btrfs/003 +++ b/tests/btrfs/003 @@ -142,7 +142,7 @@ _test_replace() DEVHTL=`ls -l /sys/class/block/${d} | rev | cut -d "/" -f 3 | rev` #fail disk - _devmgt_remove ${DEVHTL} + _devmgt_remove ${DEVHTL} $ds dev_removed=1 $BTRFS_UTIL_PROG fi show $SCRATCH_DEV | grep "Some devices missing" >> $seqres.full || _fail \ -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 4/8] xfstests: btrfs/016: a hole punching send test
I recently added a patch to avoid sending holes with btrfs send, but I screwed it up by not sending a hole when we did a hole punch. This is an xfstest version of the test I wrote to show that I had a bug and to verify I was fixing it properly. This test properly fails with my old patch and passes with my good patch. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- tests/btrfs/016 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/016.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 103 insertions(+) create mode 100644 tests/btrfs/016 create mode 100644 tests/btrfs/016.out diff --git a/tests/btrfs/016 b/tests/btrfs/016 new file mode 100644 index 0000000..d711ecb --- /dev/null +++ b/tests/btrfs/016 @@ -0,0 +1,100 @@ +#! /bin/bash +# FS QA Test No. btrfs/016 +# +# btrfs send hole punch test +# +#----------------------------------------------------------------------- +# Copyright (c) 2013 Fusion IO. 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=`mktemp -d` +tmp_dir=send_temp_$seq + +status=1 # failure is the default! + +_cleanup() +{ + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap > /dev/null 2>&1 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap1 > /dev/null 2>&1 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/send > /dev/null 2>&1 + rm -rf $TEST_DIR/$tmp_dir + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +FSSUM_PROG=$here/src/fssum +[ -x $FSSUM_PROG ] || _notrun "fssum not built" + +_scratch_mkfs > /dev/null 2>&1 + +#receive needs to be able to setxattrs, including the selinux context, if we use +#the normal nfs context thing it screws up our ability to set the +#security.selinux xattrs so we need to disable this for this test +export SELINUX_MOUNT_OPTIONS="" + +_scratch_mount + +mkdir $TEST_DIR/$tmp_dir +$BTRFS_UTIL_PROG subvol create $TEST_DIR/$tmp_dir/send \ + > $seqres.full 2>&1 || _fail "failed subvol create" + +dd if=/dev/urandom of=$TEST_DIR/$tmp_dir/send/foo bs=1M count=10 >> $seqres.full \ + 2>&1 || _fail "dd failed" +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap >> $seqres.full 2>&1 || _fail "failed snap" +$XFS_IO_PROG -c "fpunch 1m 1m" $TEST_DIR/$tmp_dir/send/foo +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed snap" + +$FSSUM_PROG -A -f -w $tmp/fssum.snap $TEST_DIR/$tmp_dir/snap >> $seqres.full \ + 2>&1 || _fail "fssum gen failed" +$FSSUM_PROG -A -f -w $tmp/fssum.snap1 $TEST_DIR/$tmp_dir/snap1 >> $seqres.full \ + 2>&1 || _fail "fssum gen failed" + +$BTRFS_UTIL_PROG send $TEST_DIR/$tmp_dir/snap -f $tmp/send.snap >> \ + $seqres.full 2>&1 || _fail "failed send" +$BTRFS_UTIL_PROG send $TEST_DIR/$tmp_dir/snap1 -p $TEST_DIR/$tmp_dir/snap \ + -f $tmp/send.snap1 >> $seqres.full 2>&1 || _fail "failed send" + +$BTRFS_UTIL_PROG receive -f $tmp/send.snap $SCRATCH_MNT >> $seqres.full 2>&1 \ + || _fail "failed recv" +$BTRFS_UTIL_PROG receive -f $tmp/send.snap1 $SCRATCH_MNT >> $seqres.full 2>&1 \ + || _fail "failed recv" + +$FSSUM_PROG -r $tmp/fssum.snap $SCRATCH_MNT/snap >> $seqres.full 2>&1 \ + || _fail "fssum failed" +$FSSUM_PROG -r $tmp/fssum.snap1 $SCRATCH_MNT/snap1 >> $seqres.full 2>&1 \ + || _fail "fssum failed" + +echo "Silence is golden" +status=0 ; exit diff --git a/tests/btrfs/016.out b/tests/btrfs/016.out new file mode 100644 index 0000000..aa2526b --- /dev/null +++ b/tests/btrfs/016.out @@ -0,0 +1,2 @@ +QA output created by 016 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index a6f1820..082fd67 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -18,3 +18,4 @@ 013 auto quick 014 auto 015 auto quick +016 auto quick -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 5/8] xfstests: generic/274 increase scratch fs size to 2g
With 1 gig btrfs defaults to mixed block groups, so we ENOSPC in this test because we run out of metadata space, not data space. Increasing to 2g allows us to use our normal setup and allows us to pass this test. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- tests/generic/274 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/generic/274 b/tests/generic/274 index da45fab..7c4887f 100755 --- a/tests/generic/274 +++ b/tests/generic/274 @@ -57,7 +57,7 @@ echo "------------------------------" rm -f $seqres.full umount $SCRATCH_DEV 2>/dev/null -_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1 +_scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1 _scratch_mount # Create a 4k file and Allocate 4M past EOF on that file -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 6/8] xfstests: generic/311: add a few more test cases
Btrfs had some issues with fsync()''ing directories and fsync()''ing after renames. These three new tests cover the 3 different issues we were seeing. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- tests/generic/311 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++-- tests/generic/311.out | 8 +++++ 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/tests/generic/311 b/tests/generic/311 index 675d927..002ad57 100644 --- a/tests/generic/311 +++ b/tests/generic/311 @@ -70,6 +70,8 @@ testfile=$SCRATCH_MNT/$seq.fsync FLAKEY_TABLE="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 180 0" FLAKEY_TABLE_DROP="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 0 180 1 drop_writes" _TEST_OPTIONS="" +allow_writes=0 +drop_writes=1 _mount_flakey() { @@ -104,8 +106,6 @@ _load_flakey_table() _run_test() { # _run_test <testnum> <0 - buffered | 1 - O_DIRECT> - allow_writes=0 - drop_writes=1 test_num=$1 direct_opt="" @@ -131,6 +131,83 @@ _run_test() _mount_flakey } +_clean_working_dir() +{ + _mount_flakey + rm -rf $SCRATCH_MNT/* + _unmount_flakey +} + +# Btrfs wasn''t making sure the directory survived fsync +_directory_test() +{ + echo "fsync new directory" + _mount_flakey + mkdir $SCRATCH_MNT/bar + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar + _load_flakey_table $drop_writes + _unmount_flakey + + _load_flakey_table $allow_writes + _mount_flakey + _ls_l $SCRATCH_MNT | tail -n +2 | awk ''{ print $1, $9 }'' + _unmount_flakey + _check_scratch_fs $FLAKEY_DEV + [ $? -ne 0 ] && _fatal "fsck failed" +} + +# Btrfs was losing a rename into a new directory +_rename_test() +{ + echo "rename fsync test" + _mount_flakey + touch $SCRATCH_MNT/foo + mkdir $SCRATCH_MNT/bar + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo + mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar/foo + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar/foo + _load_flakey_table $drop_writes + _unmount_flakey + + _load_flakey_table $allow_writes + _mount_flakey + _ls_l $SCRATCH_MNT | tail -n +2 | awk ''{ print $1, $9 }'' + _ls_l $SCRATCH_MNT/bar | tail -n +2 | awk ''{ print $1, $9 }'' + _unmount_flakey + _check_scratch_fs $FLAKEY_DEV + [ $? -ne 0 ] && _fatal "fsck failed" +} + +# Btrfs was failing to replay a log when we had a inode with a smaller inode +# number that is renamed into a directory with a higher inode number +_replay_rename_test() +{ + echo "replay rename fsync test" + _mount_flakey + touch $SCRATCH_MNT/foo + mkdir $SCRATCH_MNT/bar + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo + mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar/foo + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar + + # This is to force btrfs to relog the entire inode including the ref so + # we are sure to try and replay the ref along with the dir_index item + setfattr -n user.foo -v blah $SCRATCH_MNT/bar/foo >> $seqres.full 2>&1 + + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar/foo + _load_flakey_table $drop_writes + _unmount_flakey + + _load_flakey_table $allow_writes + _mount_flakey + _ls_l $SCRATCH_MNT | tail -n +2 | awk ''{ print $1, $9 }'' + _ls_l $SCRATCH_MNT/bar | tail -n +2 | awk ''{ print $1, $9 }'' + _unmount_flakey + _check_scratch_fs $FLAKEY_DEV + [ $? -ne 0 ] && _fatal "fsck failed" +} + _scratch_mkfs >> $seqres.full 2>&1 # Create a basic flakey device that will never error out @@ -157,5 +234,13 @@ for i in $(seq 1 20); do _run_test $i $direct done +rm -rf $SCRATCH_MNT/* +_unmount_flakey +_directory_test +_clean_working_dir +_rename_test +_clean_working_dir +_replay_rename_test + status=0 exit diff --git a/tests/generic/311.out b/tests/generic/311.out index 5bad6a7..8a0d5c8 100644 --- a/tests/generic/311.out +++ b/tests/generic/311.out @@ -319,3 +319,11 @@ Running test 20 direct, nolockfs Random seed is 20 a16ac2b84456d41a15a1a4cc1202179f a16ac2b84456d41a15a1a4cc1202179f +fsync new directory +drwxr-xr-x bar +rename fsync test +drwxr-xr-x bar +-rw-r--r-- foo +replay rename fsync test +drwxr-xr-x bar +-rw-r--r-- foo -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 7/8] xfstests: btrfs/017: add a regression test for snapshot creation
We had a regression where you couldn''t snapshot a file system if you mounted it ro and then remounted it rw. This is a test that does just that to make sure we don''t have this problem again. I ran the test without the fix and it blew up, and then applied the fix and verified that it passed. Thanks, Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- tests/btrfs/017 | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/017.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 64 insertions(+) create mode 100644 tests/btrfs/017 create mode 100644 tests/btrfs/017.out diff --git a/tests/btrfs/017 b/tests/btrfs/017 new file mode 100644 index 0000000..d45f32a --- /dev/null +++ b/tests/btrfs/017 @@ -0,0 +1,61 @@ +#! /bin/bash +# FS QA Test No. btrfs/017 +# +# Regression test to make sure we can create a snapshot after mounting with +# readonly and remounting rw. +# +#----------------------------------------------------------------------- +# Copyright (c) 2013 Fusion IO. 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! + +_cleanup() +{ + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +rm -f $seqres.full + +_scratch_mkfs > /dev/null 2>&1 +_scratch_mount -o ro +_scratch_mount -o rw,remount + +$BTRFS_UTIL_PROG sub snap $SCRATCH_MNT $SCRATCH_MNT/snap >> $seqres.full 2>&1 \ + || _fail "couldn''t create snapshot" + +echo "Silence is golden" +status=0 ; exit diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out new file mode 100644 index 0000000..8222844 --- /dev/null +++ b/tests/btrfs/017.out @@ -0,0 +1,2 @@ +QA output created by 017 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index 082fd67..be9476d 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -19,3 +19,4 @@ 014 auto 015 auto quick 016 auto quick +017 auto quick -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Josef Bacik
2013-Oct-18 18:26 UTC
[PATCH 8/8] xfstests: btrfs/018: a regression test for subvolume rename
A user reported a regression where we could no longer rename a subvolume into another subvolume. This is a test case to do just that to make sure we don''t regress on this again. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- tests/btrfs/018 | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/018.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 64 insertions(+) create mode 100644 tests/btrfs/018 create mode 100644 tests/btrfs/018.out diff --git a/tests/btrfs/018 b/tests/btrfs/018 new file mode 100644 index 0000000..de7a793 --- /dev/null +++ b/tests/btrfs/018 @@ -0,0 +1,61 @@ +#! /bin/bash +# FS QA Test No. btrfs/018 +# +# Regression test to make sure we can move a subvol into another subvol +# +#----------------------------------------------------------------------- +# Copyright (c) 2013 Fusion IO. 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! + +_cleanup() +{ + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +rm -f $seqres.full + +_scratch_mkfs > /dev/null 2>&1 +_scratch_mount +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/test1 >> $seqres.full 2>&1 \ + || _fail "couldn''t create test1" +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \ + || _fail "couldn''t create test1" +mv $SCRATCH_MNT/test1 $SCRATCH_MNT/test2 || _fail "Problem doing move" + +echo "Silence is golden" +status=0 ; exit diff --git a/tests/btrfs/018.out b/tests/btrfs/018.out new file mode 100644 index 0000000..8849e30 --- /dev/null +++ b/tests/btrfs/018.out @@ -0,0 +1,2 @@ +QA output created by 018 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index be9476d..ed564b2 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -20,3 +20,4 @@ 015 auto quick 016 auto quick 017 auto quick +018 auto quick -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Eric Sandeen
2013-Oct-21 15:03 UTC
Re: [PATCH 2/8] xfstests: add regression test for kernel bz 60673
On 10/18/13 1:26 PM, Josef Bacik wrote:> There was a problem with send trying to overwrite a file that wasn''t actually > the same. This is a test to check this particular case where receive fails when > it should succeed properly. I tested this to verify it fails without my fix and > passes with my fix. Thanks,2 things - Why does the selinux context break things? That seems like a problem w/ send if it can''t work on a context-mounted fs? (disabling it for now doesn''t bother me, but I''m surprised that it''s required). ((I also wonder if I should get rid of that context in general and use it only for tests which fail without it)) Rather than all the cd''ing around (to /) what if you just do something like: SEND_TEST_DIR=$TEST_DIR/$tmp_dir/send mkdir $SEND_TEST_DIR touch $SEND_TEST_DIR/baz touch $SEND_TEST_DIR/blah mkdir $SEND_TEST_DIR/foo touch $SEND_TEST_DIR/foo/bar that seems a bit cleaner to me vs. the cd back and forth. -Eric> Signed-off-by: Josef Bacik <jbacik@fusionio.com> > --- > tests/btrfs/015 | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/btrfs/015.out | 2 + > tests/btrfs/group | 1 + > 3 files changed, 113 insertions(+) > create mode 100644 tests/btrfs/015 > create mode 100644 tests/btrfs/015.out > > diff --git a/tests/btrfs/015 b/tests/btrfs/015 > new file mode 100644 > index 0000000..f35600f > --- /dev/null > +++ b/tests/btrfs/015 > @@ -0,0 +1,110 @@ > +#! /bin/bash > +# FS QA Test No. btrfs/015 > +# > +# btrfs send ENOENT regression test, kernel bugzilla 60673 > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2013 Fusion IO. 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/$$ > +tmp_dir=send_temp_$seq > + > +status=1 # failure is the default! > + > +_cleanup() > +{ > + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap1 > /dev/null 2>&1 > + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap2 > /dev/null 2>&1 > + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/send > /dev/null 2>&1 > + rm -rf $TEST_DIR/$tmp_dir > + rm -f $tmp.* > +} > + > +trap "_cleanup ; exit \$status" 0 1 2 3 15 > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > + > +# real QA test starts here > +_supported_fs btrfs > +_supported_os Linux > +_require_scratch > + > +_scratch_mkfs > /dev/null 2>&1 > + > +#receive needs to be able to setxattrs, including the selinux context, if we use > +#the normal nfs context thing it screws up our ability to set the > +#security.selinux xattrs so we need to disable this for this test > +export SELINUX_MOUNT_OPTIONS="" > + > +_scratch_mount > + > +mkdir $TEST_DIR/$tmp_dir > +$BTRFS_UTIL_PROG subvol create $TEST_DIR/$tmp_dir/send \ > + > $seqres.full 2>&1 || _fail "failed subvol create" > + > +cd $TEST_DIR/$tmp_dir/send > + > +mkdir test > +touch test/baz > +touch test/blah > +mkdir test/foo > +touch test/foo/bar > + > +# cd out in case any of this fails > +cd / > + > +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ > + $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed snap1" > + > +$BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send1.dump \ > + $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed send" > + > +$BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send1.dump $SCRATCH_MNT \ > + >> $seqres.full 2>&1 || _fail "failed receive" > + > +#recreate everything exactly the way it was exceptn in a different order so we > +#get different inode numbers > +cd $TEST_DIR/$tmp_dir/send > +rm -rf test > +mkdir test > +touch test/baz > +mkdir test/foo > +touch test/foo/bar > +touch test/blah > +cd / > + > +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ > + $TEST_DIR/$tmp_dir/snap2 >> $seqres.full 2>&1 || _fail "failed snap2" > + > +$BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send2.dump \ > + $TEST_DIR/$tmp_dir/snap2 -p $TEST_DIR/$tmp_dir/snap1 \ > + >> $seqres.full 2>&1 || _fail "failed second send" > + > +$BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send2.dump $SCRATCH_MNT \ > + >> $seqres.full 2>&1 || _fail "failed second receive" > + > +echo "Silence is golden" > +status=0 ; exit > diff --git a/tests/btrfs/015.out b/tests/btrfs/015.out > new file mode 100644 > index 0000000..fee0fcf > --- /dev/null > +++ b/tests/btrfs/015.out > @@ -0,0 +1,2 @@ > +QA output created by 015 > +Silence is golden > diff --git a/tests/btrfs/group b/tests/btrfs/group > index 07df957..a6f1820 100644 > --- a/tests/btrfs/group > +++ b/tests/btrfs/group > @@ -17,3 +17,4 @@ > 012 auto > 013 auto quick > 014 auto > +015 auto quick >-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Eric Sandeen
2013-Oct-21 15:07 UTC
Re: [PATCH 3/8] xfstests: stat the dev we''re removing to make sure its'' really gone V2
On 10/18/13 1:26 PM, Josef Bacik wrote:> I''ve been periodically failing btrfs/003 because my box sometimes takes a little > longer to unregister the device when we remove it and so the output from btrfs > dev show doesn''t match what we are wanting since it still sees the device. To > fix this just stat and sleep if we still see the device node and only continue > once udev or whatever actually removes the device node so that we don''t get > random failures. Thanks, > > Signed-off-by: Josef Bacik <jbacik@fusionio.com> > --- > V1->V2: Take Eric''s suggestion to do this in the helper function > > common/rc | 9 +++++++++ > tests/btrfs/003 | 2 +- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/common/rc b/common/rc > index b253948..253bd05 100644 > --- a/common/rc > +++ b/common/rc > @@ -2093,7 +2093,16 @@ _require_freeze() > # ls -l /sys/class/block/sdd | rev | cut -d "/" -f 3 | rev > _devmgt_remove() > { > + local h=$1$h is never used? You use ${1} directly below. Is that intentional? (Not sure if you just meant to eat $1 or if you forgot to replace it in the echo string). (if you respin, maybe give "$h" a more meaningful name?) -Eric> + local disk=$2 > + > echo 1 > /sys/class/scsi_device/${1}/device/delete || _fail "Remove disk failed" > + > + stat $disk > /dev/null 2>&1 > + while [ $? -eq 0 ]; do > + sleep 1 > + stat $disk > /dev/null 2>&1 > + done > } > > # arg 1 is dev to add and is output of the below eg. > diff --git a/tests/btrfs/003 b/tests/btrfs/003 > index 262b1d5..15c2cc7 100755 > --- a/tests/btrfs/003 > +++ b/tests/btrfs/003 > @@ -142,7 +142,7 @@ _test_replace() > DEVHTL=`ls -l /sys/class/block/${d} | rev | cut -d "/" -f 3 | rev` > > #fail disk > - _devmgt_remove ${DEVHTL} > + _devmgt_remove ${DEVHTL} $ds > dev_removed=1 > > $BTRFS_UTIL_PROG fi show $SCRATCH_DEV | grep "Some devices missing" >> $seqres.full || _fail \ >_______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Josef Bacik
2013-Oct-21 15:09 UTC
Re: [PATCH 2/8] xfstests: add regression test for kernel bz 60673
On Mon, Oct 21, 2013 at 10:03:10AM -0500, Eric Sandeen wrote:> On 10/18/13 1:26 PM, Josef Bacik wrote: > > There was a problem with send trying to overwrite a file that wasn''t actually > > the same. This is a test to check this particular case where receive fails when > > it should succeed properly. I tested this to verify it fails without my fix and > > passes with my fix. Thanks, > > 2 things - > > Why does the selinux context break things? That seems like a problem w/ send > if it can''t work on a context-mounted fs? (disabling it for now doesn''t bother > me, but I''m surprised that it''s required). >So it is the context that xfstests is using, not contexts itself. Xfstests is using the nfs context, and using selinux contexts intercepts all getxattr calls, so when send tries to copy the xattrs for the file it calls getxattr, and because we are using the nfs context it returns EOPNOTSUPP from selinux, it never makes it down to btrfs. When using the actual real context it works fine because it calls down into the file system.> ((I also wonder if I should get rid of that context in general and use it only > for tests which fail without it)) > > Rather than all the cd''ing around (to /) what if you just do something like: > > SEND_TEST_DIR=$TEST_DIR/$tmp_dir/send > > mkdir $SEND_TEST_DIR > touch $SEND_TEST_DIR/baz > touch $SEND_TEST_DIR/blah > mkdir $SEND_TEST_DIR/foo > touch $SEND_TEST_DIR/foo/bar > > that seems a bit cleaner to me vs. the cd back and forth. >Yeah I can do that, thanks, Josef -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Josef Bacik
2013-Oct-21 15:10 UTC
Re: [PATCH 3/8] xfstests: stat the dev we''re removing to make sure its'' really gone V2
On Mon, Oct 21, 2013 at 10:07:21AM -0500, Eric Sandeen wrote:> On 10/18/13 1:26 PM, Josef Bacik wrote: > > I''ve been periodically failing btrfs/003 because my box sometimes takes a little > > longer to unregister the device when we remove it and so the output from btrfs > > dev show doesn''t match what we are wanting since it still sees the device. To > > fix this just stat and sleep if we still see the device node and only continue > > once udev or whatever actually removes the device node so that we don''t get > > random failures. Thanks, > > > > Signed-off-by: Josef Bacik <jbacik@fusionio.com> > > --- > > V1->V2: Take Eric''s suggestion to do this in the helper function > > > > common/rc | 9 +++++++++ > > tests/btrfs/003 | 2 +- > > 2 files changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/common/rc b/common/rc > > index b253948..253bd05 100644 > > --- a/common/rc > > +++ b/common/rc > > @@ -2093,7 +2093,16 @@ _require_freeze() > > # ls -l /sys/class/block/sdd | rev | cut -d "/" -f 3 | rev > > _devmgt_remove() > > { > > + local h=$1 > > $h is never used? You use ${1} directly below. Is that intentional? > (Not sure if you just meant to eat $1 or if you forgot to replace it > in the echo string). > > (if you respin, maybe give "$h" a more meaningful name?) >Yeah I screwed up, I''ll respin. Thanks, Josef -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Eric Sandeen
2013-Oct-21 15:14 UTC
Re: [PATCH 2/8] xfstests: add regression test for kernel bz 60673
On 10/21/13 10:09 AM, Josef Bacik wrote:> On Mon, Oct 21, 2013 at 10:03:10AM -0500, Eric Sandeen wrote: >> > On 10/18/13 1:26 PM, Josef Bacik wrote: >>> > > There was a problem with send trying to overwrite a file that wasn''t actually >>> > > the same. This is a test to check this particular case where receive fails when >>> > > it should succeed properly. I tested this to verify it fails without my fix and >>> > > passes with my fix. Thanks, >> > >> > 2 things - >> > >> > Why does the selinux context break things? That seems like a problem w/ send >> > if it can''t work on a context-mounted fs? (disabling it for now doesn''t bother >> > me, but I''m surprised that it''s required). >> > > So it is the context that xfstests is using, not contexts itself. Xfstests is > using the nfs context, and using selinux contexts intercepts all getxattr calls, > so when send tries to copy the xattrs for the file it calls getxattr, and > because we are using the nfs context it returns EOPNOTSUPP from selinux, it > never makes it down to btrfs. When using the actual real context it works fine > because it calls down into the file system. >This still sounds weird. Is btrfs send trying to copy the selinux attrs directly? Shouldn''t they be skipped, and be left up to the receiving end to set the selinux xattrs (or not) per the policy for the destination? -Eric _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Eric Sandeen
2013-Oct-21 15:21 UTC
Re: [PATCH 2/8] xfstests: add regression test for kernel bz 60673
On 10/21/13 10:14 AM, Eric Sandeen wrote:> On 10/21/13 10:09 AM, Josef Bacik wrote: >> On Mon, Oct 21, 2013 at 10:03:10AM -0500, Eric Sandeen wrote: >>>> On 10/18/13 1:26 PM, Josef Bacik wrote: >>>>>> There was a problem with send trying to overwrite a file that wasn''t actually >>>>>> the same. This is a test to check this particular case where receive fails when >>>>>> it should succeed properly. I tested this to verify it fails without my fix and >>>>>> passes with my fix. Thanks, >>>> >>>> 2 things - >>>> >>>> Why does the selinux context break things? That seems like a problem w/ send >>>> if it can''t work on a context-mounted fs? (disabling it for now doesn''t bother >>>> me, but I''m surprised that it''s required). >>>> >> So it is the context that xfstests is using, not contexts itself. Xfstests is >> using the nfs context, and using selinux contexts intercepts all getxattr calls, >> so when send tries to copy the xattrs for the file it calls getxattr, and >> because we are using the nfs context it returns EOPNOTSUPP from selinux, it >> never makes it down to btrfs. When using the actual real context it works fine >> because it calls down into the file system. >> > > This still sounds weird. Is btrfs send trying to copy the selinux attrs directly? > > Shouldn''t they be skipped, and be left up to the receiving end to set the selinux > xattrs (or not) per the policy for the destination?Eh, ok, Josef pointed out that "cp -a" does exactly the same thing. So I''ll retract the concern & go learn more about selinux. ;) -Eric -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Eric Sandeen
2013-Oct-21 15:22 UTC
Re: [PATCH 4/8] xfstests: btrfs/016: a hole punching send test
On 10/18/13 1:26 PM, Josef Bacik wrote:> I recently added a patch to avoid sending holes with btrfs send, but I screwed > it up by not sending a hole when we did a hole punch. This is an xfstest > version of the test I wrote to show that I had a bug and to verify I was fixing > it properly. This test properly fails with my old patch and passes with my good > patch. Thanks, > > Signed-off-by: Josef Bacik <jbacik@fusionio.com>Reviewed-by: Eric Sandeen <sandeen@redhat.com>> --- > tests/btrfs/016 | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/btrfs/016.out | 2 ++ > tests/btrfs/group | 1 + > 3 files changed, 103 insertions(+) > create mode 100644 tests/btrfs/016 > create mode 100644 tests/btrfs/016.out > > diff --git a/tests/btrfs/016 b/tests/btrfs/016 > new file mode 100644 > index 0000000..d711ecb > --- /dev/null > +++ b/tests/btrfs/016 > @@ -0,0 +1,100 @@ > +#! /bin/bash > +# FS QA Test No. btrfs/016 > +# > +# btrfs send hole punch test > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2013 Fusion IO. 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=`mktemp -d` > +tmp_dir=send_temp_$seq > + > +status=1 # failure is the default! > + > +_cleanup() > +{ > + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap > /dev/null 2>&1 > + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap1 > /dev/null 2>&1 > + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/send > /dev/null 2>&1 > + rm -rf $TEST_DIR/$tmp_dir > + rm -f $tmp.* > +} > + > +trap "_cleanup ; exit \$status" 0 1 2 3 15 > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > + > +# real QA test starts here > +_supported_fs btrfs > +_supported_os Linux > +_require_scratch > + > +FSSUM_PROG=$here/src/fssum > +[ -x $FSSUM_PROG ] || _notrun "fssum not built" > + > +_scratch_mkfs > /dev/null 2>&1 > + > +#receive needs to be able to setxattrs, including the selinux context, if we use > +#the normal nfs context thing it screws up our ability to set the > +#security.selinux xattrs so we need to disable this for this test > +export SELINUX_MOUNT_OPTIONS="" > + > +_scratch_mount > + > +mkdir $TEST_DIR/$tmp_dir > +$BTRFS_UTIL_PROG subvol create $TEST_DIR/$tmp_dir/send \ > + > $seqres.full 2>&1 || _fail "failed subvol create" > + > +dd if=/dev/urandom of=$TEST_DIR/$tmp_dir/send/foo bs=1M count=10 >> $seqres.full \ > + 2>&1 || _fail "dd failed" > +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ > + $TEST_DIR/$tmp_dir/snap >> $seqres.full 2>&1 || _fail "failed snap" > +$XFS_IO_PROG -c "fpunch 1m 1m" $TEST_DIR/$tmp_dir/send/foo > +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ > + $TEST_DIR/$tmp_dir/snap1 >> $seqres.full 2>&1 || _fail "failed snap" > + > +$FSSUM_PROG -A -f -w $tmp/fssum.snap $TEST_DIR/$tmp_dir/snap >> $seqres.full \ > + 2>&1 || _fail "fssum gen failed" > +$FSSUM_PROG -A -f -w $tmp/fssum.snap1 $TEST_DIR/$tmp_dir/snap1 >> $seqres.full \ > + 2>&1 || _fail "fssum gen failed" > + > +$BTRFS_UTIL_PROG send $TEST_DIR/$tmp_dir/snap -f $tmp/send.snap >> \ > + $seqres.full 2>&1 || _fail "failed send" > +$BTRFS_UTIL_PROG send $TEST_DIR/$tmp_dir/snap1 -p $TEST_DIR/$tmp_dir/snap \ > + -f $tmp/send.snap1 >> $seqres.full 2>&1 || _fail "failed send" > + > +$BTRFS_UTIL_PROG receive -f $tmp/send.snap $SCRATCH_MNT >> $seqres.full 2>&1 \ > + || _fail "failed recv" > +$BTRFS_UTIL_PROG receive -f $tmp/send.snap1 $SCRATCH_MNT >> $seqres.full 2>&1 \ > + || _fail "failed recv" > + > +$FSSUM_PROG -r $tmp/fssum.snap $SCRATCH_MNT/snap >> $seqres.full 2>&1 \ > + || _fail "fssum failed" > +$FSSUM_PROG -r $tmp/fssum.snap1 $SCRATCH_MNT/snap1 >> $seqres.full 2>&1 \ > + || _fail "fssum failed" > + > +echo "Silence is golden" > +status=0 ; exit > diff --git a/tests/btrfs/016.out b/tests/btrfs/016.out > new file mode 100644 > index 0000000..aa2526b > --- /dev/null > +++ b/tests/btrfs/016.out > @@ -0,0 +1,2 @@ > +QA output created by 016 > +Silence is golden > diff --git a/tests/btrfs/group b/tests/btrfs/group > index a6f1820..082fd67 100644 > --- a/tests/btrfs/group > +++ b/tests/btrfs/group > @@ -18,3 +18,4 @@ > 013 auto quick > 014 auto > 015 auto quick > +016 auto quick >_______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Eric Sandeen
2013-Oct-21 15:29 UTC
Re: [PATCH 5/8] xfstests: generic/274 increase scratch fs size to 2g
On 10/18/13 1:26 PM, Josef Bacik wrote:> With 1 gig btrfs defaults to mixed block groups, so we ENOSPC in this test > because we run out of metadata space, not data space. Increasing to 2g allows > us to use our normal setup and allows us to pass this test. Thanks, > > Signed-off-by: Josef Bacik <jbacik@fusionio.com>Doubles the test time on xfs, but from 16s to 30s on a single spindle sata disk; I think we can handle it. ext4 fails w/ or w/o the patch, so *shrug* Reviewed-by: Eric Sandeen <sandeen@redhat.com>> --- > tests/generic/274 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/generic/274 b/tests/generic/274 > index da45fab..7c4887f 100755 > --- a/tests/generic/274 > +++ b/tests/generic/274 > @@ -57,7 +57,7 @@ echo "------------------------------" > rm -f $seqres.full > > umount $SCRATCH_DEV 2>/dev/null > -_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1 > +_scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1 > _scratch_mount > > # Create a 4k file and Allocate 4M past EOF on that file >_______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Eric Sandeen
2013-Oct-21 15:37 UTC
Re: [PATCH 6/8] xfstests: generic/311: add a few more test cases
On 10/18/13 1:26 PM, Josef Bacik wrote:> Btrfs had some issues with fsync()''ing directories and fsync()''ing after > renames. These three new tests cover the 3 different issues we were seeing. > Thanks, > > Signed-off-by: Josef Bacik <jbacik@fusionio.com>I''d prefer that you copy 311 to a new test w/ just this case. Adding potentially-failing new cases to old tests makes it harder to keep track of when/if/how/what code regressed... -Eric> --- > tests/generic/311 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++-- > tests/generic/311.out | 8 +++++ > 2 files changed, 95 insertions(+), 2 deletions(-) > > diff --git a/tests/generic/311 b/tests/generic/311 > index 675d927..002ad57 100644 > --- a/tests/generic/311 > +++ b/tests/generic/311 > @@ -70,6 +70,8 @@ testfile=$SCRATCH_MNT/$seq.fsync > FLAKEY_TABLE="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 180 0" > FLAKEY_TABLE_DROP="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 0 180 1 drop_writes" > _TEST_OPTIONS="" > +allow_writes=0 > +drop_writes=1 > > _mount_flakey() > { > @@ -104,8 +106,6 @@ _load_flakey_table() > _run_test() > { > # _run_test <testnum> <0 - buffered | 1 - O_DIRECT> > - allow_writes=0 > - drop_writes=1 > test_num=$1 > > direct_opt="" > @@ -131,6 +131,83 @@ _run_test() > _mount_flakey > } > > +_clean_working_dir() > +{ > + _mount_flakey > + rm -rf $SCRATCH_MNT/* > + _unmount_flakey > +} > + > +# Btrfs wasn''t making sure the directory survived fsync > +_directory_test() > +{ > + echo "fsync new directory" > + _mount_flakey > + mkdir $SCRATCH_MNT/bar > + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar > + _load_flakey_table $drop_writes > + _unmount_flakey > + > + _load_flakey_table $allow_writes > + _mount_flakey > + _ls_l $SCRATCH_MNT | tail -n +2 | awk ''{ print $1, $9 }'' > + _unmount_flakey > + _check_scratch_fs $FLAKEY_DEV > + [ $? -ne 0 ] && _fatal "fsck failed" > +} > + > +# Btrfs was losing a rename into a new directory > +_rename_test() > +{ > + echo "rename fsync test" > + _mount_flakey > + touch $SCRATCH_MNT/foo > + mkdir $SCRATCH_MNT/bar > + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo > + mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar/foo > + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar > + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar/foo > + _load_flakey_table $drop_writes > + _unmount_flakey > + > + _load_flakey_table $allow_writes > + _mount_flakey > + _ls_l $SCRATCH_MNT | tail -n +2 | awk ''{ print $1, $9 }'' > + _ls_l $SCRATCH_MNT/bar | tail -n +2 | awk ''{ print $1, $9 }'' > + _unmount_flakey > + _check_scratch_fs $FLAKEY_DEV > + [ $? -ne 0 ] && _fatal "fsck failed" > +} > + > +# Btrfs was failing to replay a log when we had a inode with a smaller inode > +# number that is renamed into a directory with a higher inode number > +_replay_rename_test() > +{ > + echo "replay rename fsync test" > + _mount_flakey > + touch $SCRATCH_MNT/foo > + mkdir $SCRATCH_MNT/bar > + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo > + mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar/foo > + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar > + > + # This is to force btrfs to relog the entire inode including the ref so > + # we are sure to try and replay the ref along with the dir_index item > + setfattr -n user.foo -v blah $SCRATCH_MNT/bar/foo >> $seqres.full 2>&1 > + > + $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar/foo > + _load_flakey_table $drop_writes > + _unmount_flakey > + > + _load_flakey_table $allow_writes > + _mount_flakey > + _ls_l $SCRATCH_MNT | tail -n +2 | awk ''{ print $1, $9 }'' > + _ls_l $SCRATCH_MNT/bar | tail -n +2 | awk ''{ print $1, $9 }'' > + _unmount_flakey > + _check_scratch_fs $FLAKEY_DEV > + [ $? -ne 0 ] && _fatal "fsck failed" > +} > + > _scratch_mkfs >> $seqres.full 2>&1 > > # Create a basic flakey device that will never error out > @@ -157,5 +234,13 @@ for i in $(seq 1 20); do > _run_test $i $direct > done > > +rm -rf $SCRATCH_MNT/* > +_unmount_flakey > +_directory_test > +_clean_working_dir > +_rename_test > +_clean_working_dir > +_replay_rename_test > + > status=0 > exit > diff --git a/tests/generic/311.out b/tests/generic/311.out > index 5bad6a7..8a0d5c8 100644 > --- a/tests/generic/311.out > +++ b/tests/generic/311.out > @@ -319,3 +319,11 @@ Running test 20 direct, nolockfs > Random seed is 20 > a16ac2b84456d41a15a1a4cc1202179f > a16ac2b84456d41a15a1a4cc1202179f > +fsync new directory > +drwxr-xr-x bar > +rename fsync test > +drwxr-xr-x bar > +-rw-r--r-- foo > +replay rename fsync test > +drwxr-xr-x bar > +-rw-r--r-- foo >_______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Eric Sandeen
2013-Oct-21 15:38 UTC
Re: [PATCH 8/8] xfstests: btrfs/018: a regression test for subvolume rename
On 10/18/13 1:26 PM, Josef Bacik wrote:> A user reported a regression where we could no longer rename a subvolume into > another subvolume. This is a test case to do just that to make sure we don''t > regress on this again. Thanks, > > Signed-off-by: Josef Bacik <jbacik@fusionio.com>Reviewed-by: Eric Sandeen <sandeen@redhat.com>> --- > tests/btrfs/018 | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/btrfs/018.out | 2 ++ > tests/btrfs/group | 1 + > 3 files changed, 64 insertions(+) > create mode 100644 tests/btrfs/018 > create mode 100644 tests/btrfs/018.out > > diff --git a/tests/btrfs/018 b/tests/btrfs/018 > new file mode 100644 > index 0000000..de7a793 > --- /dev/null > +++ b/tests/btrfs/018 > @@ -0,0 +1,61 @@ > +#! /bin/bash > +# FS QA Test No. btrfs/018 > +# > +# Regression test to make sure we can move a subvol into another subvol > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2013 Fusion IO. 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! > + > +_cleanup() > +{ > + rm -f $tmp.* > +} > + > +trap "_cleanup ; exit \$status" 0 1 2 3 15 > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > + > +# real QA test starts here > +_supported_fs btrfs > +_supported_os Linux > +_require_scratch > + > +rm -f $seqres.full > + > +_scratch_mkfs > /dev/null 2>&1 > +_scratch_mount > +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/test1 >> $seqres.full 2>&1 \ > + || _fail "couldn''t create test1" > +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \ > + || _fail "couldn''t create test1" > +mv $SCRATCH_MNT/test1 $SCRATCH_MNT/test2 || _fail "Problem doing move" > + > +echo "Silence is golden" > +status=0 ; exit > diff --git a/tests/btrfs/018.out b/tests/btrfs/018.out > new file mode 100644 > index 0000000..8849e30 > --- /dev/null > +++ b/tests/btrfs/018.out > @@ -0,0 +1,2 @@ > +QA output created by 018 > +Silence is golden > diff --git a/tests/btrfs/group b/tests/btrfs/group > index be9476d..ed564b2 100644 > --- a/tests/btrfs/group > +++ b/tests/btrfs/group > @@ -20,3 +20,4 @@ > 015 auto quick > 016 auto quick > 017 auto quick > +018 auto quick >_______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Rich Johnston
2013-Oct-22 20:25 UTC
Re: [PATCH 5/8] xfstests: generic/274 increase scratch fs size to 2g
Patch does not apply, already committed. Thanks --Rich commit 859f127da2ee6d49faa41cafd4ed362aa526e4a0 Author: Josef Bacik <jbacik@fusionio.com> Date: Fri Jun 21 20:31:10 2013 +0000 xfstests: make fs for 274 larger Btrfs will default to mixed block groups for 1 gigabyte file systems and smaller, which means data and metadata share the same area. This makes generic/274 fail for us because we cannot reserve enough metadata space to do our writes. Bumping the scratch fs up to 2 gigabytes allows us to do our normal metadata/data separation and allows us to pass this test. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Rich Johnston <rjohnston@sgi.com> diff --git a/tests/generic/274 b/tests/generic/274 index da45fab..7c4887f 100755 --- a/tests/generic/274 +++ b/tests/generic/274 @@ -57,7 +57,7 @@ echo "------------------------------" rm -f $seqres.full umount $SCRATCH_DEV 2>/dev/null -_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1 +_scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1 _scratch_mount # Create a 4k file and Allocate 4M past EOF on that file _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Rich Johnston
2013-Oct-22 20:57 UTC
Re: [PATCH 1/8] xfstests: fix btrfs/002 to not use the scratch dev pool
This patch has been committed. Thanks --Rich commit 122fba38be096e63d15e31d45372a1e344fa67b5 Author: Josef Bacik <jbacik@fusionio.com> Date: Fri Oct 18 18:26:23 2013 +0000 xfstests: fix btrfs/002 to not use the scratch dev pool _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Rich Johnston
2013-Oct-22 21:02 UTC
Re: [PATCH 4/8] xfstests: btrfs/016: a hole punching send test
This has been committed. Thanks --Rich commit 231e18b343d25d2112504f48addeb3ba6bd502c3 Author: Josef Bacik <jbacik@fusionio.com> Date: Fri Oct 18 18:26:26 2013 +0000 xfstests: btrfs/016: a hole punching send test _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Rich Johnston
2013-Oct-22 21:06 UTC
Re: [PATCH 7/8] xfstests: btrfs/017: add a regression test for snapshot creation
This has been committed. Thanks --Rich commit 9d867b7e625690f03c73407923ae90caa7401abd Author: Josef Bacik <jbacik@fusionio.com> Date: Fri Oct 18 18:26:29 2013 +0000 xfstests: btrfs/017: add a regression test for snapshot creation _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
Rich Johnston
2013-Oct-22 21:09 UTC
Re: [PATCH 8/8] xfstests: btrfs/018: a regression test for subvolume rename
This has been committed. Thanks --Rich commit 09320abafa8d35105b36596f8400abf45ad59870 Author: Josef Bacik <jbacik@fusionio.com> Date: Fri Oct 18 18:26:30 2013 +0000 xfstests: btrfs/018: a regression test for subvolume rename _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs