From: Harshvardhan Jha <harshvardhan.j.jha@oracle.com>
To: stable@vger.kernel.org
Cc: harshvardhan.j.jha@oracle.com, josef@toxicpanda.com,
dsterba@suse.com, clm@fb.com
Subject: [PATCH 5.4 2/3] btrfs: qgroup: return ENOTCONN instead of EINVAL when quotas are not enabled
Date: Fri, 28 Jul 2023 00:39:13 -0700 [thread overview]
Message-ID: <20230728073914.226947-3-harshvardhan.j.jha@oracle.com> (raw)
In-Reply-To: <20230728073914.226947-1-harshvardhan.j.jha@oracle.com>
From: Marcos Paulo de Souza <mpdesouza@suse.com>
[Upstream commit 8a36e408d40606e21cd4e2dd9601004a67b14868]
[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 <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Harshvardhan Jha <harshvardhan.j.jha@oracle.com>
---
fs/btrfs/qgroup.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 588abadcd784..7327636c9f26 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1354,7 +1354,7 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
mutex_lock(&fs_info->qgroup_ioctl_lock);
if (!fs_info->quota_root) {
- ret = -EINVAL;
+ ret = -ENOTCONN;
goto out;
}
member = find_qgroup_rb(fs_info, src);
@@ -1413,7 +1413,7 @@ static int __del_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
return -ENOMEM;
if (!fs_info->quota_root) {
- ret = -EINVAL;
+ ret = -ENOTCONN;
goto out;
}
@@ -1479,7 +1479,7 @@ int btrfs_create_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
mutex_lock(&fs_info->qgroup_ioctl_lock);
if (!fs_info->quota_root) {
- ret = -EINVAL;
+ ret = -ENOTCONN;
goto out;
}
quota_root = fs_info->quota_root;
@@ -1513,7 +1513,7 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
mutex_lock(&fs_info->qgroup_ioctl_lock);
if (!fs_info->quota_root) {
- ret = -EINVAL;
+ ret = -ENOTCONN;
goto out;
}
@@ -1564,7 +1564,7 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
mutex_lock(&fs_info->qgroup_ioctl_lock);
if (!fs_info->quota_root) {
- ret = -EINVAL;
+ ret = -ENOTCONN;
goto out;
}
--
2.40.0
next prev parent reply other threads:[~2023-07-28 7:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 7:39 [PATCH 5.4 0/3] CVE-2023-1611 Kernel: race between quota disable and quota assign ioctls in fs/btrfs/ioctl.c Harshvardhan Jha
2023-07-28 7:39 ` [PATCH 5.4 1/3] btrfs: qgroup: remove one-time use variables for quota_root checks Harshvardhan Jha
2023-07-28 7:39 ` Harshvardhan Jha [this message]
2023-07-28 7:39 ` [PATCH 5.4 3/3] btrfs: fix race between quota disable and quota assign ioctls Harshvardhan Jha
2023-08-01 7:52 ` [PATCH 5.4 0/3] CVE-2023-1611 Kernel: race between quota disable and quota assign ioctls in fs/btrfs/ioctl.c Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230728073914.226947-3-harshvardhan.j.jha@oracle.com \
--to=harshvardhan.j.jha@oracle.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox