syncthing: [copyRangeMethod] invalid cross-device link

Syncthing version 1.19.1 on Fedora Linux 35. Any recent Linux kernel should behave the same.

How to reproduce

  1. You need two disk partitions or separate disks. Both need to be formatted as either XFS or BtrFS. Cloned extents must be enabled (default for disks formatted in the last four years or so.)
  2. Create a folder on each disk device.
  3. Add both folders to Syncthing.
  4. Open advanced settings for both folders and set copyRangeMethod to ioctl.
  5. Share the folders with another device.
  6. Drop a file into one of the folders on the other device.
  7. Wait for it to sync.
  8. Drop the exact same file into the other folder on the other device.

Actual

Syncthing will fail to write the file to the second directory. It tries to share the extents between devices and fail with syncing: dst write: invalid cross-device link. This is the expected result for sharing extends between devices. However, it’s not the expected results for Syncthing!

Expected

Syncthing should indeed try to reuse the extents. However, it should also detect the error and handle it by duplication/copying the bytes instead of reusing extents. (So, the expected behavior is for Syncthing to behave like cp --reflink=auto (best effort or fallback to copy) whereas Syncthing currently behaves more like cp --reflink=always which fails in the same way in this situation.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (15 by maintainers)

Most upvoted comments

Or make it a list of enum values instead of just an enum value, such that one can do ioctl, standard? (And all is then just a convienience thing).