Skip to content

meta: skip trash insert when rename overwrites a relinked hardlink - #7508

Open
BetterAndBetterII wants to merge 1 commit into
juicedata:mainfrom
BetterAndBetterII:fix/rename-hardlink-unique
Open

BetterAndBetterII wants to merge 1 commit into
juicedata:mainfrom
BetterAndBetterII:fix/rename-hardlink-unique

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

  • doRename was missing the hardlink trash-collision check that doUnlink already had.
  • With trash enabled, unlink(link) keeps {parent}-{inode}-{name} in trash; recreating the link and rename(file2, link) then UNIQUE-fails (EIO on SQL) or overwrites and leaks nlink on Redis/TKV.
  • Mirror unlink across SQL/Redis/TKV: if that trash edge already exists, skip trash and decrement nlink.

Fixes #7502

Test plan

  • go test ./pkg/meta -run TestSQLiteRenameOverRelinkedHardlink -count=1
  • go test ./pkg/meta -run 'TestSQLiteClient|TestMemKVClient' -count=1

doRename lacked the hardlink trash-collision check doUnlink already had.
With trash enabled, unlink(link) keeps {parent}-{inode}-{name} in trash;
recreating the link and rename(file2, link) then UNIQUE-fails (EIO on
SQL) or overwrites and leaks nlink on Redis/TKV. Mirror unlink: if that
trash edge already exists, skip trash and decrement nlink.

Fixes juicedata#7502
@CLAassistant

CLAassistant commented Sep 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@BetterAndBetterII

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

Replacing file link with another file via rename results in Input/output error if link with the same path was unlinked before

2 participants