Bug 821161 - ls -l command always outputs 1 as the number of hardlinks on btrfs
ls -l command always outputs 1 as the number of hardlinks on btrfs
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Zach Brown
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-05-12 11:48 EDT by Vratislav Podzimek
Modified: 2015-05-17 21:40 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-06-26 19:42:39 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Vratislav Podzimek 2012-05-12 11:48:20 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):

How reproducible:
100 %

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
Actual results:
although there is a subdirectory in the toplevel directory, the number of hardlinks is 1

Expected results:
number of hardlinks is 2, because 'toplevel_dir/subdir/..' is the a link to the toplevel directory

Additional info:
I hope this is not an expected behaviour on the btrfs. Please reassing this bug to kernel if this is a btrfs bug.
Comment 1 Ondrej Vasik 2012-05-12 12:00:13 EDT
When other filesystems are ok, it is most probably filesystem issue. Reassigning to kernel and Josef Bacik.
Comment 3 Zach Brown 2012-06-26 19:42:39 EDT
> I hope this is not an expected behaviour on the btrfs.

It is.

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.

Note You need to log in before you can comment on or make changes to this bug.