* [PATCH v2 1/4] xfstests: btrfs/131: add test for an incremental send with name collision
2016-10-28 1:44 [PATCH v2 0/4] Btrfs: add serval test case for incremental send robbieko
@ 2016-10-28 1:44 ` robbieko
2016-11-01 7:17 ` Eryu Guan
2016-10-28 1:44 ` [PATCH v2 2/4] xfstests: btrfs/132: add test for invaild update time by an incremental send robbieko
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: robbieko @ 2016-10-28 1:44 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Robbie Ko
From: Robbie Ko <robbieko@synology.com>
Test that an incremental send operation doesn't work because
there's a name collision in the destination and it's not checked
corretly before the rename operation applies.
This test exercises scenarios used to fail in btrfs and are fixed by
the following patch for the linux kernel:
"Btrfs: incremental send, do not skip generation inconsistency check for inode 256."
Signed-off-by: Robbie Ko <robbieko@synology.com>
---
tests/btrfs/131 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/131.out | 2 +
tests/btrfs/group | 1 +
3 files changed, 114 insertions(+)
create mode 100755 tests/btrfs/131
create mode 100644 tests/btrfs/131.out
diff --git a/tests/btrfs/131 b/tests/btrfs/131
new file mode 100755
index 0000000..2e2e0bc
--- /dev/null
+++ b/tests/btrfs/131
@@ -0,0 +1,111 @@
+#! /bin/bash
+# FS QA Test No. btrfs/131
+#
+# Test that an incremental send operation doesn't work because
+# there's a name collision in the destination and it's not checked
+# corretly before the rename operation applies.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2016 Synology Inc. All Rights Reserved.
+# Author: Robbie Ko <robbieko@synology.com>
+#
+# 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"
+
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -fr $send_files_dir
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_test
+_require_scratch
+_require_fssum
+
+send_files_dir=$TEST_DIR/btrfs-test-$seq
+
+rm -f $seqres.full
+rm -fr $send_files_dir
+mkdir $send_files_dir
+
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+mkdir $SCRATCH_MNT/a1
+mkdir $SCRATCH_MNT/a2
+
+# Filesystem looks like:
+#
+# . (ino 256)
+# |--- a1/ (ino 257)
+# |
+# |--- a2/ (ino 258)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
+
+_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
+
+_scratch_unmount
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+touch $SCRATCH_MNT/a2
+
+# Filesystem now looks like:
+#
+# . (ino 256)
+# |--- a2 (ino 257)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
+
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
+rm $send_files_dir/1.snap
+
+run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+run_check $FSSUM_PROG -A -f -w $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
+
+_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
+_run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
+ -f $send_files_dir/2.snap
+
+# Now recreate the filesystem by receiving both send streams and verify we get
+# the same content that the original filesystem had.
+_scratch_unmount
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
+run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
+run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
new file mode 100644
index 0000000..d118ca9
--- /dev/null
+++ b/tests/btrfs/131.out
@@ -0,0 +1,2 @@
+QA output created by 131
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index f3a7a4f..a7a070a 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -133,3 +133,4 @@
128 auto quick send
129 auto quick send
130 auto clone send
+131 auto quick send
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 1/4] xfstests: btrfs/131: add test for an incremental send with name collision
2016-10-28 1:44 ` [PATCH v2 1/4] xfstests: btrfs/131: add test for an incremental send with name collision robbieko
@ 2016-11-01 7:17 ` Eryu Guan
2016-11-02 3:40 ` robbieko
0 siblings, 1 reply; 10+ messages in thread
From: Eryu Guan @ 2016-11-01 7:17 UTC (permalink / raw)
To: robbieko; +Cc: fstests, linux-btrfs
On Fri, Oct 28, 2016 at 09:44:03AM +0800, robbieko wrote:
> From: Robbie Ko <robbieko@synology.com>
>
> Test that an incremental send operation doesn't work because
> there's a name collision in the destination and it's not checked
> corretly before the rename operation applies.
>
> This test exercises scenarios used to fail in btrfs and are fixed by
> the following patch for the linux kernel:
>
> "Btrfs: incremental send, do not skip generation inconsistency check for inode 256."
>
> Signed-off-by: Robbie Ko <robbieko@synology.com>
Sorry for the late review!
> ---
> tests/btrfs/131 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/btrfs/131.out | 2 +
> tests/btrfs/group | 1 +
> 3 files changed, 114 insertions(+)
> create mode 100755 tests/btrfs/131
> create mode 100644 tests/btrfs/131.out
>
> diff --git a/tests/btrfs/131 b/tests/btrfs/131
> new file mode 100755
> index 0000000..2e2e0bc
> --- /dev/null
> +++ b/tests/btrfs/131
> @@ -0,0 +1,111 @@
> +#! /bin/bash
> +# FS QA Test No. btrfs/131
> +#
> +# Test that an incremental send operation doesn't work because
> +# there's a name collision in the destination and it's not checked
> +# corretly before the rename operation applies.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (C) 2016 Synology Inc. All Rights Reserved.
> +# Author: Robbie Ko <robbieko@synology.com>
> +#
> +# 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"
> +
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -fr $send_files_dir
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs btrfs
> +_supported_os Linux
> +_require_test
> +_require_scratch
> +_require_fssum
> +
> +send_files_dir=$TEST_DIR/btrfs-test-$seq
> +
> +rm -f $seqres.full
> +rm -fr $send_files_dir
> +mkdir $send_files_dir
> +
> +_scratch_mkfs >>$seqres.full 2>&1
> +_scratch_mount
> +
> +mkdir $SCRATCH_MNT/a1
> +mkdir $SCRATCH_MNT/a2
> +
> +# Filesystem looks like:
> +#
> +# . (ino 256)
> +# |--- a1/ (ino 257)
> +# |
> +# |--- a2/ (ino 258)
> +#
> +_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
> +
> +_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
I found these "run_check" based helpers make the result harder to read
when test failed, I can't see immediate error messages from the diff
output but have to open $seqres.full file to see the details.
Can you please use $BTRFS_UTIL_PROG directly, in all these four tests?
One concern about using bare $BTRFS_UTIL_PROG is that output messages of
btrfs command are always changed. But I think, at least, we can ignore
the stdout and capture the stderr only. e.g.
$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
$SCRATCH_MNT/mysnap1 >/dev/null
So if everything works fine no output can be seen, but if snapshot
creation is failed, we can see error messages from stderr, which could
fail the test.
> +
> +_scratch_unmount
> +_scratch_mkfs >>$seqres.full 2>&1
> +_scratch_mount
> +touch $SCRATCH_MNT/a2
> +
> +# Filesystem now looks like:
> +#
> +# . (ino 256)
> +# |--- a2 (ino 257)
> +#
> +_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
> +
> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
> +rm $send_files_dir/1.snap
> +
> +run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
> +run_check $FSSUM_PROG -A -f -w $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
And this "run_check" is not necessary either. Just run $FSSUM_PROG
directly and let it print "OK", and match it in .out file.
Thanks,
Eryu
> +
> +_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
> +_run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
> + -f $send_files_dir/2.snap
> +
> +# Now recreate the filesystem by receiving both send streams and verify we get
> +# the same content that the original filesystem had.
> +_scratch_unmount
> +_scratch_mkfs >>$seqres.full 2>&1
> +_scratch_mount
> +
> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
> +run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
> +run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
> +
> +echo "Silence is golden"
> +status=0
> +exit
> diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
> new file mode 100644
> index 0000000..d118ca9
> --- /dev/null
> +++ b/tests/btrfs/131.out
> @@ -0,0 +1,2 @@
> +QA output created by 131
> +Silence is golden
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index f3a7a4f..a7a070a 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -133,3 +133,4 @@
> 128 auto quick send
> 129 auto quick send
> 130 auto clone send
> +131 auto quick send
> --
> 1.9.1
>
> --
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v2 1/4] xfstests: btrfs/131: add test for an incremental send with name collision
2016-11-01 7:17 ` Eryu Guan
@ 2016-11-02 3:40 ` robbieko
0 siblings, 0 replies; 10+ messages in thread
From: robbieko @ 2016-11-02 3:40 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests, linux-btrfs
Hi Eryu Guan,
OK, I will modify it.
Thanks.
Robbie Ko
Eryu Guan 於 2016-11-01 15:17 寫到:
> On Fri, Oct 28, 2016 at 09:44:03AM +0800, robbieko wrote:
>> From: Robbie Ko <robbieko@synology.com>
>>
>> Test that an incremental send operation doesn't work because
>> there's a name collision in the destination and it's not checked
>> corretly before the rename operation applies.
>>
>> This test exercises scenarios used to fail in btrfs and are fixed by
>> the following patch for the linux kernel:
>>
>> "Btrfs: incremental send, do not skip generation inconsistency check
>> for inode 256."
>>
>> Signed-off-by: Robbie Ko <robbieko@synology.com>
>
> Sorry for the late review!
>
>> ---
>> tests/btrfs/131 | 111
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>> tests/btrfs/131.out | 2 +
>> tests/btrfs/group | 1 +
>> 3 files changed, 114 insertions(+)
>> create mode 100755 tests/btrfs/131
>> create mode 100644 tests/btrfs/131.out
>>
>> diff --git a/tests/btrfs/131 b/tests/btrfs/131
>> new file mode 100755
>> index 0000000..2e2e0bc
>> --- /dev/null
>> +++ b/tests/btrfs/131
>> @@ -0,0 +1,111 @@
>> +#! /bin/bash
>> +# FS QA Test No. btrfs/131
>> +#
>> +# Test that an incremental send operation doesn't work because
>> +# there's a name collision in the destination and it's not checked
>> +# corretly before the rename operation applies.
>> +#
>> +#-----------------------------------------------------------------------
>> +# Copyright (C) 2016 Synology Inc. All Rights Reserved.
>> +# Author: Robbie Ko <robbieko@synology.com>
>> +#
>> +# 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"
>> +
>> +tmp=/tmp/$$
>> +status=1 # failure is the default!
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> + cd /
>> + rm -fr $send_files_dir
>> + rm -f $tmp.*
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/filter
>> +
>> +# real QA test starts here
>> +_supported_fs btrfs
>> +_supported_os Linux
>> +_require_test
>> +_require_scratch
>> +_require_fssum
>> +
>> +send_files_dir=$TEST_DIR/btrfs-test-$seq
>> +
>> +rm -f $seqres.full
>> +rm -fr $send_files_dir
>> +mkdir $send_files_dir
>> +
>> +_scratch_mkfs >>$seqres.full 2>&1
>> +_scratch_mount
>> +
>> +mkdir $SCRATCH_MNT/a1
>> +mkdir $SCRATCH_MNT/a2
>> +
>> +# Filesystem looks like:
>> +#
>> +# . (ino
>> 256)
>> +# |--- a1/ (ino
>> 257)
>> +# |
>> +# |--- a2/ (ino
>> 258)
>> +#
>> +_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT
>> $SCRATCH_MNT/mysnap1
>> +
>> +_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f
>> $send_files_dir/1.snap
>
> I found these "run_check" based helpers make the result harder to read
> when test failed, I can't see immediate error messages from the diff
> output but have to open $seqres.full file to see the details.
>
> Can you please use $BTRFS_UTIL_PROG directly, in all these four tests?
> One concern about using bare $BTRFS_UTIL_PROG is that output messages
> of
> btrfs command are always changed. But I think, at least, we can ignore
> the stdout and capture the stderr only. e.g.
>
> $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
> $SCRATCH_MNT/mysnap1 >/dev/null
>
> So if everything works fine no output can be seen, but if snapshot
> creation is failed, we can see error messages from stderr, which could
> fail the test.
>
>> +
>> +_scratch_unmount
>> +_scratch_mkfs >>$seqres.full 2>&1
>> +_scratch_mount
>> +touch $SCRATCH_MNT/a2
>> +
>> +# Filesystem now looks like:
>> +#
>> +# . (ino
>> 256)
>> +# |--- a2 (ino
>> 257)
>> +#
>> +_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT
>> $SCRATCH_MNT/mysnap2
>> +
>> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
>> +rm $send_files_dir/1.snap
>> +
>> +run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum
>> $SCRATCH_MNT/mysnap1
>> +run_check $FSSUM_PROG -A -f -w $send_files_dir/2.fssum
>> $SCRATCH_MNT/mysnap2
>
> And this "run_check" is not necessary either. Just run $FSSUM_PROG
> directly and let it print "OK", and match it in .out file.
>
> Thanks,
> Eryu
>
>> +
>> +_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f
>> $send_files_dir/1.snap
>> +_run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1
>> $SCRATCH_MNT/mysnap2 \
>> + -f $send_files_dir/2.snap
>> +
>> +# Now recreate the filesystem by receiving both send streams and
>> verify we get
>> +# the same content that the original filesystem had.
>> +_scratch_unmount
>> +_scratch_mkfs >>$seqres.full 2>&1
>> +_scratch_mount
>> +
>> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
>> +run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
>> +_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
>> +run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
>> +
>> +echo "Silence is golden"
>> +status=0
>> +exit
>> diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
>> new file mode 100644
>> index 0000000..d118ca9
>> --- /dev/null
>> +++ b/tests/btrfs/131.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 131
>> +Silence is golden
>> diff --git a/tests/btrfs/group b/tests/btrfs/group
>> index f3a7a4f..a7a070a 100644
>> --- a/tests/btrfs/group
>> +++ b/tests/btrfs/group
>> @@ -133,3 +133,4 @@
>> 128 auto quick send
>> 129 auto quick send
>> 130 auto clone send
>> +131 auto quick send
>> --
>> 1.9.1
>>
>> --
>> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/4] xfstests: btrfs/132: add test for invaild update time by an incremental send
2016-10-28 1:44 [PATCH v2 0/4] Btrfs: add serval test case for incremental send robbieko
2016-10-28 1:44 ` [PATCH v2 1/4] xfstests: btrfs/131: add test for an incremental send with name collision robbieko
@ 2016-10-28 1:44 ` robbieko
2016-10-28 1:44 ` [PATCH v2 3/4] xfstests: btrfs/133: add test for incremental send with rmdir applied on wrong name robbieko
2016-10-28 1:44 ` [PATCH v2 4/4] xfstests: btrfs/134: add test for incremental send which renames a directory already being deleted robbieko
3 siblings, 0 replies; 10+ messages in thread
From: robbieko @ 2016-10-28 1:44 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Robbie Ko
From: Robbie Ko <robbieko@synology.com>
Test that an incremental send operation dosen't' work because
it tries to update the time to a deleted directory after it finishes
a move operation.
The other one is that an operation is applied to a file using the old
name not the new name.
This test exercises scenarios used to fail in btrfs and are fixed by
the following patches for the linux kernel:
"Btrfs: incremental send, add generation check for the inode waiting for rmdir operation."
"Btrfs: incremental send, add generation check in existence demtermination for the parent directory"
Signed-off-by: Robbie Ko <robbieko@synology.com>
---
tests/btrfs/132 | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/132.out | 2 +
tests/btrfs/group | 1 +
3 files changed, 123 insertions(+)
create mode 100755 tests/btrfs/132
create mode 100644 tests/btrfs/132.out
diff --git a/tests/btrfs/132 b/tests/btrfs/132
new file mode 100755
index 0000000..08687ec
--- /dev/null
+++ b/tests/btrfs/132
@@ -0,0 +1,120 @@
+#! /bin/bash
+# FS QA Test No. btrfs/132
+#
+# Test that an incremental send operation dosen't' work because
+# it tries to update the time to a deleted directory after it finishes
+# a move operation.
+#
+# The other one is that an operation is applied to a file using the old
+# name not the new name.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2016 Synology Inc. All Rights Reserved.
+# Author: Robbie Ko <robbieko@synology.com>
+#
+# 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"
+
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -fr $send_files_dir
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_test
+_require_scratch
+_require_fssum
+
+send_files_dir=$TEST_DIR/btrfs-test-$seq
+
+rm -f $seqres.full
+rm -fr $send_files_dir
+mkdir $send_files_dir
+
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+mkdir $SCRATCH_MNT/dir257
+mkdir $SCRATCH_MNT/dir258
+mkdir $SCRATCH_MNT/dir259
+mv $SCRATCH_MNT/dir257 $SCRATCH_MNT/dir258/dir257
+
+# Filesystem looks like:
+#
+# . (ino 256)
+# |--- dir258/ (ino 258)
+# | |--- dir257/ (ino 257)
+# |
+# |--- dir259/ (ino 259)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
+
+mv $SCRATCH_MNT/dir258/dir257 $SCRATCH_MNT/dir257
+rmdir $SCRATCH_MNT/dir258
+rmdir $SCRATCH_MNT/dir259
+_scratch_unmount
+_scratch_mount
+touch $SCRATCH_MNT/file258
+mkdir $SCRATCH_MNT/new_dir259
+mv $SCRATCH_MNT/dir257 $SCRATCH_MNT/new_dir259/dir257
+
+# Filesystem now looks like:
+#
+# . (ino 256)
+# |--- file258 (ino 258)
+# |
+# |--- new_dir259/ (ino 259)
+# | |--- dir257/ (ino 257)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
+
+run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+run_check $FSSUM_PROG -A -f -w $send_files_dir/2.fssum \
+ -x $SCRATCH_MNT/mysnap2/mysnap1 $SCRATCH_MNT/mysnap2
+
+_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
+_run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
+ -f $send_files_dir/2.snap
+
+# Now recreate the filesystem by receiving both send streams and verify we get
+# the same content that the original filesystem had.
+_scratch_unmount
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
+run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
+run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/132.out b/tests/btrfs/132.out
new file mode 100644
index 0000000..b096312
--- /dev/null
+++ b/tests/btrfs/132.out
@@ -0,0 +1,2 @@
+QA output created by 132
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index a7a070a..1b12382 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -134,3 +134,4 @@
129 auto quick send
130 auto clone send
131 auto quick send
+132 auto quick send
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 3/4] xfstests: btrfs/133: add test for incremental send with rmdir applied on wrong name
2016-10-28 1:44 [PATCH v2 0/4] Btrfs: add serval test case for incremental send robbieko
2016-10-28 1:44 ` [PATCH v2 1/4] xfstests: btrfs/131: add test for an incremental send with name collision robbieko
2016-10-28 1:44 ` [PATCH v2 2/4] xfstests: btrfs/132: add test for invaild update time by an incremental send robbieko
@ 2016-10-28 1:44 ` robbieko
2016-10-28 1:44 ` [PATCH v2 4/4] xfstests: btrfs/134: add test for incremental send which renames a directory already being deleted robbieko
3 siblings, 0 replies; 10+ messages in thread
From: robbieko @ 2016-10-28 1:44 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Robbie Ko
From: Robbie Ko <robbieko@synology.com>
Test that an incremental send operation doesn't work for rmdir
because it uses the wrong name to delete.
This test exercises scenarios used to fail in btrfs and are fixed by
the following patch for the linux kernel:
"Btrfs: incremental send, skip check overwritten if parents' generation are different"
Signed-off-by: Robbie Ko <robbieko@synology.com>
---
tests/btrfs/133 | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/133.out | 2 +
tests/btrfs/group | 1 +
3 files changed, 122 insertions(+)
create mode 100755 tests/btrfs/133
create mode 100644 tests/btrfs/133.out
diff --git a/tests/btrfs/133 b/tests/btrfs/133
new file mode 100755
index 0000000..e516483
--- /dev/null
+++ b/tests/btrfs/133
@@ -0,0 +1,119 @@
+#! /bin/bash
+# FS QA Test No. btrfs/133
+#
+# Test that an incremental send operation doesn't work for rmdir
+# because it uses the wrong name to delete.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2016 Synology Inc. All Rights Reserved.
+# Author: Robbie Ko <robbieko@synology.com>
+#
+# 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"
+
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -fr $send_files_dir
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_test
+_require_scratch
+_require_fssum
+
+send_files_dir=$TEST_DIR/btrfs-test-$seq
+
+rm -f $seqres.full
+rm -fr $send_files_dir
+mkdir $send_files_dir
+
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+touch $SCRATCH_MNT/f
+mkdir $SCRATCH_MNT/d1
+mkdir $SCRATCH_MNT/d259_old
+mv $SCRATCH_MNT/d1 $SCRATCH_MNT/d259_old/d1
+
+# Filesystem looks like:
+#
+# . (ino 256)
+# |--- f (ino 257)
+# |
+# |--- d259_old/ (ino 259)
+# | |--- d1/ (ino 258)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
+
+_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
+
+_scratch_unmount
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+mkdir $SCRATCH_MNT/d1
+mkdir $SCRATCH_MNT/dir258
+mkdir $SCRATCH_MNT/dir259
+mv $SCRATCH_MNT/d1 $SCRATCH_MNT/dir259/d1
+
+# Filesystem now looks like:
+#
+# . (ino 256)
+# |--- dir258 (ino 258)
+# |
+# |--- dir259/ (ino 259)
+# | |--- d1/ (ino 257)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
+
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
+rm $send_files_dir/1.snap
+
+run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+run_check $FSSUM_PROG -A -f -w $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
+
+_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
+_run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
+ -f $send_files_dir/2.snap
+
+# Now recreate the filesystem by receiving both send streams and verify we get
+# the same content that the original filesystem had.
+_scratch_unmount
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
+run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
+run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/133.out b/tests/btrfs/133.out
new file mode 100644
index 0000000..e914d62
--- /dev/null
+++ b/tests/btrfs/133.out
@@ -0,0 +1,2 @@
+QA output created by 133
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 1b12382..779caec 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -135,3 +135,4 @@
130 auto clone send
131 auto quick send
132 auto quick send
+133 auto quick send
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 4/4] xfstests: btrfs/134: add test for incremental send which renames a directory already being deleted
2016-10-28 1:44 [PATCH v2 0/4] Btrfs: add serval test case for incremental send robbieko
` (2 preceding siblings ...)
2016-10-28 1:44 ` [PATCH v2 3/4] xfstests: btrfs/133: add test for incremental send with rmdir applied on wrong name robbieko
@ 2016-10-28 1:44 ` robbieko
2016-11-01 7:20 ` Eryu Guan
3 siblings, 1 reply; 10+ messages in thread
From: robbieko @ 2016-10-28 1:44 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Robbie Ko
From: Robbie Ko <robbieko@synology.com>
Test that an incremental send operation dosen't work because
it tries to rename a directory which is already deleted.
This test exercises scenarios used to fail in btrfs and are fixed by
the following patch for the linux kernel:
"Btrfs: incremental send, add generation check for inode is waiting for move."
Signed-off-by: Robbie Ko <robbieko@synology.com>
---
tests/btrfs/134 | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/134.out | 2 +
tests/btrfs/group | 1 +
3 files changed, 123 insertions(+)
create mode 100755 tests/btrfs/134
create mode 100644 tests/btrfs/134.out
diff --git a/tests/btrfs/134 b/tests/btrfs/134
new file mode 100755
index 0000000..64974a5
--- /dev/null
+++ b/tests/btrfs/134
@@ -0,0 +1,120 @@
+#! /bin/bash
+# FS QA Test No. btrfs/134
+#
+# Test that an incremental send operation dosen't work because
+# it tries to rename a directory which is already deleted.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2016 Synology Inc. All Rights Reserved.
+# Author: Robbie Ko <robbieko@synology.com>
+#
+# 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"
+
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -fr $send_files_dir
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_test
+_require_scratch
+_require_fssum
+
+send_files_dir=$TEST_DIR/btrfs-test-$seq
+
+rm -f $seqres.full
+rm -fr $send_files_dir
+mkdir $send_files_dir
+
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+mkdir $SCRATCH_MNT/d1
+mkdir $SCRATCH_MNT/d4
+mkdir $SCRATCH_MNT/d3
+
+# Filesystem looks like:
+#
+# . (ino 256)
+# |--- d1 (ino 257)
+# |--- d4 (ino 258)
+# |--- d3 (ino 259)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
+
+_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
+
+_scratch_unmount
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+mkdir $SCRATCH_MNT/d1
+mkdir $SCRATCH_MNT/d2
+mkdir $SCRATCH_MNT/d3
+mkdir $SCRATCH_MNT/d4
+mv $SCRATCH_MNT/d1 $SCRATCH_MNT/d3/d1
+mv $SCRATCH_MNT/d3 $SCRATCH_MNT/d4/d3
+mv $SCRATCH_MNT/d2 $SCRATCH_MNT/d1
+
+# Filesystem now looks like:
+#
+# . (ino 256)
+# |--- d1 (ino 258)
+# |--- d4 (ino 260)
+# | |--- d3/ (ino 259)
+# | | |--- d1/ (ino 257)
+#
+_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
+
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
+rm $send_files_dir/1.snap
+
+run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+run_check $FSSUM_PROG -A -f -w $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
+
+_run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $send_files_dir/1.snap
+_run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
+ -f $send_files_dir/2.snap
+
+# Now recreate the filesystem by receiving both send streams and verify we get
+# the same content that the original filesystem had.
+_scratch_unmount
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
+run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
+_run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
+run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/134.out b/tests/btrfs/134.out
new file mode 100644
index 0000000..829c30e
--- /dev/null
+++ b/tests/btrfs/134.out
@@ -0,0 +1,2 @@
+QA output created by 134
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 779caec..831283e 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -136,3 +136,4 @@
131 auto quick send
132 auto quick send
133 auto quick send
+134 auto quick send
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 4/4] xfstests: btrfs/134: add test for incremental send which renames a directory already being deleted
2016-10-28 1:44 ` [PATCH v2 4/4] xfstests: btrfs/134: add test for incremental send which renames a directory already being deleted robbieko
@ 2016-11-01 7:20 ` Eryu Guan
2016-11-02 3:52 ` robbieko
0 siblings, 1 reply; 10+ messages in thread
From: Eryu Guan @ 2016-11-01 7:20 UTC (permalink / raw)
To: robbieko; +Cc: fstests, linux-btrfs
On Fri, Oct 28, 2016 at 09:44:06AM +0800, robbieko wrote:
> From: Robbie Ko <robbieko@synology.com>
>
> Test that an incremental send operation dosen't work because
> it tries to rename a directory which is already deleted.
>
> This test exercises scenarios used to fail in btrfs and are fixed by
> the following patch for the linux kernel:
>
> "Btrfs: incremental send, add generation check for inode is waiting for move."
I was testing with v4.9-rc1+ kernel and btrfs-progs v4.6. Seems above
patch is not merged in 4.9-rc1 kernel, but test passed for me, is that
expected?
Thanks,
Eryu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] xfstests: btrfs/134: add test for incremental send which renames a directory already being deleted
2016-11-01 7:20 ` Eryu Guan
@ 2016-11-02 3:52 ` robbieko
2017-01-19 12:11 ` Filipe Manana
0 siblings, 1 reply; 10+ messages in thread
From: robbieko @ 2016-11-02 3:52 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests, linux-btrfs
Hi Eryu Guan,
Yes, it need apply
[PATCH] "Btrfs: incremental send, do not skip generation inconsistency
check for inode 256."
and test again, it will failed.
because current code there is a problem, but just will not happen.
Thansk
Robbie Ko
Eryu Guan 於 2016-11-01 15:20 寫到:
> On Fri, Oct 28, 2016 at 09:44:06AM +0800, robbieko wrote:
>> From: Robbie Ko <robbieko@synology.com>
>>
>> Test that an incremental send operation dosen't work because
>> it tries to rename a directory which is already deleted.
>>
>> This test exercises scenarios used to fail in btrfs and are fixed by
>> the following patch for the linux kernel:
>>
>> "Btrfs: incremental send, add generation check for inode is waiting
>> for move."
>
> I was testing with v4.9-rc1+ kernel and btrfs-progs v4.6. Seems above
> patch is not merged in 4.9-rc1 kernel, but test passed for me, is that
> expected?
>
> Thanks,
> Eryu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] xfstests: btrfs/134: add test for incremental send which renames a directory already being deleted
2016-11-02 3:52 ` robbieko
@ 2017-01-19 12:11 ` Filipe Manana
0 siblings, 0 replies; 10+ messages in thread
From: Filipe Manana @ 2017-01-19 12:11 UTC (permalink / raw)
To: robbieko; +Cc: Eryu Guan, fstests, linux-btrfs@vger.kernel.org
On Wed, Nov 2, 2016 at 3:52 AM, robbieko <robbieko@synology.com> wrote:
> Hi Eryu Guan,
>
> Yes, it need apply
> [PATCH] "Btrfs: incremental send, do not skip generation inconsistency check
> for inode 256."
> and test again, it will failed.
>
> because current code there is a problem, but just will not happen.
Then it's not a problem...
What your're saying is confusing to say the least.
I really don't like the idea of adding a patch that is know to
introduce a regression and then adding another patch that fixes it.
Anyway, your patchset has been reviewed and those patches are not
needed anymore as there's a better solution that doesn't imply
introducing a regression temporarily, so this test is not really
needed.
thanks
>
> Thansk
> Robbie Ko
>
> Eryu Guan 於 2016-11-01 15:20 寫到:
>
>> On Fri, Oct 28, 2016 at 09:44:06AM +0800, robbieko wrote:
>>>
>>> From: Robbie Ko <robbieko@synology.com>
>>>
>>> Test that an incremental send operation dosen't work because
>>> it tries to rename a directory which is already deleted.
>>>
>>> This test exercises scenarios used to fail in btrfs and are fixed by
>>> the following patch for the linux kernel:
>>>
>>> "Btrfs: incremental send, add generation check for inode is waiting for
>>> move."
>>
>>
>> I was testing with v4.9-rc1+ kernel and btrfs-progs v4.6. Seems above
>> patch is not merged in 4.9-rc1 kernel, but test passed for me, is that
>> expected?
>>
>> Thanks,
>> Eryu
>
>
>
> --
> 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
--
Filipe David Manana,
"People will forget what you said,
people will forget what you did,
but people will never forget how you made them feel."
^ permalink raw reply [flat|nested] 10+ messages in thread