Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: cgxu519 <cgxu519@gmx.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	clm@fb.com, jbacik@fb.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: treat -ERANGE as an error case in btrfs_get_acl()
Date: Fri, 22 Jun 2018 15:42:41 +0800	[thread overview]
Message-ID: <869f200a-e214-2b2f-66a6-3fb58df3423d@gmx.com> (raw)
In-Reply-To: <88554c7b-f495-0295-574f-094a5181d9f1@gmx.com>

On 06/22/2018 01:59 PM, Qu Wenruo wrote:
>
> On 2018年06月22日 10:58, Chengguang Xu wrote:
>> Currently, when encoutering -ERANGE in btrfs_get_acl(),
>> just set acl to NULL so that we cannot get proper
>> acl information but the operation looks successful.
>>
>> This patch treats -ERANGE as an error case and meanwhile
>> print real errno before translating errno to -EIO.
>>
>> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
>> ---
>>   fs/btrfs/acl.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
>> index 15e1dfef56a5..7b3a83dd917c 100644
>> --- a/fs/btrfs/acl.c
>> +++ b/fs/btrfs/acl.c
>> @@ -42,9 +42,10 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
>>   	}
>>   	if (size > 0) {
>>   		acl = posix_acl_from_xattr(&init_user_ns, value, size);
>> -	} else if (size == -ERANGE || size == -ENODATA || size == 0) {
>> +	} else if (size == -ENODATA || size == 0) {
>>   		acl = NULL;
>>   	} else {
>> +		pr_err_ratelimited("BTRFS: get acl failed, err=%d\n", size);
> Is there any special reason to output this message even it's rate limited?
> This looks much like a debug output, no to mention we have
> btrfs_err/warn/info() wrapper to output with proper fs UUID.
Yeah, it will be better replacing pr_err with btrfs_err. The motivation to
print error message here is for helping debug when failing into error case.
As you know, most error code here will be override to -EIO, so I hope
to record a hint to indicate what has happened.

>
>>   		acl = ERR_PTR(-EIO);
> in fact we should let @acl to contain the correct error code from
> btrfs_getxattr(), other than overriding it with -EIO.
I'm also not so sure about the reason for overriding the errno with -EIO,
maybe it's easy to understand for end-user?

Thanks,
Chengguang.



  reply	other threads:[~2018-06-22  7:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22  2:58 [PATCH] btrfs: treat -ERANGE as an error case in btrfs_get_acl() Chengguang Xu
2018-06-22  5:59 ` Qu Wenruo
2018-06-22  7:42   ` cgxu519 [this message]
2018-06-22  7:58     ` Qu Wenruo
2018-06-22 10:48 ` David Sterba
2018-06-23  3:40   ` cgxu519

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=869f200a-e214-2b2f-66a6-3fb58df3423d@gmx.com \
    --to=cgxu519@gmx.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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