Bug 1114995

Summary: btrfs fi df <mount point> outputs info instead of error even when <mount-point> is just a directory.
Product: [Fedora] Fedora Reporter: vikram goyal <vikigoyal>
Component: btrfs-progsAssignee: Josef Bacik <josef>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: esandeen, josef, mmahut
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-01 14:27:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description vikram goyal 2014-07-01 12:06:26 UTC
Description of problem:
btrfs fi df shows wrong info. Command sequence pasted below.

Version-Release number of selected component (if applicable):
Linux localhost.localdomain 3.14.9-200.fc20.x86_64 #1 SMP Thu Jun 26 21:40:51 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

btrfs-progs-3.14.2-3.fc20.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
[root@localhost ~]# cryptsetup luksOpen /dev/sda3 sda3
Enter passphrase for /dev/sda3:
[root@localhost ~]# cryptsetup luksOpen /dev/sdb1 sdb1
Enter passphrase for /dev/sdb1:

BTRFS devices opened but not yet mounted.

[root@localhost ~]# btrfs fi show
Label: 'fedora_localhost'  uuid: d2b3420c-99c1-44cc-a922-ac266072c7fb
        Total devices 2 FS bytes used 33.32GiB
        devid    2 size 73.51GiB used 44.03GiB path /dev/sdb6
        devid    3 size 73.30GiB used 44.03GiB path /dev/sda2

Label: 'Vikram'  uuid: 0809b072-35f3-4866-92b8-af4772b23ed6
        Total devices 2 FS bytes used 108.60GiB
        devid    1 size 158.03GiB used 157.00GiB path /dev/mapper/sda3
        devid    2 size 157.00GiB used 157.00GiB path /dev/mapper/sdb1

Btrfs v3.14.2

[root@localhost ~]# btrfs fi df /
Data, RAID1: total=42.00GiB, used=32.42GiB
System, RAID1: total=32.00MiB, used=12.00KiB
Metadata, RAID1: total=2.00GiB, used=914.56MiB

[root@localhost ~]# btrfs fi df /home/vikram/
Data, RAID1: total=42.00GiB, used=32.42GiB
System, RAID1: total=32.00MiB, used=12.00KiB
Metadata, RAID1: total=2.00GiB, used=914.56MiB

THE ABOVE OUTPUT FOR btrfs fi df /home/vikram IS SIMILAR TO /
which IMHO is wrong. An error should be displayed instead, due to
path /home/vikram (or any other path) currently not yet being a
mount point but just a directory. The output should be displayed only
if the full path is a mount point else an error should be shown.



[root@localhost ~]# mount /dev/mapper/sdb1 /home/vikram/

[root@localhost ~]# btrfs fi show
Label: 'fedora_localhost'  uuid: d2b3420c-99c1-44cc-a922-ac266072c7fb
        Total devices 2 FS bytes used 33.32GiB
        devid    2 size 73.51GiB used 44.03GiB path /dev/sdb6
        devid    3 size 73.30GiB used 44.03GiB path /dev/sda2

Label: 'Vikram'  uuid: 0809b072-35f3-4866-92b8-af4772b23ed6
        Total devices 2 FS bytes used 108.60GiB
        devid    1 size 158.03GiB used 157.00GiB path /dev/dm-0
        devid    2 size 157.00GiB used 157.00GiB path /dev/mapper/sdb1

Btrfs v3.14.2

[root@localhost ~]# btrfs fi df /
Data, RAID1: total=42.00GiB, used=32.42GiB
System, RAID1: total=32.00MiB, used=12.00KiB
Metadata, RAID1: total=2.00GiB, used=914.57MiB

[root@localhost ~]# btrfs fi df /home/vikram/
Data, RAID1: total=155.97GiB, used=108.36GiB
System, RAID1: total=32.00MiB, used=36.00KiB
Metadata, RAID1: total=1.00GiB, used=242.29MiB

Comment 1 Eric Sandeen 2014-07-01 14:27:25 UTC
I think it'd be best for you to ask for this on the upstream list; the code & manpages aren't clear as to whether these commands should work for any path in the filesystem, or only on the root directory of a filesystem.

The manpage says that the btrfs-filesystem commands take a path as an argument, not a mountpoint.

It often refers to "a filesystem identified by <path>" but does not specify that that path must be the root of a filesystem.

And this works exactly the same way as the "df" command works; you can give it any path on a filesystem and it will show you df for that filesystem; the root dir is not required as an argument..

So I think this is an RFE, not a bug, and it needs to be proposed upstream.

-Eric