lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 26 Nov 2019 10:50:05 +0800
From:   Qu Wenruo <quwenruo.btrfs@....com>
To:     Marcos Paulo de Souza <marcos.souza.org@...il.com>,
        linux-kernel@...r.kernel.org
Cc:     dsterba@...e.com, linux-btrfs@...r.kernel.org,
        anand.jain@...cle.com, Marcos Paulo de Souza <mpdesouza@...e.com>,
        Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>
Subject: Re: [PATCH 2/2] btrfs: qgroup: Return -ENOTCONN instead of -EINVAL



On 2019/11/26 上午8:58, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@...e.com>
> 
> [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.

The generic error string for ENOTCONN is "Transport endpoint is not
connected", not something user can directly know.

So don't forget to modify btrfs-progs to interprete the error number to
"qgroup not enabled" error string.

Despite that, I think it looks good to me.

Reviewed-by: Qu Wenruo <wqu@...e.com>

Thanks,
Qu
> 
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@...e.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 417fafb4b4f6..b046b04d7cce 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -1259,7 +1259,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);
> @@ -1318,7 +1318,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;
>  	}
>  
> @@ -1384,7 +1384,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;
> @@ -1418,7 +1418,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;
>  	}
>  
> @@ -1469,7 +1469,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;
>  	}
>  
> 



Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ