Re: [PATCH v3 00/10] liveupdate: Preserve tmpfs files across Live Update
From: Pratyush Yadav
Date: Tue Nov 10 2026 - 10:52:50 EST
Hi David,
On Thu, Nov 05 2026, David Matlack wrote:
> On 2026-11-05 04:42 PM, Christian Brauner wrote:
>> On Tue, Nov 03, 2026 at 01:02:06AM +0000, David Matlack wrote:
[...]
>> So instead of LUO handing out a file descriptor for a file it invented,
>> let userspace create the file, O_TMPFILE, O_CREAT, whatever it likes,
>> with the owner, mode and xattrs it wants, and let LUO put the contents
>> into it. That's what the RFC did.
>
> I'm fine with going back to that in v4. The retrieve argument will just
> be a file descriptor for the target file, and LUO will only restore the
> contents and size into it. Everything else about the file is up to
> userspace.
>
>> The checks on the target are trivial: a writable fd to an empty shmem
>> file with the inode lock held while you fill it. A tmpfs file can't be
>> sealed, it only ever has F_SEAL_SEAL, so there's nothing to restore but
>> contents and size anyway.
>
> Sounds good. The one other check I plan to add is rejecting a target
> that LUO is already managing, e.g. a file that is preserved in an
> outgoing session and whose size is frozen.
I have been playing with this idea too, and I also stumbled onto this
problem.
You also need to make sure a preserve doesn't race with a retrieve.
Since userspace has access to the file, it can do both at the same time.
I think LUO should expose a "register file" function that registers the
file in luo_preserved_files. This should be the very first thing
retrieve does.
Also, today LUO core expects a fresh file from file handlers, so it
always installs a FD to that file in the task. When doing the "retrieve
into FD" thing, that will result in two FDs to the same file. While it
isn't a strict problem, it seems kinda ugly from a uAPI prespective.
Perhaps we should let retrieve signal to LUO core that "I already
installed the file", or a "I have no file to install", or something
similar?
>
> LUO will also add the folios while i_size is still 0, and set i_size
> last. So reads, page faults and memfd_pin_folios() wouldn't see the
> folios until the file is complete, and if the retrieve fails partway
> through the target is left empty.
>
[...]
--
Regards,
Pratyush Yadav