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 <dste...@suse.cz>
---
 fs/btrfs/inode.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a4167ef..a67dadd 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3815,9 +3815,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))
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to