mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Marcos Paulo de Souza <marcos.souza.org@gmail.com>,
	linux-kernel@vger.kernel.org
Cc: dsterba@suse.com, linux-btrfs@vger.kernel.org,
	anand.jain@oracle.com, Marcos Paulo de Souza <mpdesouza@suse.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH 2/2] btrfs: qgroup: Return -ENOTCONN instead of -EINVAL
Date: Tue, 26 Nov 2019 10:50:05 +0800	[thread overview]
Message-ID: <e0c355ac-6446-9b27-12fc-82e05c9e8212@gmx.com> (raw)
In-Reply-To: <20191126005851.11813-3-marcos.souza.org@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2676 bytes --]



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

Thanks,
Qu
> 
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.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;
>  	}
>  
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-11-26  2:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  0:58 [PATCH 0/2] btrfs qgroup cleanup Marcos Paulo de Souza
2019-11-26  0:58 ` [PATCH 1/2] btrfs: qgroup: Cleanup quota_root checks Marcos Paulo de Souza
2019-11-26  2:47   ` Qu Wenruo
2019-11-26  0:58 ` [PATCH 2/2] btrfs: qgroup: Return -ENOTCONN instead of -EINVAL Marcos Paulo de Souza
2019-11-26  2:50   ` Qu Wenruo [this message]
2019-11-26 17:00 ` [PATCH 0/2] btrfs qgroup cleanup David Sterba

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=e0c355ac-6446-9b27-12fc-82e05c9e8212@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcos.souza.org@gmail.com \
    --cc=mpdesouza@suse.com \
    /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

all inboxes | Powered by JetHome®