Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

FIEMAP fixes for --is-reflink #531

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cebtenzzre
Copy link
Collaborator

This pull request is intended to fix the FIEMAP-related issues with --is-reflink: #527, #528, #529, and #530.

Test exit statuses 1, 3, 4, 6, 7, 8, and 9.
Completing the current loop iteration if the current extent is not
contiguous with the last means the extent flags and file offset are
updated as if the extents *were* contiguous. In general, this causes
calling code to skip every second extent!

Also remove a redundant write to file_offset_next that is always
clobbered after the loop exits.

Fixes sahib#527
There were two EOF checks in rm_util_link_type. One of them caused the
last extent to be ignored in files with at least two extents. The other
mishandled files that end with a hole.

In rm_offset_get_from_fd, always warn about no extents at a nonzero file
offset, since calling code should stop after the last extent.

Fixes sahib#528
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
Holes are handled by ignoring them when they are after an extent and
skipping them when they are before one. Since we were only comparing the
current file position, a file with a hole could match a file without one
as long as the physical offsets match and the extents logically end at
the same place. This led to --is-reflink false-positives.

Fix this by comparing the logical offset of each extent.

Fixes sahib#611
rmlint previously ignored holes between physically adjacent extents.
This could cause files to be detected as reflinked that weren't, if one
file had a complete extent and the other file had two pieces of it
separated by a hole.

Check for logical gaps as well as physical gaps to fix this problem.

Fixes sahib#530
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant