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

[BUG] spfs' fuse doesn't count hardlinks/nlink correctly #1020

Closed
dcookspi opened this issue May 8, 2024 · 1 comment · Fixed by #1021
Closed

[BUG] spfs' fuse doesn't count hardlinks/nlink correctly #1020

dcookspi opened this issue May 8, 2024 · 1 comment · Fixed by #1021
Assignees
Labels
agenda item Items to be brought up at the next dev meeting bug Something isn't working SPI AOI Area of interest for SPI SPI-0.41

Comments

@dcookspi
Copy link
Collaborator

dcookspi commented May 8, 2024

I think there's a bug in the spfs fuse implementation. I think it's in the nlink values it returns to other programs when they make stat calls to parts of a /spfs filesystem when the OverlayFsWithFuse backend (and probably FuseOnly) is being used.

We have a package where files go missing in the build stage. The package uses git submodules, one of them is a third-party tool that uses a Makefile to call a perl Makefile.PL script as part of the build. That script uses perl's File::Find module (version 1.20) to walk a directory to find things to copy around. But, this doesn't return all the files and dirs that it should from a directory under /spfs when OverlayFsWithFuse is enabled. Everything shows up when listing (ls) the directory, or using other programs to list the contents in the same environment, e.g. tree or find. But only one level is found by the File::Find call.

The File::Find implementation makes use of nlink (from stat-ing) to determine how many other subdirectories it has left to process when walking the filesystem. The fuse wrapper/implementation in spfs looks like it returns ok things for stat results (I don't know much about stat), but it has a TODO comment about the nlink values it gives back. I think that's the problem:

 ...
 // TODO: possibly return directory link count
 //       for all dirs below it (because of .. entries)
 nlink: if entry.is_dir() { 2 } else { 1 },
 ...

Expected behavior

spfs' fuse should return the correct value for the nlink field so things can reliably use that field.

The subdirectory where the files go missing in this build contains 2 sudirectories, 19 files, and no symlinks. So it's nlink value should be 4?

@dcookspi dcookspi added bug Something isn't working agenda item Items to be brought up at the next dev meeting SPI AOI Area of interest for SPI SPI-0.41 labels May 8, 2024
@dcookspi dcookspi changed the title [BUG] spfs' fuse doesn't count nlinks correctly [BUG] spfs' fuse doesn't count hardlinks/nlink correctly May 8, 2024
@dcookspi dcookspi self-assigned this May 8, 2024
@dcookspi
Copy link
Collaborator Author

dcookspi commented May 8, 2024

I have a fix for this that seems to work for the missing entries in the package build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agenda item Items to be brought up at the next dev meeting bug Something isn't working SPI AOI Area of interest for SPI SPI-0.41
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant