mount: log control command before clearing it in mount_sigchld_event()

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>
This commit is contained in:
dongshengyuan
2026-06-16 10:38:17 +08:00
committed by Daan De Meyer
parent fc06cd756e
commit cfed283b9c

View 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. */