tarka / xcp

An extended `cp`
GNU General Public License v3.0
745 stars 24 forks source link

Copying file from virtual filesystems fails silently #24

Open tarka opened 2 years ago

tarka commented 2 years ago

There is a known issue with copy_file_range() that will result in files copied from virtual filesystems (e.g. /proc, /sys) to copy the incorrect number of bytes (usually 0 in the case of /proc, but possibly other sizes). LWN has a good summary here:

https://lwn.net/Articles/846403/

Detecting such filesystems/files is hard, as there is no "FS is virtual" flag, so all file sizes are inherently suspect when working this way. This issue is exaserbated in the case of xcp's block-parallel driver (parblock), which needs to know the file size up-front to allocate work on the queues.

This issue needs more investigation, and possibly some fundamental rearchitecting in the case of parallel block copy.