btrfs-progs: quota: use btrfs_open_dir for btrfs quota command
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 12 Oct 2015 13:23:01 +0000 (21:23 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:01 +0000 (09:35 +0100)
commit5e1a77c45c8447974fe8a315afc0659ce3f64f4c
treec7e9a795d8e6162b4a34c39986e2a07b19083b6d
parentbbbe7fd7d0f2f104c4c1c54e38524a6496cc9ab6
btrfs-progs: quota: use btrfs_open_dir for btrfs quota command

We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.

Before patch:
  # ./btrfs quota enable /mnt/tmp1
  ERROR: quota command failed: Inappropriate ioctl for device
  # ./btrfs quota disable /mnt/tmp1
  ERROR: quota command failed: Inappropriate ioctl for device
  # ./btrfs quota rescan /mnt/tmp1
  ERROR: quota rescan failed: Inappropriate ioctl for device
  #

After patch:
  # ./btrfs quota enable /mnt/tmp1
  ERROR: not a btrfs filesystem: /mnt/tmp1
  # ./btrfs quota disable /mnt/tmp1
  ERROR: not a btrfs filesystem: /mnt/tmp1
  # ./btrfs quota rescan /mnt/tmp1
  ERROR: not a btrfs filesystem: /mnt/tmp1
  #

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-quota.c