Red Hat Bugzilla – Bug 821161
ls -l command always outputs 1 as the number of hardlinks on btrfs
Last modified: 2015-05-17 21:40:17 EDT
Description of problem:
When using 'ls -l' command on the btrfs filesystem, it outputs 1 as the number of hardlinks for every directory, no matter how its content looks like. Other filesystems seem to be ok.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. create a directory on the btrfs filesystem and create a subdirectory in it
2. run 'ls -ld' on the toplevel directory
3. see that there is 1 on the place of the number of hardlinks
although there is a subdirectory in the toplevel directory, the number of hardlinks is 1
number of hardlinks is 2, because 'toplevel_dir/subdir/..' is the a link to the toplevel directory
I hope this is not an expected behaviour on the btrfs. Please reassing this bug to kernel if this is a btrfs bug.
When other filesystems are ok, it is most probably filesystem issue. Reassigning to kernel and Josef Bacik.
> I hope this is not an expected behaviour on the btrfs.
In addition to the previous comment with the link to a discussion about this, here's a link to the thread where the upstream maintainer rejects patches to track nlink in directories:
Arguably btrfs could behave like ext4 and track the link count until it hits a max and then goes to 1, but that's a discussion to have upstream. This isn't a bug in Fedora.