Skip to content

[copyRangeMethod] invalid cross-device link #8271

@da2x

Description

@da2x

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA problem with current functionality, as opposed to missing functionality (enhancement)frozen-due-to-ageIssues closed and untouched for a long time, together with being locked for discussionneeds-triageNew issues needed to be validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions