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

fs: clean up filesystem import state #44

Merged
merged 2 commits into from
Dec 4, 2024
Merged

Conversation

allisonkarlitskaya
Copy link
Collaborator

Clean up two aspects of importing filesystems:

First: instead of trying to avoid crossing mountpoints (by checking .st_dev) in order to use .st_ino values as a "unique key" for tracking hardlinks, just take the (.st_dev, .st_ino) pair. This resolves some issues with overlayfs where adjacent files can end up with different .st_dev.

Second: we were abusing the first setting of st_dev as a flag field to determine if we were stat()-ing the root inode or not, which was always a bit evil. We did this to avoid collecting the mtime of the root directory for determining the newest file in the filesystem. Let's change our approach here: we can collect the mtime when adding items to their parent directories (which is never done for the root directory). Use a impl on Inode to make it easier to collect that information.

These changes together turn .stat() into a pure operation (with respect to the state of the reader), so remove the &mut self reference.

Fixes #41

@allisonkarlitskaya
Copy link
Collaborator Author

The CI failures look like the actions runners got the 2024-enabled 1.85 rust release and clippy isn't following our edition = "2021" line in Cargo.toml. I tried eliding those lifetimes and it doesn't work in 2021.

This also requires Rust 1.83.0 (for the lifetime elisions), so bump our
dependency.

Signed-off-by: Allison Karlitskaya <[email protected]>
Clean up two aspects of importing filesystems:

First: instead of trying to avoid crossing mountpoints (by checking
`.st_dev`) in order to use `.st_ino` values as a "unique key" for
tracking hardlinks, just take the `(.st_dev, .st_ino)` pair.  This
resolves some issues with overlayfs where adjacent files can end up with
different `.st_dev`.

Second: we were abusing the first setting of `st_dev` as a flag field to
determine if we were `stat()`-ing the root inode or not, which was
always a bit evil.  We did this to avoid collecting the mtime of the
root directory for determining the newest file in the filesystem.  Let's
change our approach here: we can collect the mtime when adding items to
their parent directories (which is never done for the root directory).
Use a impl on `Inode` to make it easier to collect that information.

These changes together turn .stat() into a pure operation (with respect
to the state of the reader), so remove the `&mut self` reference.

Fixes #41

Signed-off-by: Allison Karlitskaya <[email protected]>
@allisonkarlitskaya
Copy link
Collaborator Author

Okay, so it's not an edition thing, it's just a version thing: this got added in 1.83.0.

I didn't know that changes like this could happen between releases... The new version is in Fedora now, in any case, so let's just depend on it.

@allisonkarlitskaya
Copy link
Collaborator Author

Oh and of course it's not that the actions runners got the new version — it's that our fedora container did.

@allisonkarlitskaya allisonkarlitskaya merged commit e10babb into main Dec 4, 2024
2 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.

unified image build, Error: xattrs changed during read
1 participant