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@xxxxxxx>
> ---
> 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.
> 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.
Thanks,
Qu
> }
> kfree(value);
>
Attachment:
signature.asc
Description: OpenPGP digital signature
