Torsten Luettgert:
> I don't understand yet why you would collect XATTRs from lower
> branches, too. In directories, it's clear, because it's not logical
> if you can see only part of the contents (from the branches which
> allow access to the directory). The only thing I can imagine is
> something like

Thanks for the comments.
After my posting, I changed my mind and the result is same to your
thinking (my reason is different from yours, though).
Here is the updated version, but it is still draft.
I hope we could reach the aggrement about list/get at least.

Also I am thinking to change "cpea_sec" to "cpxsec", because it is
shorter.


J. R. Okajima


XATTR/EA support in the internal (copy,move)-(up,down)
----------------------------------------------------------------------
Generally the extended attributes of inode are categorazied as these.
- "security" for LSM and capability.
- "system" for posix ACL, 'acl' mount option is required.
- "trusted" for userspace, CAP_SYS_ADMIN is required.
- "user" for userspace, 'user_xattr' mount option is required.

Moreover there are some other categories. These rather unpopular
categories are handled as ...

In the copy-up operation, aufs should copy *all* the attibutes from the
source branch fs to the destination branch fs. But the support for XATTR
on the dst branch may differ from the src branch. In this case, the
copy-up operation will get an error and the original user operation
which triggered the copy-up fails. It can happen that even all copy-up
will fail.

When both of src and dst branches support XATTR and an error occurs whe
copying XATTR, then the copy-up should fail obviously. That is a good
reason and aufs should return an error to userspace. When only the
src branch support XATTR, aufs should not return an error. Moreover aufs
should not try copying XATTR to the branch which doesn't support XATTR.

In order to support XATTR and to implement the correct behaviour, new
attributes are introduced for aufs branches, "cpea_sec", "cpea_tr", and
"cpea_usr". They correspond to the XATTR namespaces (see above). Note that
"cpea_sys" for "system" doesn't exist. Since VFS has a generic flag
MS_POSIXACL, aufs can know whether the branch fs supports "system" xattr
or not.
Additionally, to be convenient, "cpea" is also provided which means all
"cpea_*" are set.

After the branch has these attributes, the XATTR copy-up operation
between branches are done only if the attribute matches. For example,
- "cpea_sec" is set to the lower/source branch.
- "cpea_sec" is NOT set to the upper/destination branch.
Then aufs won't try copy-up the "security" XATTRs, and will not return
an error related to XATTR.


Listing XATTR/EA and getting the value
----------------------------------------------------------------------
For the inode standard attributes (owner, group, timestamps, etc.), aufs
shows the values from the topmost existing file. This behaviour is good
for the non-dir entreis since the bahaviour exactly matches the shown
information. But for the directories, aufs considers all the same named
entries on the lower branches. Which means, if one of the lower entry
rejects readdir call, then aufs returns an error even if the topmost
entry allows it. This behaviour is necessary to respect the branch fs's
security, but may make users confused since the user-visible standard
attributes are the topmost entry's which doesn't match the behaviour.
To address this issue, aufs has a mount option called dirperm1 which
checks the permission for the topmost entry only, and doesn't respect
the lower entry's permission.

A similar issue can happen around XATTR.
getxattr(2) and listxattr(2) families behave as if dirperm1 option is
always set. Otherwise
- listxattr(2) may return the duplicated entires.
- user may not be able to remove or reset the XATTR forever.

Note that "cpea_*" attributes (see above) are not related getxattr(2)
and listxattr(2) families.

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk

Reply via email to