cp --reflink broken with btrfs on CentOS7.4

Issues related to applications and software problems
Dcz0208
Posts: 2
Joined: 2017/11/30 05:09:42

cp --reflink broken with btrfs on CentOS7.4

Postby Dcz0208 » 2017/11/30 07:12:04

Good morning!

We have some troubles with out now deprecated btrfs after upgrading from centos 7.3 --> 7.4.
We have used the reflink feature of "cp" to clone a lot of our big files, which doesn't work for us any longer.

We already tried the newest kernel from elrepo, disabled SELinux,...

Are there some new mount options we missed?

Any suggestions?

Best regards

Dennis


Steps to reproduce:

Code: Select all

# Centos 7.3: Working
# uname -r   
3.10.0-514.26.2.el7.x86_64
#  dd if=/dev/zero of=dummy.img bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 1.17138 s, 917 MB/s
#  cp --reflink=always dummy.img dummy.img.reflink
# ll dummy*
-rw-r--r--. 1 root root 1073741824 Nov 30 07:49 dummy.img
-rw-r--r--. 1 root root 1073741824 Nov 30 07:50 dummy.img.reflink

### Centos 7.4  --> Broken
# uname -r
3.10.0-693.5.2.el7.x86_64
# dd if=/dev/zero of=dummy.img bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 1.80302 s, 596 MB/s
# cp --reflink dummy.img dummy.img.reflink
cp: failed to clone 'dummy.img.reflink' from 'dummy.img': Operation not supported

### Centos 7.4 with newest elrepo-kernel 4.14 --> Broken
# uname -r
4.14.2-1.el7.elrepo.x86_64
# dd if=/dev/zero of=dummy.img bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 1.05374 s, 1.0 GB/s
# cp --reflink dummy.img dummy.img.reflink
cp: failed to clone 'dummy.img.reflink' from 'dummy.img': Operation not supported
[root@simxact2-neu data]# ll dummy*
-rw-r--r-- 1 root root 1073741824 Nov 30 07:49 dummy.img
-rw-r--r-- 1 root root          0 Nov 30 07:51 dummy.img.reflink

Here the strace of the failling cp:

Code: Select all

# strace cp --reflink=always dummy.img dummy.img.reflink.2
execve("/usr/bin/cp", ["cp", "--reflink=always", "dummy.img", "dummy.img.reflink.2"], [/* 26 vars */]) = 0
brk(NULL)                               = 0x2396000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f94b0af8000
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=55153, ...}) = 0
mmap(NULL, 55153, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f94b0aea000
close(3)                                = 0
open("/usr/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) = 0x7f94b06b1000
mprotect(0x7f94b06d5000, 2093056, PROT_NONE) = 0
mmap(0x7f94b08d4000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f94b08d4000
mmap(0x7f94b08d6000, 6512, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f94b08d6000
close(3)                                = 0
open("/usr/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) = 0x7f94b04a8000
mprotect(0x7f94b04af000, 2097152, PROT_NONE) = 0
mmap(0x7f94b06af000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f94b06af000
close(3)                                = 0
open("/usr/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) = 0x7f94b0ae9000
mmap(NULL, 2113904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f94b02a3000
mprotect(0x7f94b02a7000, 2093056, PROT_NONE) = 0
mmap(0x7f94b04a6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f94b04a6000
close(3)                                = 0
open("/usr/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) = 0x7f94afee0000
mprotect(0x7f94b0098000, 2097152, PROT_NONE) = 0
mmap(0x7f94b0298000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7f94b0298000
mmap(0x7f94b029e000, 16832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f94b029e000
close(3)                                = 0
open("/usr/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) = 0x7f94afc7e000
mprotect(0x7f94afcde000, 2097152, PROT_NONE) = 0
mmap(0x7f94afede000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x60000) = 0x7f94afede000
close(3)                                = 0
open("/usr/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) = 0x7f94b0ae8000
mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f94afa7a000
mprotect(0x7f94afa7c000, 2097152, PROT_NONE) = 0
mmap(0x7f94afc7c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f94afc7c000
close(3)                                = 0
open("/usr/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) = 0x7f94af85e000
mprotect(0x7f94af875000, 2093056, PROT_NONE) = 0
mmap(0x7f94afa74000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f94afa74000
mmap(0x7f94afa76000, 13448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f94afa76000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f94b0ae7000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f94b0ae5000
arch_prctl(ARCH_SET_FS, 0x7f94b0ae5800) = 0
mprotect(0x7f94b0298000, 16384, PROT_READ) = 0
mprotect(0x7f94afa74000, 4096, PROT_READ) = 0
mprotect(0x7f94afc7c000, 4096, PROT_READ) = 0
mprotect(0x7f94afede000, 4096, PROT_READ) = 0
mprotect(0x7f94b04a6000, 4096, PROT_READ) = 0
mprotect(0x7f94b06af000, 4096, PROT_READ) = 0
mprotect(0x7f94b08d4000, 4096, PROT_READ) = 0
mprotect(0x623000, 4096, PROT_READ)     = 0
mprotect(0x7f94b0af9000, 4096, PROT_READ) = 0
munmap(0x7f94b0aea000, 55153)           = 0
set_tid_address(0x7f94b0ae5ad0)         = 4026
set_robust_list(0x7f94b0ae5ae0, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f94af8647e0, [], SA_RESTORER|SA_SIGINFO, 0x7f94af86d5e0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f94af864870, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f94af86d5e0}, 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", 0x7ffddd782a30) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7ffddd782a30)      = -1 ENOENT (No such file or directory)
brk(NULL)                               = 0x2396000
brk(0x23b7000)                          = 0x23b7000
open("/proc/filesystems", O_RDONLY)     = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f94b0af7000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 395
stat("/etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned", 0x7ffddd7828a0) = -1 ENOENT (No such file or directory)
read(3, "", 1024)                       = 0
close(3)                                = 0
munmap(0x7f94b0af7000, 4096)            = 0
access("/etc/selinux/config", F_OK)     = 0
geteuid()                               = 0
stat("dummy.img.reflink.2", 0x7ffddd782860) = -1 ENOENT (No such file or directory)
stat("dummy.img", {st_mode=S_IFREG|0644, st_size=1073741824, ...}) = 0
stat("dummy.img.reflink.2", 0x7ffddd7825c0) = -1 ENOENT (No such file or directory)
open("dummy.img", O_RDONLY)             = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1073741824, ...}) = 0
open("dummy.img.reflink.2", O_WRONLY|O_CREAT|O_EXCL, 0644) = 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: ", 4cp: )                     = 4
write(2, "failed to clone 'dummy.img.refli"..., 54failed to clone 'dummy.img.reflink.2' from 'dummy.img') = 54
write(2, ": Operation not supported", 25: Operation not supported) = 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 +++

Dcz0208
Posts: 2
Joined: 2017/11/30 05:09:42

Re: cp --reflink broken with btrfs on CentOS7.4

Postby Dcz0208 » 2017/12/07 09:31:22

Found the same issue is posted in Centos Bugtracker in the meantime:
https://bugs.centos.org/view.php?id=14228