Am Sa., 28. Nov. 2026 um 21:23 Uhr schrieb Pádraig Brady <[email protected]>:
> On 28/11/2026 15:51, Andreas Gruenbacher wrote:
>
> >   static int
> >   is_attr_permissions (const char *name, struct error_context *ctx)
> >   {
> > +  struct copy_context *copy_ctx =
> > +    (struct copy_context *) (void *)
> > +    ((char *)ctx - offsetof (struct copy_context, ctx));
> > +
> >     /* We need to explicitly test for the known extended attribute names,
> >        because at least on CentOS 7, attr_copy_action does not do it.  */
> > -  return streq (name, XATTR_NAME_POSIX_ACL_ACCESS)
> > -         || streq (name, XATTR_NAME_POSIX_ACL_DEFAULT)
> > -         || streq (name, XATTR_NAME_NFSV4_ACL)
> > +  if (streq (name, XATTR_NAME_POSIX_ACL_ACCESS))
> > +    {
> > +      copy_ctx->posix_acl_access = true;
> > +      return true;
> > +    }
> > +  if (streq (name, XATTR_NAME_POSIX_ACL_DEFAULT))
> > +    {
> > +      copy_ctx->posix_acl_default = true;
> > +      return true;
> > +    }
> > +  return streq (name, XATTR_NAME_NFSV4_ACL)
> >            || attr_copy_action (name, ctx) == ATTR_ACTION_PERMISSIONS;
> >   }
>
> Shouldn't we set both copy_ctx->posix_acl_{access,default} = true;
> in the XATTR_NAME_NFSV4_ACL case also.
> Do we really want to try and set a POSIX ACL in this case?
> I think that may give ENOTSUP errors for non trivial ACLs?

Or something like that, yes. I'll send an update.

The underlying problem is that commit eb6a8a4dfb ("qcopy-acl: Optimize
copying of ACLs by directly copying the attributes.") is garbage; it
should never have been merged. We don't want to copy all permission
attributes in random order; we want a more structured approach.

To get there, we should probably first extend fdfile_has_aclinfo() to
return which actual ACL types there are. Also, note that some
filesystems like xfs allow more extended attributes to be set than
listxattr() can retrieve, so when the initial listxattr buffer isn't
large enough, fdfile_has_aclinfo() should switch to probing the
individual attributes using getxattr() instead of enlarging that
buffer. And then, get_permissions() and set_permissions() should be
extended to get/set the nfs4_acl attribute as well, using
fdfile_has_aclinfo() to save syscalls.

Unfortunately, I don't see a chance of getting these changes done
myself anytime soon.

> > @@ -89,10 +116,28 @@ qcopy_acl (const char *src_name, int source_desc, 
> > const char *dst_name,
> >        to copy */
> >     if (ret == 0)
> >       {
> > +      struct copy_context copied = {};
> > +
> >         ret = source_desc < 0 || dest_desc < 0
> > -        ? attr_copy_file (src_name, dst_name, is_attr_permissions, NULL)
> > +        ? attr_copy_file (src_name, dst_name, is_attr_permissions, 
> > &copied.ctx)
> >           : attr_copy_fd (src_name, source_desc, dst_name, dest_desc,
> > -                        is_attr_permissions, NULL);
> > +                        is_attr_permissions, &copied.ctx);
> > +
>
> #if USE_ACL ?

Yes, that won't hurt.

Thanks,
Andreas

Reply via email to