Files
apfstests/tests/btrfs/112.out
T
Filipe Manana f6879e8a78 btrfs: add new filter for file cloning error translation
A bug in file cloning/reflinking was recently found that afftected both
Btrfs and XFS, which was caused by allowing the cloning of an eof block
into the middle of a file when the eof is not aligned to the filesystem's
block size.

The fix consists of returning the errno -EINVAL to user space when the
arguments passed to the system call lead to the scenario of data
corruption. However this overlaps with some cases where the system call,
in Btrfs, returned -EOPNOTSUPP, which means we are trying to reflink
inline extents. That is unsupported in Btrfs due to the huge complexity
of supporting it (due to copying and trimming inline extents, deal with
eventual compression, etc).

We have a few btrfs test cases that verify that attempts to clone inline
extents result in a failure, and are currently expecting an -EINVAL error
message from the output of the cloner program. So create a filter that
converts error messages related to the -EOPNOTSUPP error to messages
related to the -EINVAL error, so that the test can run both on patched
and non-patched linux kernels.

The corresponding btrfs patch for the linux kernel is titled:

 "Btrfs: fix data corruption due to cloning of eof block"

And the VFS change that introduces the -EINVAL error return was introduced
by the following linux kernel commit (landed in 4.20-rc1):

 07d19dc9fbe9 ("vfs: avoid problematic remapping requests into partial EOF block")

The btrfs patch is not yet in Linus' tree (it was submitted around the
same time as this change) and the VFS change was introduced in 4.10-rc1.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-11-11 22:00:37 +08:00

258 lines
8.2 KiB
Plaintext

QA output created by 112
Testing without compression and without the no-holes feature...
wrote 50/50 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 16384/16384 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo data after clone operation:
0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
*
0040000
wrote 100/100 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 12288/12288 bytes at offset 4096
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo2 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0010000 dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd
*
0040000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
First 50 bytes of foo3 after clone operation:
0000000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 40/40 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
File foo4 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 60/60 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo5 data after clone operation:
0000000 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
*
0000060 03 03 03 03 03 03 03 03 03 03 03 03
0000074
clone failed: Invalid argument
File foo6 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0040000
File foo7 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 20/20 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo8 data after clone operation:
0000000 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
0000020 88 88 88 88
0000024
Testing with compression and without the no-holes feature...
wrote 50/50 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 16384/16384 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo data after clone operation:
0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
*
0040000
wrote 100/100 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 12288/12288 bytes at offset 4096
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo2 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0010000 dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd
*
0040000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
First 50 bytes of foo3 after clone operation:
0000000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 40/40 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
File foo4 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 60/60 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo5 data after clone operation:
0000000 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
*
0000060 03 03 03 03 03 03 03 03 03 03 03 03
0000074
clone failed: Invalid argument
File foo6 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0040000
File foo7 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 20/20 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo8 data after clone operation:
0000000 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
0000020 88 88 88 88
0000024
Testing without compression and with the no-holes feature...
wrote 50/50 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 16384/16384 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo data after clone operation:
0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
*
0040000
wrote 100/100 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 12288/12288 bytes at offset 4096
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo2 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0010000 dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd
*
0040000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
First 50 bytes of foo3 after clone operation:
0000000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 40/40 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
File foo4 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 60/60 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo5 data after clone operation:
0000000 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
*
0000060 03 03 03 03 03 03 03 03 03 03 03 03
0000074
clone failed: Invalid argument
File foo6 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0040000
File foo7 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 20/20 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo8 data after clone operation:
0000000 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
0000020 88 88 88 88
0000024
Testing with compression and with the no-holes feature...
wrote 50/50 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 16384/16384 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo data after clone operation:
0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
*
0040000
wrote 100/100 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 12288/12288 bytes at offset 4096
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo2 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0010000 dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd
*
0040000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
First 50 bytes of foo3 after clone operation:
0000000
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 40/40 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
File foo4 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 90/90 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 60/60 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo5 data after clone operation:
0000000 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
*
0000060 03 03 03 03 03 03 03 03 03 03 03 03
0000074
clone failed: Invalid argument
File foo6 data after clone operation:
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0040000
File foo7 data after clone operation:
0000000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
*
0000060 bb bb
0000062
wrote 20/20 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
clone failed: Invalid argument
File foo8 data after clone operation:
0000000 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
0000020 88 88 88 88
0000024