-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Incorrect link count for files #3386
Comments
what is the problem you are facing if the link count is not correct? |
One of the simpler ways I use the link count is I have one directory of source files that are haphazardly named (which came that way from the source, and renaming them would cause other problems), and I maintain a "mapping" of those files into a directory with standardized names for consumption by other tools that expect their input to be organized a certain way. Sometimes a higher quality version of files are added to the source directory which will take priority next time the mapping is generated (and the lower quality version is deleted). Sometimes mappings are added manually from source files not in the managed source file directory. When the mapping is run and an output mapped file is not the expected one (based on inode) the link count is used to determine whether the output file is dangling due to an older source being deleted (and can safely be deleted), or whether manual intervention is needed to either revise the mapping (because the better source is in some unmanaged location) or to delete the linked output file (because the better source is in the input directory). |
thanks for the explanation! I added a fix. Please use the dev version to test. |
Awesome, I'll test in the next day or so when I get a chance. It looks like this won't address files that already exist in a bad state (of which I have several), any advice on how to do that without recreating the files? (Or am I missing something in how the code works?) |
hard to fix existing data unless write a program specifically to fix this. |
I figured as much, just thought I'd ask. Looks like the fix worked, I look forward to this making it into the next release. Also, congrats on the move to seaweedfs/seaweedfs.
|
Describe the bug
Under some conditions an incorrect number of (hard) links is stored and returned for files. I was able to reproduce this issue by deleting the original file on a different mount from the one that made the link, then after understanding what was going on using a single machine and remounting the fs.
System Setup
start commands:
mount is through fstab entry:
master/filer: Ubuntu 16.04.7 LTS
volume: Ubuntu 20.04.4 LTS
mount: Ubuntu 20.04.4 LTS
weed version
:master/filer/mount:
version 8000GB 3.14 3c79c770562ef4f7c0d4e57a88f616eb3671b9cd linux amd64
volume:
version 8000GB 3.14 3c79c770562ef4f7c0d4e57a88f616eb3671b9cd linux arm64
filer.toml
:Expected behavior
When deleting a file that is a hard link the number of links is correctly reflected in the remaining file that shared an inode.
Screenshots
Not screenshots, but here is a simplified "log" of steps to reproduce the issue:
Additional context
I know hard links are not used super widely, but they are very useful for some of the operations I am doing that would result in the unnecessary duplication of a large file many times.
I originally discovered the issue while using multiple mounts, which displays similar behavior to the simpler reproduction steps above (but is slightly more confusing until you realize you need to remount to see the true error):
The text was updated successfully, but these errors were encountered: