btrfs-progs fix wrong memory free on check_is_root
authorSatoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Thu, 18 Dec 2014 07:39:26 +0000 (16:39 +0900)
committerDavid Sterba <dsterba@suse.cz>
Mon, 22 Dec 2014 17:34:23 +0000 (18:34 +0100)
commit44d3ee3e1f94acf71d52016f771988196955c259
treec7a1ebee4660dc1c412b0d4b1524a377c7f91831
parentfb7ddc498f4ddb63836e5b0e419f33fe6ce1cae6
btrfs-progs fix wrong memory free on check_is_root

When "/" is Btrfs, "btrfs property <subcommand> /" regards it
as non-root by mistake.

check_is_root() regards @object as a file system root if
the following two conditions are satisfied.

 a) Both @object and its parent directory are Btrfs object
    (file system root, subvolume, inode, and device
    used for Btrfs).
 b) fsid of the above mentioned two objects are different.

It doesn't work if @object is "/" because, in this case,
fsid of "/" and its parent (it's also "/"), are the same.

* Test environment

Two Btrfs file system (not subvolume) "/" and "/home/sat/mnt".

* How to reproduce

Submit "btrfs prop get" against the above mentioned file systems.

* Test Result

** Actual result (without my patch)

==========================
ro=false
label=                 # label is displayed because it's a file system root
ro=false               # label is not displayed even if it's a file system root
==========================
** Expected result (with my patch)

==========================
ro=false
label=
ro=false
label=foo            # label is displayed
===========================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reported-by: Naohiro Aota <naota@elisp.net>
Reviewed-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-property.c