[lkml]   [2021]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] copy_file_range.2: Update cross-filesystem support for 5.12
Linux 5.12 fixes a regression.

Cross-filesystem (introduced in 5.3) copies were buggy.

Move the statements documenting cross-fs to BUGS.
Kernels 5.3..5.11 should be patched soon.

State version information for some errors related to this.

Reported-by: Luis Henriques <>
Reported-by: Amir Goldstein <>
Related: <>
Cc: Greg KH <>
Cc: Michael Kerrisk <>
Cc: Anna Schumaker <>
Cc: Jeff Layton <>
Cc: Steve French <>
Cc: Miklos Szeredi <>
Cc: Trond Myklebust <>
Cc: Alexander Viro <>
Cc: "Darrick J. Wong" <>
Cc: Dave Chinner <>
Cc: Nicolas Boichat <>
Cc: Ian Lance Taylor <>
Cc: Luis Lozano <>
Cc: Andreas Dilger <>
Cc: Olga Kornievskaia <>
Cc: Christoph Hellwig <>
Cc: ceph-devel <>
Cc: linux-kernel <>
Cc: CIFS <>
Cc: samba-technical <>
Cc: linux-fsdevel <>
Cc: Linux NFS Mailing List <>
Cc: Walter Harms <>
Signed-off-by: Alejandro Colomar <>
man2/copy_file_range.2 | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
index 467a16300..843e02241 100644
--- a/man2/copy_file_range.2
+++ b/man2/copy_file_range.2
@@ -169,6 +169,9 @@ Out of memory.
There is not enough space on the target filesystem to complete the copy.
+.BR EOPNOTSUPP " (since Linux 5.12)"
+The filesystem does not support this operation.
The requested source or destination range is too large to represent in the
specified data types.
@@ -184,10 +187,17 @@ or
.I fd_out
refers to an active swap file.
+.BR EXDEV " (before Linux 5.3)"
+The files referred to by
+.IR fd_in " and " fd_out
+are not on the same filesystem.
+.BR EXDEV " (since Linux 5.12)"
The files referred to by
.IR fd_in " and " fd_out
-are not on the same mounted filesystem (pre Linux 5.3).
+are not on the same filesystem,
+and the source and target filesystems are not of the same type,
+or do not support cross-filesystem copy.
.BR copy_file_range ()
@@ -200,8 +210,11 @@ Areas of the API that weren't clearly defined were clarified and the API bounds
are much more strictly checked than on earlier kernels.
Applications should target the behaviour and requirements of 5.3 kernels.
-First support for cross-filesystem copies was introduced in Linux 5.3.
-Older kernels will return -EXDEV when cross-filesystem copies are attempted.
+Since Linux 5.12,
+cross-filesystem copies can be achieved
+when both filesystems are of the same type,
+and that filesystem implements support for it.
+See BUGS for behavior prior to 5.12.
.BR copy_file_range ()
@@ -226,6 +239,12 @@ gives filesystems an opportunity to implement "copy acceleration" techniques,
such as the use of reflinks (i.e., two or more inodes that share
pointers to the same copy-on-write disk blocks)
or server-side-copy (in the case of NFS).
+In Linux kernels 5.3 to 5.11,
+cross-filesystem copies were implemented by the kernel,
+if the operation was not supported by individual filesystems.
+However, on some virtual filesystems,
+the call failed to copy, while still reporting success.
#define _GNU_SOURCE
 \ /
  Last update: 2021-05-09 23:44    [W:0.098 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site