diff options
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r-- | fs/btrfs/qgroup.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index bc424ae5a81a..38b42e7bc91d 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1364,13 +1364,17 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, | |||
1364 | spin_lock(&fs_info->qgroup_lock); | 1364 | spin_lock(&fs_info->qgroup_lock); |
1365 | 1365 | ||
1366 | dstgroup = add_qgroup_rb(fs_info, objectid); | 1366 | dstgroup = add_qgroup_rb(fs_info, objectid); |
1367 | if (!dstgroup) | 1367 | if (IS_ERR(dstgroup)) { |
1368 | ret = PTR_ERR(dstgroup); | ||
1368 | goto unlock; | 1369 | goto unlock; |
1370 | } | ||
1369 | 1371 | ||
1370 | if (srcid) { | 1372 | if (srcid) { |
1371 | srcgroup = find_qgroup_rb(fs_info, srcid); | 1373 | srcgroup = find_qgroup_rb(fs_info, srcid); |
1372 | if (!srcgroup) | 1374 | if (!srcgroup) { |
1375 | ret = -EINVAL; | ||
1373 | goto unlock; | 1376 | goto unlock; |
1377 | } | ||
1374 | dstgroup->rfer = srcgroup->rfer - level_size; | 1378 | dstgroup->rfer = srcgroup->rfer - level_size; |
1375 | dstgroup->rfer_cmpr = srcgroup->rfer_cmpr - level_size; | 1379 | dstgroup->rfer_cmpr = srcgroup->rfer_cmpr - level_size; |
1376 | srcgroup->excl = level_size; | 1380 | srcgroup->excl = level_size; |
@@ -1379,8 +1383,10 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, | |||
1379 | qgroup_dirty(fs_info, srcgroup); | 1383 | qgroup_dirty(fs_info, srcgroup); |
1380 | } | 1384 | } |
1381 | 1385 | ||
1382 | if (!inherit) | 1386 | if (!inherit) { |
1387 | ret = -EINVAL; | ||
1383 | goto unlock; | 1388 | goto unlock; |
1389 | } | ||
1384 | 1390 | ||
1385 | i_qgroups = (u64 *)(inherit + 1); | 1391 | i_qgroups = (u64 *)(inherit + 1); |
1386 | for (i = 0; i < inherit->num_qgroups; ++i) { | 1392 | for (i = 0; i < inherit->num_qgroups; ++i) { |