Skip to content

Commit 4f8f86b

Browse files
marcospsgregkh
authored andcommitted
btrfs: qgroup: return ENOTCONN instead of EINVAL when quotas are not enabled
commit 8a36e40 upstream. [PROBLEM] qgroup create/remove code is currently returning EINVAL when the user tries to create a qgroup on a subvolume without quota enabled. EINVAL is already being used for too many error scenarios so that is hard to depict what is the problem. [FIX] Currently scrub and balance code return -ENOTCONN when the user tries to cancel/pause and no scrub or balance is currently running for the desired subvolume. Do the same here by returning -ENOTCONN when a user tries to create/delete/assing/list a qgroup on a subvolume without quota enabled. Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Marcos Paulo de Souza <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]> Signed-off-by: Harshvardhan Jha <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8c1d1f3 commit 4f8f86b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/btrfs/qgroup.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
14111411

14121412
mutex_lock(&fs_info->qgroup_ioctl_lock);
14131413
if (!fs_info->quota_root) {
1414-
ret = -EINVAL;
1414+
ret = -ENOTCONN;
14151415
goto out;
14161416
}
14171417
member = find_qgroup_rb(fs_info, src);
@@ -1470,7 +1470,7 @@ static int __del_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
14701470
return -ENOMEM;
14711471

14721472
if (!fs_info->quota_root) {
1473-
ret = -EINVAL;
1473+
ret = -ENOTCONN;
14741474
goto out;
14751475
}
14761476

@@ -1536,7 +1536,7 @@ int btrfs_create_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
15361536

15371537
mutex_lock(&fs_info->qgroup_ioctl_lock);
15381538
if (!fs_info->quota_root) {
1539-
ret = -EINVAL;
1539+
ret = -ENOTCONN;
15401540
goto out;
15411541
}
15421542
quota_root = fs_info->quota_root;
@@ -1570,7 +1570,7 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
15701570

15711571
mutex_lock(&fs_info->qgroup_ioctl_lock);
15721572
if (!fs_info->quota_root) {
1573-
ret = -EINVAL;
1573+
ret = -ENOTCONN;
15741574
goto out;
15751575
}
15761576

@@ -1621,7 +1621,7 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
16211621

16221622
mutex_lock(&fs_info->qgroup_ioctl_lock);
16231623
if (!fs_info->quota_root) {
1624-
ret = -EINVAL;
1624+
ret = -ENOTCONN;
16251625
goto out;
16261626
}
16271627

0 commit comments

Comments
 (0)