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

Bugfix: implements counting hardlinks for directories in spfs' fuse #1021

Merged

Conversation

dcookspi
Copy link
Collaborator

@dcookspi dcookspi commented May 8, 2024

This implements counting hardlinks for directories in spfs' fuse. The makes the nlink values directories valid for external processes that access a spfs fuse-backed filesystem, e.g. perl's File::Find module.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi added SPI AOI Area of interest for SPI SPI-0.41 labels May 8, 2024
@dcookspi dcookspi self-assigned this May 8, 2024
@dcookspi dcookspi linked an issue May 8, 2024 that may be closed by this pull request
@dcookspi dcookspi requested review from rydrman and jrray May 8, 2024 23:06
Comment on lines 173 to 174
// Directory has 2 hardlinks for . and .. plus one for
// each subdirectory. Symlinks do not count.
Copy link
Collaborator

Choose a reason for hiding this comment

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

. and .. would refer to different inodes, so this explanation for why we add 2 here isn't quite right. But I think the idea here is that an empty directory has a count of 2 because there's the entry for it in its parent, and then there's the . entry inside it.

As in stat ../dirname and stat . would show the same inode.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've updated the comment to try to make it clearer.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi merged commit 6c687b7 into main May 15, 2024
7 checks passed
@dcookspi dcookspi deleted the 1020-bug-spfs-fuse-doesnt-count-hardlinksnlink-correctly branch May 15, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SPI AOI Area of interest for SPI SPI-0.41
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] spfs' fuse doesn't count hardlinks/nlink correctly
3 participants