This is a note to let you know that I've just added the patch titled btrfs: qgroup: return ENOTCONN instead of EINVAL when quotas are not enabled to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-qgroup-return-enotconn-instead-of-einval-when-quotas-are-not-enabled.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8a36e408d40606e21cd4e2dd9601004a67b14868 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx> Date: Mon, 25 Nov 2019 21:58:51 -0300 Subject: btrfs: qgroup: return ENOTCONN instead of EINVAL when quotas are not enabled From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx> commit 8a36e408d40606e21cd4e2dd9601004a67b14868 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 <wqu@xxxxxxxx> Signed-off-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Harshvardhan Jha <harshvardhan.j.jha@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/qgroup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1411,7 +1411,7 @@ int btrfs_add_qgroup_relation(struct btr 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); @@ -1470,7 +1470,7 @@ static int __del_qgroup_relation(struct return -ENOMEM; if (!fs_info->quota_root) { - ret = -EINVAL; + ret = -ENOTCONN; goto out; } @@ -1536,7 +1536,7 @@ int btrfs_create_qgroup(struct btrfs_tra mutex_lock(&fs_info->qgroup_ioctl_lock); if (!fs_info->quota_root) { - ret = -EINVAL; + ret = -ENOTCONN; goto out; } quota_root = fs_info->quota_root; @@ -1570,7 +1570,7 @@ int btrfs_remove_qgroup(struct btrfs_tra mutex_lock(&fs_info->qgroup_ioctl_lock); if (!fs_info->quota_root) { - ret = -EINVAL; + ret = -ENOTCONN; goto out; } @@ -1621,7 +1621,7 @@ int btrfs_limit_qgroup(struct btrfs_tran mutex_lock(&fs_info->qgroup_ioctl_lock); if (!fs_info->quota_root) { - ret = -EINVAL; + ret = -ENOTCONN; goto out; } Patches currently in stable-queue which might be from mpdesouza@xxxxxxxx are queue-5.4/btrfs-qgroup-remove-one-time-use-variables-for-quota_root-checks.patch queue-5.4/btrfs-qgroup-return-enotconn-instead-of-einval-when-quotas-are-not-enabled.patch