Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

stats: Fix hardlink tracking across multiple filesystems #4503

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

MichaelEischer
Copy link
Member

@MichaelEischer MichaelEischer commented Oct 1, 2023

What does this PR change? What problem does it solve?

The stats command only counts hardlinked files once. However, the calculation did not include the deviceID and consequently inodeIDs from different devices might be considered to be hardlinked to one another.

Was the change previously discussed in an issue or on the forum?

Might fix https://forum.restic.net/t/possible-bug-in-stats/6461/8

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@MichaelEischer MichaelEischer force-pushed the fix-stats-with-hardlinks branch from 85a9bab to 32e4d8e Compare October 27, 2023 18:21
This will allow reusing it for the stats command without regressing the
memory usage due to storing an unnecessary file path.
inodes are only unique within a device. Use the HardlinkIndex from the
restorer instead of the custom (broken) hashmap to correctly account for
both inode and deviceID.
@MichaelEischer MichaelEischer force-pushed the fix-stats-with-hardlinks branch from 32e4d8e to 731b3a4 Compare October 27, 2023 21:40
Copy link
Member Author

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@MichaelEischer MichaelEischer merged commit 1041078 into restic:master Oct 27, 2023
@MichaelEischer MichaelEischer deleted the fix-stats-with-hardlinks branch October 27, 2023 21:53
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant