Bug 821161 - ls -l command always outputs 1 as the number of hardlinks on btrfs
Summary: ls -l command always outputs 1 as the number of hardlinks on btrfs
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 16
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
Assignee: Zach Brown
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-12 15:48 UTC by Vratislav Podzimek
Modified: 2015-05-18 01:40 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-06-26 23:42:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Vratislav Podzimek 2012-05-12 15:48:20 UTC
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):
coreutils-8.12-7.fc16.i686

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 16:00:13 UTC
When other filesystems are ok, it is most probably filesystem issue. Reassigning to kernel and Josef Bacik.

Comment 3 Zach Brown 2012-06-26 23:42:39 UTC
> 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:

http://comments.gmane.org/gmane.comp.file-systems.btrfs/4583

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.