Re: [RFC] liveupdate: prevent double preservation

From: Pasha Tatashin

Date: Fri Mar 20 2026 - 08:53:58 EST


On Fri, Mar 20, 2026 at 6:31 AM Pratyush Yadav <pratyush@xxxxxxxxxx> wrote:
>
> Hi Pasha,
>
> On Mon, Mar 16 2026, Pasha Tatashin wrote:
>
> > Currently, LUO does not prevent the same file from being preserved twice
> > across different active sessions.
> >
> > Add a new i_state flag I_LUO_PRESERVED and update luo_preserve_file()
> > to check and set this flag when a file is preserved, and clear it in
> > luo_file_unpreserve_files() when it is released. This ensures that the
> > same file (inode) cannot be preserved by multiple sessions. If another
> > session attempts to preserve an already preserved file, it will now
> > fail with -EBUSY.
>
> For consistency, would it be a good idea to also set this flag after
> retrieve? And then clear it on finish? If we do that then I suppose we
> should rename the flag to I_LUO_MANAGED or something similar.

Hi Pratyush,

That is a good idea. Between the retrieve and finish operations, the
file still has limitations due to LUO ownership, so keeping it flagged
as managed is useful. For example, in memfd the memory should remain
pinned, and in iommu the DMA mappings cannot be resized until finish,
VFIO also has some limitations.

I will rename the flag to I_LUO_MANAGED and update the retrieve and
finish paths in the next version.

Pasha

>
> Other than this, LGTM from LUO perspective.
>
> Acked-by: Pratyush Yadav (Google) <pratyush@xxxxxxxxxx>
>
> [...]
>
> --
> Regards,
> Pratyush Yadav