Re: [PATCH v5 07/22] liveupdate: luo_ioctl: add user interface
From: Mike Rapoport <rppt@kernel.org>
Date: 2025-11-14 12:58:04
Also in:
linux-doc, linux-fsdevel, linux-mm, lkml
On Fri, Nov 07, 2025 at 04:03:05PM -0500, Pasha Tatashin wrote:
Introduce the user-space interface for the Live Update Orchestrator via ioctl commands, enabling external control over the live update process and management of preserved resources. The idea is that there is going to be a single userspace agent driving the live update, therefore, only a single process can ever hold this device opened at a time. The following ioctl commands are introduced: LIVEUPDATE_IOCTL_CREATE_SESSION Provides a way for userspace to create a named session for grouping file descriptors that need to be preserved. It returns a new file descriptor representing the session. LIVEUPDATE_IOCTL_RETRIEVE_SESSION Allows the userspace agent in the new kernel to reclaim a preserved session by its name, receiving a new file descriptor to manage the restored resources. Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> --- include/uapi/linux/liveupdate.h | 64 ++++++++++++ kernel/liveupdate/luo_internal.h | 21 ++++ kernel/liveupdate/luo_ioctl.c | 173 +++++++++++++++++++++++++++++++ 3 files changed, 258 insertions(+)
...
+static int luo_ioctl_create_session(struct luo_ucmd *ucmd)
+{
+ struct liveupdate_ioctl_create_session *argp = ucmd->cmd;
+ struct file *file;
+ int ret;
+
+ argp->fd = get_unused_fd_flags(O_CLOEXEC);
+ if (argp->fd < 0)
+ return argp->fd;
+
+ ret = luo_session_create(argp->name, &file);
+ if (ret)put_unused_fd(fd) ?
+ return ret;
+
+ ret = luo_ucmd_respond(ucmd, sizeof(*argp));
+ if (ret) {
+ fput(file);
+ put_unused_fd(argp->fd);
+ return ret;
+ }I think that using gotos for error handling is more appropriate here.
+
+ fd_install(argp->fd, file);
+
+ return 0;
+}
+
+static int luo_ioctl_retrieve_session(struct luo_ucmd *ucmd)
+{
+ struct liveupdate_ioctl_retrieve_session *argp = ucmd->cmd;
+ struct file *file;
+ int ret;
+
+ argp->fd = get_unused_fd_flags(O_CLOEXEC);
+ if (argp->fd < 0)
+ return argp->fd;
+
+ ret = luo_session_retrieve(argp->name, &file);
+ if (ret < 0) {
+ put_unused_fd(argp->fd);
+
+ return ret;
+ }
+
+ ret = luo_ucmd_respond(ucmd, sizeof(*argp));
+ if (ret) {
+ fput(file);
+ put_unused_fd(argp->fd);
+ return ret;
+ }and here.
+ + fd_install(argp->fd, file); + + return 0; +} +
-- Sincerely yours, Mike.