Skip to content

hardlink: preserve timestamps when reflinking files#4395

Merged
karelzak merged 1 commit into
util-linux:masterfrom
lzwind:fix-hardlink-reflink-timestamp
Jun 2, 2026
Merged

hardlink: preserve timestamps when reflinking files#4395
karelzak merged 1 commit into
util-linux:masterfrom
lzwind:fix-hardlink-reflink-timestamp

Conversation

@lzwind
Copy link
Copy Markdown
Contributor

@lzwind lzwind commented Jun 2, 2026

When using --reflink=always, the destination file gets the current timestamp instead of preserving the original file's atime and mtime. This differs from both hardlink behavior and "cp -p --reflink=always".

Add futimens() call after successful reflink to restore the original timestamps from the target file's stat data.

Fixes #2340

When using --reflink=always, the destination file gets the current
timestamp instead of preserving the original file's atime and mtime.
This differs from both hardlink behavior and "cp -p --reflink=always".

Add futimens() call after successful reflink to restore the original
timestamps from the target file's stat data.

Fixes util-linux#2340
@karelzak karelzak merged commit 1659125 into util-linux:master Jun 2, 2026
36 checks passed
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.

hardlink: Reflinking files does not preserve a file's timestamp

2 participants