erofs-utils: lib: fallback for copy_file_range
authorYifan Zhao <zhaoyifan@sjtu.edu.cn>
Sun, 25 Jun 2023 08:08:19 +0000 (16:08 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 27 Jun 2023 11:00:42 +0000 (19:00 +0800)
If tmpfs is used for /tmp and blob device is not specified, we need to
copy data between two different file systems during mkfs, which is not
supported by the copy_file_range() syscall. In this case, let's give it
a second chance by fallback to __erofs_copy_file_range().

Link: https://lore.kernel.org/r/20230625080819.44502-1-zhaoyifan@sjtu.edu.cn
Fixes: e9afc0408745 ("erofs-utils: introduce copy_file_range")
Fixes: 03cbf7b8f7f7 ("erofs-utils: mkfs: support chunk-based uncompressed files")
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Yifan Zhao <zhaoyifan@sjtu.edu.cn>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
lib/io.c

index 9d718ab704dcfdf676848034e7db7f6bd7499c18..1d266a5eb95b90c8a165925269cdc11e78962884 100644 (file)
--- a/lib/io.c
+++ b/lib/io.c
@@ -387,7 +387,7 @@ ssize_t erofs_copy_file_range(int fd_in, erofs_off_t *off_in,
                              length, 0);
        if (ret >= 0)
                goto out;
-       if (errno != ENOSYS) {
+       if (errno != ENOSYS && errno != EXDEV) {
                ret = -errno;
 out:
                *off_in = off64_in;