CentOS Bug Tracker - CentOS-7
View Issue Details
0014228CentOS-7kernelpublic2017-12-04 13:592017-12-07 14:42
PlatformOSOS Version
Product Version7.4.1708 
Target VersionFixed in Version 
Summary0014228: cp --reflink=always fails with "Operation not supported"
DescriptionWhat happened:

In a CentOS 7 VM with kernel 3.10.0-693.5.2.el7.x86_64 including a mounted disk formatted with BTRFS and btrfs-progs v4.9.1.
When executing a copy of files with the command "cp --reflink=always" the command fails with the indication "failed to clone 'someFile': Operation not supported"

The above-mentioned copy fails, but in the files are created with zero bytes in the destination folder.
While trying to find the cause, it seems to be some bug in the ioctl operation. A strace log of the copy operation can be found in the uploaded files.

This problem only manifests itself in the kernel 3.10.0-693.5.2.el7.x86_64. If the same operation is executed in the system with the kernel 3.10.0-514.2.2.el7.x86_64 all goes well.
More evidence that this is probably a bug introduced in this version of the kernel can be found in the git repository in the first commit of the new kernel. (link: https://git.centos.org/commit/rpms!kernel.git/d6bfd60741b14479a15b43acaa1ea5a8d73df543)
In the file "SPECS/kernel.spec" line 15011 (link: https://git.centos.org/blob/rpms!kernel.git/d6bfd60741b14479a15b43acaa1ea5a8d73df543/SPECS!kernel.spec#L15011) that some changes were made in the ioctl - "[fs] btrfs: fix uninit variable in clone ioctl (Bill O'Donnell) [1298680]"

As a workaround, an older version of the kernel can be used, but this is not optimal, as future releases may have the same problem.

Steps To ReproduceIn a BTRFS mount:
dd if=/dev/urandom of=testb bs=1024k seek=1024 count=128
cp --reflink=always testb testb_copy
Tagsbtrfs, bug, coreutils, kernel
Attached Files? strace_log (8,160) 2017-12-04 13:59

2017-12-04 14:02   
Please post this issue to RedHats bugzilla (please also add a cross-reference for bug IDs) together with your findings. Once RH fixes this in the kernel, CentOS will inherit the fix.
2017-12-04 16:22   
Issue was reported in Red Hat bugzilla with ID 1520492.
2017-12-07 07:41   
affected kernels:
CentOS Linux release 7.3.1611 (Core) 3.10.0-693.el7.x86_64
CentOS Linux release 7.4.1708 (Core) 3.10.0-693.2.2.el7.x86_64
CentOS Linux release 7.3.1611 (Core) 3.10.0-693.5.2.el7.x86_64
CentOS Linux release 7.4.1708 (Core) 3.10.0-693.5.2.el7.centos.plus.x86_64
CentOS Linux release 7.4.1708 (Core) 3.10.0-693.11.1.el7.x86_64

not affected:
CentOS Linux release 7.3.1611 (Core) 3.10.0-514.26.2.el7.x86_64
CentOS Linux release 7.4.1708 (Core) 4.14.4-1.el7.elrepo.x86_64
CentOS Linux release 7.3.1611 (Core) 4.4.104-1.el7.elrepo.x86_64
CentOS Linux release 7.4.1708 (Core) 4.4.104-1.el7.elrepo.x86_64
2017-12-07 12:36   
Thanks for that info.
Since the bug I reported in the Red Hat Bugzilla is private and I can't change that. I posted this findings in there. I'm hoping that someone will be assigned soon.
2017-12-07 14:38   
People that can see the bug can add other email addresses to the list and then those people can see the bug too...
2017-12-07 14:42   
Just for completeness: The last 3 kernels are not CentOS-kernels. But its good to know this got "introduced" with 7.4.

Issue History
2017-12-04 13:59lumitesiNew Issue
2017-12-04 13:59lumitesiFile Added: strace_log
2017-12-04 13:59lumitesiTag Attached: bug
2017-12-04 13:59lumitesiTag Attached: coreutils
2017-12-04 13:59lumitesiTag Attached: kernel
2017-12-04 14:02tigalchNote Added: 0030698
2017-12-04 16:22lumitesiNote Added: 0030699
2017-12-07 07:41markusheitzNote Added: 0030717
2017-12-07 12:36lumitesiNote Added: 0030720
2017-12-07 12:42lumitesiTag Attached: btrfs
2017-12-07 14:38TrevorHNote Added: 0030721
2017-12-07 14:42tigalchNote Added: 0030722