]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount: log control command before clearing it in mount_sigchld_event()
authordongshengyuan <545258830@qq.com>
Tue, 16 Jun 2026 02:38:17 +0000 (10:38 +0800)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 16 Jun 2026 08:14:02 +0000 (10:14 +0200)
control_command and control_command_id were cleared before being passed
to unit_log_process_exit(), so the log always showed an invalid/unknown
command name.

Move both clears after the log call, matching the ordering in
socket_sigchld_event() and service_sigchld_event().

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
src/core/mount.c

index 94aeea9f6c9748dd0399d633c910886d82c41b60..cf2d839347b2e9a3141701dc13dc8f4e1d8438b4 100644 (file)
@@ -1554,13 +1554,9 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                 /* MOUNT_MOUNTING and MOUNT_UNMOUNTING states need to be patched, see below. */
                 m->result = f;
 
-        if (m->control_command) {
+        if (m->control_command)
                 exec_status_exit(&m->control_command->exec_status, &m->exec_context, pid, code, status);
 
-                m->control_command = NULL;
-                m->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
-        }
-
         unit_log_process_exit(
                         u,
                         "Mount process",
@@ -1568,6 +1564,9 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                         f == MOUNT_SUCCESS,
                         code, status);
 
+        m->control_command = NULL;
+        m->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
+
         /* Note that due to the io event priority logic, we can be sure the new mountinfo is loaded
          * before we process the SIGCHLD for the mount command. */