copy_file_range() returns EXDEV while attempting cross_fs copy between ext2/ext3 and tmpfs. $ uname -r 6.1.0-060100rc5-generic $ stat -f -c %T . ext2/ext3 $ stat -f -c %T /tmpfs1 tmpfs $ ./copy new.log /tmpfs1/new.log copy_file_range: Invalid cross-device link $ I think the issue is also observable between cross_fs use of copy_file_range() between ext4 -> xfs, ext4 -> tmpfs and xfs -> tmpfs. I observed this cross_fs issue somewhere around kernel 5.15.X and apparently it still persists in 6.1.0-060100rc5-generic.
This is intentional. EXDEV is kernel < 5.3 behavior. This behavior was partially (*) restored due to regression reports. See: https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=d7ba612d0ab10af2ed4e367306784212cc3f3595 (*) partially, because copy_file_range() between two different ext4 is still allowed. (**) above man page commit wrongly states 5.12 as the kernel that changed behavior back. it was later. man page needs to be fixed
Thanks. Does later mean 5.15? It seems so. Please see below: $ uname -r 5.15.0-56-generic $ stat -f -c %T . ext2/ext3 $ stat -f -c %T /tmpfsdir tmpfs $ ./copy a.out /tmpfsdir/a.out copy_file_range: Invalid cross-device link $
On Tue, Dec 13, 2022 at 8:30 AM <bugzilla-daemon@kernel.org> wrote: > > https://bugzilla.kernel.org/show_bug.cgi?id=216800 > > --- Comment #2 from Nitin (bhutaninitin@rocketmail.com) --- > Thanks. Does later mean 5.15? It seems so. The change was merged in v5.19 and backported to v5.15.53. 868f9f2f8e00 vfs: fix copy_file_range() regression in cross-fs copies > > Please see below: > $ uname -r > 5.15.0-56-generic > $ stat -f -c %T . > ext2/ext3 > $ stat -f -c %T /tmpfsdir > tmpfs > $ ./copy a.out /tmpfsdir/a.out > copy_file_range: Invalid cross-device link > $ > > -- > You may reply to this email to add a comment. > > You are receiving this mail because: > You are on the CC list for the bug.
Thanks a bunch.
For the record, man page patch: https://lore.kernel.org/linux-fsdevel/20221213120834.948163-1-amir73il@gmail.com/