RE: [PATCH v4 0/3] initramfs: add support for xattrs in the initial ram disk

Roberto Sassu
2022-07-18T16:49:35Z

> From: Jim Baxter [mailto:jim_baxter@mentor.com]
> Sent: Monday, July 18, 2022 6:36 PM
> On 15/06/2022 10:27, Eugeniu Rosca wrote:
> > Hello Roberto,
> >
> > On Fr, Jun 10, 2022 at 03:38:24 +0000, Roberto Sassu wrote:
> >> I would be happy to address the remaining concerns, or take more
> >> suggestions, and then develop a new version of the patch set.
> > I face a number of conflicts when I try to rebase the latest openEuler
> > commits against vanilla master (v5.19-rc2). Do you think it is possible
> > to submit the rebased version to ML?
> >
> > In addition, I can also see some open/unresolved points from Mimi [*].
> > Did you by chance find some mutual agreement offline or do you think
> > they would still potentially need some attention?
> >
> > Maybe we can resume the discussion once you submit the rebased series?
> >
> > Many thanks and looking forward to it.
> >
> > [*] Potentially comments which deserve a reply/clarification/resolution
> >
> > https://lore.kernel.org/lkml/1561985652.4049.24.camel@linux.ibm.com/#t
> > https://lore.kernel.org/lkml/1561908456.3985.23.camel@linux.ibm.com/
> >
> > BR, Eugeniu.
> >
>
>
> Hello,
>
> I have been testing these patches and do not see the xattr information when
> trying to retrieve it within the initramfs, do you have an example of how
> you tested this originally?

Hi Jim, all

apologies, I didn't find yet the time to look at this.

Uhm, I guess this could be solved with:

https://github.com/openeuler-mirror/kernel/commit/18a502f7e3b1de7b9ba0c70896ce08ee13d052da

and adding initramtmpfs to the kernel command line. You are
probably using ramfs, which does not have xattr support.

> So far I have set the xattr in the rootfs before creating the cpio file like this:
> $ setfattr -n user.comment -v "this is a comment" test.txt
> If I access the data here it works:
> $ getfattr test.txt
> # file: test.txt
> user.comment
>
>
> Then I package it and try to verify it with this command:
> $getfattr /test.txt

I assume you try to pack/unpack, right? If I remember correctly
I only implemented the pack part. Unpacking is done by the kernel
(but you are right, it should be done by user space too).

> Which returns to the command line without the data.
>
>
>
> I believe the cpio is working because I see the file /METADATA\!\!\! in
> the target root filesystem, which shows the following when viewed with cat -e:
> 00000028^A^Auser.comment^@this is a comment
>
> This matches the data I fed in at the start, so I believe the data is being
> transferred correctly but I am accessioning it with the wrong tools.

Yes, xattrs are marshalled in the METADATA!!! file, one per regular file
xattrs are applied to. Xattrs are applied to the previous regular file.
That file name was preferred to adding a suffix to the file, to avoid
reaching the filename size limit.

Roberto