Btrfs-progs: fix detection of root objects in cmds-property.c
authorFilipe David Borba Manana <fdmanana@gmail.com>
Tue, 12 Nov 2013 13:41:44 +0000 (13:41 +0000)
committerChris Mason <clm@fb.com>
Fri, 31 Jan 2014 16:22:32 +0000 (08:22 -0800)
commitd5bd0a1f8461132af3a7d1d681d836a2e4807cf4
tree0f919971ec53a9bd5168b3692f09e3acd9403499
parent85be2aaf913f0e234058c56fab460c5d7a2c084b
Btrfs-progs: fix detection of root objects in cmds-property.c

Several fixes:

1) The function check_is_root() returns 0 if the object is root;

2) Don't treat any error from get fsid ioctl as meaning the target
   is root. Only -ENOTTY means it's a root (parent directory is
   not a btrfs fs) and a -ENOTDIR means our target object is not a
   directory, therefore it can be the root;

3) Fix the comparison of the target and target's parent fs ids. If
   they are different, it means the target is a mount point in a
   btrfs fs, therefore it's a root, otherwise it isn't.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
cmds-property.c