mirror of
https://github.com/systemd/systemd
synced 2024-10-15 04:24:19 +00:00
logind: Add fallback for when the PIDFDs= property is not available
logind is not zero-downtime restartable yet, specifically it's not yet restarted in the Fedora spec, so we can end up in situations where we're running newer logind with older pid1 which doesn't know about the PIDFDs= property, so let's make sure we have a fallback in place for when that happens.
This commit is contained in:
parent
ec0bc263d7
commit
8ba3efed86
|
@ -4230,6 +4230,7 @@ int manager_start_scope(
|
|||
Manager *manager,
|
||||
const char *scope,
|
||||
const PidRef *pidref,
|
||||
bool allow_pidfd,
|
||||
const char *slice,
|
||||
const char *description,
|
||||
const char * const *requires,
|
||||
|
@ -4299,7 +4300,10 @@ int manager_start_scope(
|
|||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = bus_append_scope_pidref(m, pidref);
|
||||
if (allow_pidfd)
|
||||
r = bus_append_scope_pidref(m, pidref);
|
||||
else
|
||||
r = sd_bus_message_append(m, "(sv)", "PIDs", "au", 1, (uint32_t) pidref->pid);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -4330,8 +4334,27 @@ int manager_start_scope(
|
|||
return r;
|
||||
|
||||
r = sd_bus_call(manager->bus, m, 0, error, &reply);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
/* If this failed with a property we couldn't write, this is quite likely because the server
|
||||
* doesn't support PIDFDs yet, let's try without. */
|
||||
if (allow_pidfd &&
|
||||
sd_bus_error_has_names(error, SD_BUS_ERROR_UNKNOWN_PROPERTY, SD_BUS_ERROR_PROPERTY_READ_ONLY))
|
||||
return manager_start_scope(
|
||||
manager,
|
||||
scope,
|
||||
pidref,
|
||||
/* allow_pidfd = */ false,
|
||||
slice,
|
||||
description,
|
||||
requires,
|
||||
extra_after,
|
||||
requires_mounts_for,
|
||||
more_properties,
|
||||
error,
|
||||
ret_job);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
return strdup_job(reply, ret_job);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ int manager_start_scope(
|
|||
Manager *manager,
|
||||
const char *scope,
|
||||
const PidRef *pidref,
|
||||
bool allow_pidfd,
|
||||
const char *slice,
|
||||
const char *description,
|
||||
const char * const *requires,
|
||||
|
|
|
@ -742,6 +742,7 @@ static int session_start_scope(Session *s, sd_bus_message *properties, sd_bus_er
|
|||
s->manager,
|
||||
scope,
|
||||
&s->leader,
|
||||
/* allow_pidfd = */ true,
|
||||
s->user->slice,
|
||||
description,
|
||||
/* These should have been pulled in explicitly in user_start(). Just to be sure. */
|
||||
|
|
Loading…
Reference in a new issue