Skip to content

vfs: fixes corrupt file identity on backend rename failure - #10060

Open
biagiop1986 wants to merge 1 commit into
rclone:masterfrom
biagiop1986:fix-rename-rollback
Open

biagiop1986 wants to merge 1 commit into
rclone:masterfrom
biagiop1986:fix-rename-rollback

Conversation

@biagiop1986

Copy link
Copy Markdown

What does this change do?

In a rename operation, the VFS node's internal state is updated to the destination state before invoking the backend call renameCall. If this returns an error, the state is not rolled back and the node remains in a corrupted state: still residing at the old path, but with its internal pointing to the new location. This patch saves the previous state and restores in case of failure in the backend call. A test is added as well.

Linked issue

Fixes #10059

For new or changed backends

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • (Backend changes only) test_all passes for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.
  • This Pull Request is ready for review.

@biagiop1986
biagiop1986 requested a review from ncw as a code owner October 9, 2026 08:39
If a backend move/copy fails during a File.Rename operation, the VFS node
is left in a corrupted state: it still resides in the source directory's
item map, but its internal pointers (f.d, f.dPath, f.leaf) point to the
target destination.

This causes subsequent operations on the file  to inject virtual entries
into the destination directory instead of the source directory,
permanently poisoning the destination cache.

This patch tracks the original file properties and explicitly rolls them
back if the underlying renameCall returns an error.

Fixes rclone#10059
@biagiop1986 biagiop1986 changed the title vfs: rollback file identity on backend rename failure vfs: fixes corrupt file identity on backend rename failure Oct 12, 2026
@biagiop1986

Copy link
Copy Markdown
Author

Rebased onto master to include the last commits that correct the earlier lint build failures . CI is green on my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vfs: rename failure leaves VFS node in a corrupted state

1 participant