View Issue Details

IDProjectCategoryView StatusLast Update
0014228CentOS-7kernelpublic2018-01-08 13:04
Reporterlumitesi 
PriorityhighSeveritymajorReproducibilityalways
Status newResolutionopen 
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"

Issue:
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.

Thanks
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
abrt_hash
URL

Activities

lumitesi

lumitesi

2017-12-04 13:59

reporter  

strace_log (8,160 bytes)
execve("/usr/bin/cp", ["cp", "--reflink=always", "testb", "test_reflink"], [/* 33 vars */]) = 0
brk(NULL)                               = 0x250f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f43f59dc000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=74298, ...}) = 0
mmap(NULL, 74298, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f43f59c9000
close(3)                                = 0
open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300j\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=155744, ...}) = 0
mmap(NULL, 2255216, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f43f5595000
mprotect(0x7f43f55b9000, 2093056, PROT_NONE) = 0
mmap(0x7f43f57b8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f43f57b8000
mmap(0x7f43f57ba000, 6512, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f43f57ba000
close(3)                                = 0
open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\37\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=37056, ...}) = 0
mmap(NULL, 2130560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f43f538c000
mprotect(0x7f43f5393000, 2097152, PROT_NONE) = 0
mmap(0x7f43f5593000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f43f5593000
close(3)                                = 0
open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\23\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19888, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f43f59c8000
mmap(NULL, 2113904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f43f5187000
mprotect(0x7f43f518b000, 2093056, PROT_NONE) = 0
mmap(0x7f43f538a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f43f538a000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\35\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2127336, ...}) = 0
mmap(NULL, 3940800, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f43f4dc4000
mprotect(0x7f43f4f7c000, 2097152, PROT_NONE) = 0
mmap(0x7f43f517c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7f43f517c000
mmap(0x7f43f5182000, 16832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f43f5182000
close(3)                                = 0
open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=402384, ...}) = 0
mmap(NULL, 2494984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f43f4b62000
mprotect(0x7f43f4bc2000, 2097152, PROT_NONE) = 0
mmap(0x7f43f4dc2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x60000) = 0x7f43f4dc2000
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19776, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f43f59c7000
mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f43f495e000
mprotect(0x7f43f4960000, 2097152, PROT_NONE) = 0
mmap(0x7f43f4b60000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f43f4b60000
close(3)                                = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0m\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=144792, ...}) = 0
mmap(NULL, 2208904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f43f4742000
mprotect(0x7f43f4759000, 2093056, PROT_NONE) = 0
mmap(0x7f43f4958000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f43f4958000
mmap(0x7f43f495a000, 13448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f43f495a000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f43f59c6000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f43f59c4000
arch_prctl(ARCH_SET_FS, 0x7f43f59c4800) = 0
mprotect(0x7f43f517c000, 16384, PROT_READ) = 0
mprotect(0x7f43f4958000, 4096, PROT_READ) = 0
mprotect(0x7f43f4b60000, 4096, PROT_READ) = 0
mprotect(0x7f43f4dc2000, 4096, PROT_READ) = 0
mprotect(0x7f43f538a000, 4096, PROT_READ) = 0
mprotect(0x7f43f5593000, 4096, PROT_READ) = 0
mprotect(0x7f43f57b8000, 4096, PROT_READ) = 0
mprotect(0x623000, 4096, PROT_READ)     = 0
mprotect(0x7f43f59dd000, 4096, PROT_READ) = 0
munmap(0x7f43f59c9000, 74298)           = 0
set_tid_address(0x7f43f59c4ad0)         = 3427
set_robust_list(0x7f43f59c4ae0, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f43f47487e0, [], SA_RESTORER|SA_SIGINFO, 0x7f43f47515e0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f43f4748870, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f43f47515e0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
statfs("/sys/fs/selinux", {f_type=SELINUX_MAGIC, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
statfs("/sys/fs/selinux", {f_type=SELINUX_MAGIC, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
stat("/sys/fs/selinux", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
brk(NULL)                               = 0x250f000
brk(0x2530000)                          = 0x2530000
access("/etc/selinux/config", F_OK)     = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=106070960, ...}) = 0
mmap(NULL, 106070960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f43ee219000
close(3)                                = 0
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2502, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f43f59db000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2502
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x7f43f59db000, 4096)            = 0
open("/usr/lib/locale/UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
geteuid()                               = 0
stat("test_reflink", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
stat("testb", {st_mode=S_IFREG|0644, st_size=1207959552, ...}) = 0
stat("test_reflink", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("testb", O_RDONLY)                 = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1207959552, ...}) = 0
open("test_reflink", O_WRONLY|O_TRUNC)  = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
ioctl(4, BTRFS_IOC_CLONE or FICLONE, 3) = -1 EOPNOTSUPP (Operation not supported)
open("/usr/lib64/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "cp: ", 4)                     = 4
write(2, "failed to clone 'test_reflink' f"..., 43) = 43
write(2, ": Operation not supported", 25) = 25
write(2, "\n", 1)                       = 1
close(4)                                = 0
close(3)                                = 0
lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
close(0)                                = 0
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++
strace_log (8,160 bytes)
tigalch

tigalch

2017-12-04 14:02

manager   ~0030698

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.
lumitesi

lumitesi

2017-12-04 16:22

reporter   ~0030699

Issue was reported in Red Hat bugzilla with ID 1520492.
markusheitz

markusheitz

2017-12-07 07:41

reporter   ~0030717

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
lumitesi

lumitesi

2017-12-07 12:36

reporter   ~0030720

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.
TrevorH

TrevorH

2017-12-07 14:38

developer   ~0030721

People that can see the bug can add other email addresses to the list and then those people can see the bug too...
tigalch

tigalch

2017-12-07 14:42

manager   ~0030722

Just for completeness: The last 3 kernels are not CentOS-kernels. But its good to know this got "introduced" with 7.4.

Issue History

Date Modified Username Field Change
2017-12-04 13:59 lumitesi New Issue
2017-12-04 13:59 lumitesi File Added: strace_log
2017-12-04 13:59 lumitesi Tag Attached: bug
2017-12-04 13:59 lumitesi Tag Attached: coreutils
2017-12-04 13:59 lumitesi Tag Attached: kernel
2017-12-04 14:02 tigalch Note Added: 0030698
2017-12-04 16:22 lumitesi Note Added: 0030699
2017-12-07 07:41 markusheitz Note Added: 0030717
2017-12-07 12:36 lumitesi Note Added: 0030720
2017-12-07 12:42 lumitesi Tag Attached: btrfs
2017-12-07 14:38 TrevorH Note Added: 0030721
2017-12-07 14:42 tigalch Note Added: 0030722