Skip to content

mv: create the cross-device destination exclusively and chown it by fd - #14631

Open
krosci wants to merge 1 commit into
uutils:mainfrom
krosci:mv-fchown-cross-device
Open

krosci wants to merge 1 commit into
uutils:mainfrom
krosci:mv-fchown-cross-device

Conversation

@krosci

@krosci krosci commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

rename_file_fallback kept the destination descriptor across the copy but preserve_ownership re-resolved the destination by path and called lchown, so a concurrent path-swap could redirect the chown to another inode. The comment above the block claimed a guarantee the code did not provide.

The cross-device leaf now chowns through the descriptor it already holds with fchown, and the destination is created with O_EXCL, matching GNU. create_dest_restrictive gains an exclusive flag, while cp keeps truncating a pre-existing destination.

Fixes #14599.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch)

@krosci
krosci force-pushed the mv-fchown-cross-device branch from d9a2a1a to 376f213 Compare September 17, 2026 11:06
@krosci

krosci commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

@sylvestre could you take a look at it? Thanks!

@krosci
krosci force-pushed the mv-fchown-cross-device branch from 1d4153a to a54986e Compare September 20, 2026 10:33
@codspeed

codspeed Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 387 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation five_38_bit_primes 1.8 s 2.1 s -11.52%
⚡ Simulation three_39_bit_primes 467.5 ms 145.6 ms ×3.2

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing krosci:mv-fchown-cross-device (53a7ac7) with main (a6d1eb3)

Open in CodSpeed

Footnotes

  1. 54 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@krosci
krosci force-pushed the mv-fchown-cross-device branch 3 times, most recently from 80d3d5b to 866c6bb Compare September 23, 2026 15:26
@krosci
krosci force-pushed the mv-fchown-cross-device branch from 866c6bb to 53a7ac7 Compare September 25, 2026 20:48

This branch has not been deployed

No deployments
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.

mv: cross-device leaf chowns by path, contradicting the comment above it (GNU uses fchown)

1 participant