From: David Sterba Date: Thu, 13 Sep 2012 22:04:34 +0000 (-0600) Subject: btrfs: return EPERM upon rmdir on a subvolume X-Git-Tag: next-20121002~89^2~36 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=71bdcbe91746937689d0667217a211aef996b8c3;p=karo-tx-linux.git btrfs: return EPERM upon rmdir on a subvolume A subvolume cannot be deleted via rmdir, but the error code ENOTEMPTY is confusing. Return EPERM instead, as this is not permitted. Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d41e467b4aa2..1c50f7c4f5ac 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3200,9 +3200,10 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) struct btrfs_trans_handle *trans; unsigned long nr = 0; - if (inode->i_size > BTRFS_EMPTY_DIR_SIZE || - btrfs_ino(inode) == BTRFS_FIRST_FREE_OBJECTID) + if (inode->i_size > BTRFS_EMPTY_DIR_SIZE) return -ENOTEMPTY; + if (btrfs_ino(inode) == BTRFS_FIRST_FREE_OBJECTID) + return -EPERM; trans = __unlink_start_trans(dir, dentry); if (IS_ERR(trans))