LUO FILE DESCRIPTORS(9)
π LUO FILE DESCRIPTORS π
bestie, this is section 9 of the Kernel API Manual, and honestly? it's giving architecture. periodt.
LUO ships the whole infra situation for keeping specific, stateful file descriptors alive across a kexec-based live update π«Ά. The main character goal here is letting workloads β think virtual machines rocking vfio, memfd, or iommufd β hold onto their essential resources with zero interruption. no cap, that's the whole vibe β¨
The framework is built around a callback-based handler model plus a very well-defined lifecycle for every single preserved file π
π Handler Registration π
Kernel modules that own a specific file type (like memfd, like vfio) register a struct liveupdate_file_handler. That handler hands over a set of callbacks that LUO invokes at different stages of the update process, and the most iconic ones are:
can_preserveβ a lil lightweight vibe check to see if this handler is even compatible with a givenstruct fileπpreserveβ the heavyweight one, queen. saves the file's state and returns an opaqueu64handle. this typically runs while the workload is still active so we can minimize downtime during the actual reboot transition π₯unpreserveβ cleans up anything.preserveallocated. gets called if the preservation process gets aborted before the reboot (i.e. session is closed) π§Ήfreezeβ the final pre-reboot moment to get the state ready for kexec. we are already in the reboot syscall here, so userspace literally cannot mutate the file anymore πunfreezeβ undoes whatever.freezedid. called if the live update gets aborted after the freeze phase πretrieveβ reconstructs the file in the new kernel from the preserved handle β¨finishβ final check + cleanup in the new kernel. after a successful finish call, LUO gives up ownership of this file π«‘
πΈ File Preservation Lifecycle β the happy path πΈ
- Preserve (Normal Operation) β a userspace agent preserves files one by one via an ioctl. for each file,
luo_preserve_filefinds a compatible handler, calls its.preserveoperation, and creates an internalstruct luo_fileto track the live state π - Freeze (Pre-Reboot) β right before the kexec,
luo_file_freezegets called. it iterates through all preserved files, calls their respective.freezeoperation, and serializes their final metadata (compatible string, token, and data handle) into a contiguous memory block for KHO π§ - Deserialize β after kexec,
luo_file_deserializeruns when the session gets deserialized (which is when/dev/liveupdateis first opened). it reads the serialized data from the KHO memory region and reconstructs the in-memory list ofstruct luo_fileinstances for the new kernel, linking them to their corresponding handlers π¦ - Retrieve (New Kernel β Userspace Ready) β the userspace agent can now restore file descriptors by providing a token.
luo_retrieve_filesearches for the matching token, calls the handler's.retrieveop to re-create thestruct file, and returns a new FD. and the best part? files can be retrieved in ANY order π - Finish (New Kernel β Cleanup) β once a session retrieval is complete,
luo_file_finishis called. it iterates through all the files, invokes their.finishoperations for final cleanup, and releases all associated kernel resources π
π File Preservation Lifecycle β the unhappy paths π
- Abort Before Reboot β if the userspace agent aborts the live update process before calling reboot (like, say, by closing the session file descriptor), the session's release handler calls
luo_file_unpreserve_files. this invokes the.unpreservecallback on all preserved files, making sure all allocated resources get cleaned up and the system goes back to a clean state π§ - Freeze Failure β during the reboot syscall, if any handler's
.freezeop fails, the.unfreezeop is invoked on all previously successful freezes to roll back their state. the reboot syscall then returns an error to userspace, canceling the live update π - Finish Failure β in the new kernel, if a handler's
.finishop fails, theluo_file_finishoperation is aborted. LUO retains ownership of all files within that session, including the ones that weren't even processed yet. the userspace agent can try calling the finish operation again later. and if the issue just cannot be resolved? those resources will be held by LUO until the next live update cycle, at which point they will be discarded π
fr fr bestie, read that last one again β LUO keeps holding those files, they do not just vanish. lowkey important.
β¨ SEE ALSO β¨
Kernel file ./kernel/liveupdate/luo_file.c struct luo_file(9), luo_preserve_file(9), luo_file_unpreserve_files(9), luo_file_freeze(9), luo_file_unfreeze(9), luo_retrieve_file(9), luo_file_finish(9), luo_file_deserialize(9), liveupdate_register_file_handler(9), liveupdate_unregister_file_handler(9)
okay that's the whole page, you ate that π
this one lives in ./kernel/liveupdate and it's dated October 2026 β go forth and preserve some file descriptors, icon πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms