]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
btrfs: add new filter for file cloning error translation
authorFilipe Manana <fdmanana@suse.com>
Mon, 5 Nov 2018 11:15:24 +0000 (11:15 +0000)
committerEryu Guan <guaneryu@gmail.com>
Sun, 11 Nov 2018 14:00:37 +0000 (22:00 +0800)
commitf6879e8a78568b33e885ab1f424780b8a1e8736b
tree5fa710dd815eb00840a19cb50e405dc4305b7932
parentb5d3e961fe0a674dff7d773ce6e8dd546fe153c3
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>
common/filter.btrfs
tests/btrfs/035
tests/btrfs/035.out
tests/btrfs/096
tests/btrfs/096.out
tests/btrfs/112
tests/btrfs/112.out
tests/btrfs/113
tests/btrfs/113.out