xfs
[Top] [All Lists]

Re: Extended attributes limit in Linux

To: Jeff Liu <jeff.liu@xxxxxxxxxx>
Subject: Re: Extended attributes limit in Linux
From: Vyacheslav Dubeyko <slava@xxxxxxxxxxx>
Date: Fri, 31 Jan 2014 18:21:14 +0400
Cc: Sun_Blood <sblood@xxxxxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dubeyko.com; s=default; h=Mime-Version:Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID; bh=eUQEXsEH5l/9wq5Qa3GVZ2tARgO2GFC+9FBfBBVyi4w=; b=mZvXI+nSKC8VlJyodeuM/DUysZb0xRmTAAMCnxWOfaIiK3lAXdfO49C9pFHIK9xyhjXV3MS5Y6HZwQX4FV8m4UdtYSr/F6j7GHq8eodS5kFzhn3hm+bX4kTeF+PB8TkW;
In-reply-to: <52EBA783.1080801@xxxxxxxxxx>
References: <CAMN6oR=a0G6O-3CVVkTwhYKavJTa543U3MLezCM8KW1ASZcPnA@xxxxxxxxxxxxxx> <52EB64DC.4020603@xxxxxxxxxx> <1391165083.4275.7.camel@ubuntu> <52EB960D.607@xxxxxxxxxx> <1391172723.4275.11.camel@ubuntu> <52EBA783.1080801@xxxxxxxxxx>
On Fri, 2014-01-31 at 21:39 +0800, Jeff Liu wrote:

> > 
> > I checked the same under Mac OS X 10.6.8 (Snow Leopard). And I have
> > failed on 3803 bytes size of xattr. So, I suppose that you have Mac OS X
> > Lion. And EAs is larger under Lion yet.
> > 
> > What version of Mac OS X have you?
> > 
> Yup, Mountain Lion v10.8.4 :)
> 

I suspect that xattrs with significant size is stored in compressed
state on HFS+. I implemented support of compressed xattrs partially but
I don't share this code yet. But, yes, EAs with size greater than 64 KB
can be a problem.

> FYI, there have a couple of things regarding HFSPlus+xattr+acl on Linux might 
> be
> deserved to discuss together.
> 
> We once have a discussion about the errno in case of hit the limits of ACLs, 
> which
> could be referred to:
> http://www.spinics.net/lists/linux-fsdevel/msg71125.html
> 
> HFSPlus return ENOMEM in this case, but it should be E2BIG as per Dave's 
> comments.
> I worked out a patch series includes HFSPlus, but not yet posted for some 
> reasons.
> 
> Also, it seems to me we'd better consolidate the errno for EA as well, that 
> is to
> say, it's better to fix the return error to be consistent with VFS interface 
> in case
> of the given EA name/value length is larger than the specified limits.
> 
> Would you like to take a look at the following two patches?
> 

Yes, sure. Patches looks correct and good for me. But did you take into
account recent significant changes of Christoph Hellwig? If so, then all
looks good.

Thanks,
Vyacheslav Dubeyko.

> Thanks,
> -Jeff
> 
> 
> From: Jie Liu <jeff.liu@xxxxxxxxxx>
> Subject: [PATCH 7/12] HFSPlus: return -E2BIG if hit the maximum size of ACLs
> 
> Return -E2BIG rather than -ENOMEM if hit the maximum size of ACLs, because
> of the former errno is consistent with the VFS interface.
> 
> Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
> ---
>  fs/hfsplus/posix_acl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/hfsplus/posix_acl.c b/fs/hfsplus/posix_acl.c
> index b609cc1..2f2788d 100644
> --- a/fs/hfsplus/posix_acl.c
> +++ b/fs/hfsplus/posix_acl.c
> @@ -92,7 +92,7 @@ static int hfsplus_set_posix_acl(struct inode *inode,
>       if (acl) {
>               size = posix_acl_xattr_size(acl->a_count);
>               if (unlikely(size > HFSPLUS_MAX_INLINE_DATA_SIZE))
> -                     return -ENOMEM;
> +                     return -E2BIG;
>               value = (char *)hfsplus_alloc_attr_entry();
>               if (unlikely(!value))
>                       return -ENOMEM;
> -- 
> 1.8.3.2
> 
> 
> From: Jie Liu <jeff.liu@xxxxxxxxxx>
> Subject: [PATCH 8/12] HFSPlus: return -ERANGE if xattr name size is larger 
> than HFSPLUS_ATTR_MAX_STRLEN
> 
> Return -ERANGE rather than -EOPNOTSUPP if the length of xattr name is
> larger than HFSPLUS_ATTR_MAX_STRLEN, because of the former errno is
> consistent with the VFS interface.
> 
> Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
> ---
>  fs/hfsplus/xattr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
> index 3c6136f..1ca58be 100644
> --- a/fs/hfsplus/xattr.c
> +++ b/fs/hfsplus/xattr.c
> @@ -919,7 +919,7 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, 
> const char *name,
>               return -EINVAL;
>  
>       if (len > HFSPLUS_ATTR_MAX_STRLEN)
> -             return -EOPNOTSUPP;
> +             return -ERANGE;
>  
>       strcpy(xattr_name, XATTR_MAC_OSX_PREFIX);
>       strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name);
> @@ -938,7 +938,7 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, 
> const char *name,
>               return -EINVAL;
>  
>       if (len > HFSPLUS_ATTR_MAX_STRLEN)
> -             return -EOPNOTSUPP;
> +             return -ERANGE;
>  
>       strcpy(xattr_name, XATTR_MAC_OSX_PREFIX);
>       strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name);


<Prev in Thread] Current Thread [Next in Thread>