-
Notifications
You must be signed in to change notification settings - Fork 86
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
Inconsistent reporting of st_nlink
#435
Comments
allisonkarlitskaya
added a commit
to allisonkarlitskaya/composefs-rs
that referenced
this issue
Jan 28, 2025
While pairing with Timothée we discovered that the examples don't work on his system because the `cfsctl create-image` on the inside of the container build fails to detect all hardlinks. The difference is that his podman storage driver is using fuse-overlayfs, which doesn't always accurately report `st_nlink`. The behaviour is odd: when observing the hardlink via the first filename it will report a given `(st_dev, st_ino)` with `st_nlink` of 1 but when inspecting it via the second filename it will report the same `(st_dev, st_ino)` but with `st_nlink` of 2 this time. Let's just be "less clever" and store all non-directory inodes in our hashtable as potential hardlinks. See containers/fuse-overlayfs#435 Signed-off-by: Allison Karlitskaya <[email protected]> Co-Authored-By: Timothée Ravier <[email protected]>
travier
added a commit
to containers/composefs-rs
that referenced
this issue
Jan 29, 2025
While pairing with Timothée we discovered that the examples don't work on his system because the `cfsctl create-image` on the inside of the container build fails to detect all hardlinks. The difference is that his podman storage driver is using fuse-overlayfs, which doesn't always accurately report `st_nlink`. The behaviour is odd: when observing the hardlink via the first filename it will report a given `(st_dev, st_ino)` with `st_nlink` of 1 but when inspecting it via the second filename it will report the same `(st_dev, st_ino)` but with `st_nlink` of 2 this time. Let's just be "less clever" and store all non-directory inodes in our hashtable as potential hardlinks. See containers/fuse-overlayfs#435 Signed-off-by: Allison Karlitskaya <[email protected]> Co-Authored-By: Timothée Ravier <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fuse-overlayfs
for your container config:podman run -it --rm fedora
In this container image the
/usr/share/crypto-policies/DEFAULT/bind.txt
and/usr/share/crypto-policies/back-ends/DEFAULT/bind.config
files are hardlinked.Run this command:
Note the device and inode, and the fact that
Links: 1
.Note that this is the same inode, on the same device, but somehow it has
Links: 2
now.And now note that
Links: 2
as well when accessing the file through the original filename (which used to reportLinks: 1
in step 3).The only think I can think of is that
fuse-overlayfs
reportsst_nlink
as 1 until it "sees" the second hardlink to the file, at which point it updates its opinion tost_nlink
being 2, and persists that change in some kind of a cache.Maybe it's doing that to avoid leaking outside information into the container? ie: maybe there are extra hardlinks that the container should not know about?
Either way, this is causing problems with programs inside of the container that attempt to detect hardlinks by collecting
(dev, inode)
values from files that havest_nlink > 1
.The text was updated successfully, but these errors were encountered: