From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 30 Jul 2012 08:16:10 +0000 (-0600)
Subject: Btrfs: fix some error codes in btrfs_qgroup_inherit()
X-Git-Tag: v3.6-rc4~6^2~23
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5986802c2fcc754040bb7ed95f30bb16c4a843b7;p=users%2Fjedix%2Flinux-maple.git

Btrfs: fix some error codes in btrfs_qgroup_inherit()

These are returning zero when it should be returning a negative error
code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index bc424ae5a81a..229ef8927e6b 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1369,8 +1369,10 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
 
 	if (srcid) {
 		srcgroup = find_qgroup_rb(fs_info, srcid);
-		if (!srcgroup)
+		if (!srcgroup) {
+			ret = -EINVAL;
 			goto unlock;
+		}
 		dstgroup->rfer = srcgroup->rfer - level_size;
 		dstgroup->rfer_cmpr = srcgroup->rfer_cmpr - level_size;
 		srcgroup->excl = level_size;
@@ -1379,8 +1381,10 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
 		qgroup_dirty(fs_info, srcgroup);
 	}
 
-	if (!inherit)
+	if (!inherit) {
+		ret = -EINVAL;
 		goto unlock;
+	}
 
 	i_qgroups = (u64 *)(inherit + 1);
 	for (i = 0; i < inherit->num_qgroups; ++i) {