Skip to content

Fix "failed to create hardlink" error due to multiple mounts on the same device (Cherry-pick of #19894) - #19914

Merged
stuhood merged 1 commit into
pantsbuild:2.17.xfrom
stuhood:cherry-pick-19894-to-2.17.x
Sep 22, 2023
Merged

Fix "failed to create hardlink" error due to multiple mounts on the same device (Cherry-pick of #19894)#19914
stuhood merged 1 commit into
pantsbuild:2.17.xfrom
stuhood:cherry-pick-19894-to-2.17.x

Conversation

@stuhood

@stuhood stuhood commented Sep 22, 2023

Copy link
Copy Markdown
Member

As described in #18757, the "check that source and dest are on same device" strategy that was introduced in #18153 to decide whether we could hardlink when materializing files was not robust when faced with the same device being mounted in multiple locations.

This change moves to a "create a canary" strategy for deciding when hardlinking between two destinations is legal. Hardlinks are canaried and memoized on a per-destination-root basis, so this strategy might actually be slightly cheaper than the previous one.

Fixes #18757.

…ame device (pantsbuild#19894)

As described in pantsbuild#18757, the "check that source and dest are on same
device" strategy that was introduced in pantsbuild#18153 to decide whether we
could hardlink when materializing files was not robust when faced with
the same device being mounted in multiple locations.

This change moves to a "create a canary" strategy for deciding when
hardlinking between two destinations is legal. Hardlinks are canaried
and memoized on a per-destination-root basis, so this strategy might
actually be slightly cheaper than the previous one.

Fixes pantsbuild#18757.
@stuhood stuhood added this to the 2.17.x milestone Sep 22, 2023
@stuhood stuhood added the category:bugfix Bug fixes for released features label Sep 22, 2023
@stuhood
stuhood requested review from huonw and thejcannon September 22, 2023 14:29
@stuhood
stuhood merged commit e957eb5 into pantsbuild:2.17.x Sep 22, 2023
@stuhood
stuhood deleted the cherry-pick-19894-to-2.17.x branch September 22, 2023 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:bugfix Bug fixes for released features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants