diff options
author | Guangyu Sun <guangyu.sun@oracle.com> | 2014-03-11 14:24:18 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-03-20 20:15:27 -0400 |
commit | 72de6b5393c15c5228074008bbdc47e92bf6d4f7 (patch) | |
tree | 52c6f4e916b03033ff2cf2d0420ba616fb355eaa /fs/btrfs | |
parent | ef66af101a261f1c86ef9ec3859ebd9c28ee2e54 (diff) |
Btrfs: return EPERM when deleting a default subvolume
The error message is confusing:
# btrfs sub delete /mnt/mysub/
Delete subvolume '/mnt/mysub'
ERROR: cannot delete '/mnt/mysub' - Directory not empty
The error message does not make sense to me: It's not about deleting a
directory but it's a subvolume, and it doesn't matter if the subvolume is
empty or not.
Maybe EPERM or is more appropriate in this case, combined with an explanatory
kernel log message. (e.g. "subvolume with ID 123 cannot be deleted because
it is configured as default subvolume.")
Reported-by: Koen De Wit <koen.de.wit@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ioctl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3ad5c10d3704..10c18a6582cc 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1858,7 +1858,9 @@ static noinline int may_destroy_subvol(struct btrfs_root *root) | |||
1858 | if (di && !IS_ERR(di)) { | 1858 | if (di && !IS_ERR(di)) { |
1859 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); | 1859 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); |
1860 | if (key.objectid == root->root_key.objectid) { | 1860 | if (key.objectid == root->root_key.objectid) { |
1861 | ret = -ENOTEMPTY; | 1861 | ret = -EPERM; |
1862 | btrfs_err(root->fs_info, "deleting default subvolume " | ||
1863 | "%llu is not allowed", key.objectid); | ||
1862 | goto out; | 1864 | goto out; |
1863 | } | 1865 | } |
1864 | btrfs_release_path(path); | 1866 | btrfs_release_path(path); |