mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
core/cgroup: make sure deserialized accounting data is not voided (#39130)
This commit is contained in:
@@ -4283,6 +4283,15 @@ int cgroup_runtime_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
if (!crt)
|
||||
return 0;
|
||||
|
||||
if (crt->cgroup_path)
|
||||
(void) serialize_item(f, "cgroup", crt->cgroup_path);
|
||||
if (crt->cgroup_id != 0)
|
||||
(void) serialize_item_format(f, "cgroup-id", "%" PRIu64, crt->cgroup_id);
|
||||
|
||||
(void) serialize_cgroup_mask(f, "cgroup-realized-mask", crt->cgroup_realized_mask);
|
||||
(void) serialize_cgroup_mask(f, "cgroup-enabled-mask", crt->cgroup_enabled_mask);
|
||||
(void) serialize_cgroup_mask(f, "cgroup-invalidated-mask", crt->cgroup_invalidated_mask);
|
||||
|
||||
(void) serialize_item_format(f, "cpu-usage-base", "%" PRIu64, crt->cpu_usage_base);
|
||||
if (crt->cpu_usage_last != NSEC_INFINITY)
|
||||
(void) serialize_item_format(f, "cpu-usage-last", "%" PRIu64, crt->cpu_usage_last);
|
||||
@@ -4316,15 +4325,6 @@ int cgroup_runtime_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
(void) serialize_item_format(f, io_accounting_metric_field_last_to_string(im), "%" PRIu64, crt->io_accounting_last[im]);
|
||||
}
|
||||
|
||||
if (crt->cgroup_path)
|
||||
(void) serialize_item(f, "cgroup", crt->cgroup_path);
|
||||
if (crt->cgroup_id != 0)
|
||||
(void) serialize_item_format(f, "cgroup-id", "%" PRIu64, crt->cgroup_id);
|
||||
|
||||
(void) serialize_cgroup_mask(f, "cgroup-realized-mask", crt->cgroup_realized_mask);
|
||||
(void) serialize_cgroup_mask(f, "cgroup-enabled-mask", crt->cgroup_enabled_mask);
|
||||
(void) serialize_cgroup_mask(f, "cgroup-invalidated-mask", crt->cgroup_invalidated_mask);
|
||||
|
||||
(void) bpf_socket_bind_serialize(u, f, fds);
|
||||
|
||||
(void) bpf_program_serialize_attachment(f, fds, "ip-bpf-ingress-installed", crt->ip_bpf_ingress_installed);
|
||||
@@ -4351,7 +4351,7 @@ int cgroup_runtime_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
log_unit_debug_errno(u, _deserialize_r, \
|
||||
"Failed to parse \"%s=%s\", ignoring.", l, v); \
|
||||
else \
|
||||
crt->target = _deserialize_r; \
|
||||
crt->target = _deserialize_r; \
|
||||
} \
|
||||
} \
|
||||
_deserialize_matched; \
|
||||
@@ -4374,7 +4374,7 @@ int cgroup_runtime_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
_deserialize_matched; \
|
||||
})
|
||||
|
||||
#define MATCH_DESERIALIZE_METRIC(u, key, l, v, parse_func, target) \
|
||||
#define MATCH_DESERIALIZE_METRIC(u, key, l, v, parse_func, target) \
|
||||
({ \
|
||||
bool _deserialize_matched = streq(l, key); \
|
||||
if (_deserialize_matched) { \
|
||||
@@ -4387,7 +4387,7 @@ int cgroup_runtime_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
log_unit_debug_errno(u, _deserialize_r, \
|
||||
"Failed to parse \"%s=%s\", ignoring.", l, v); \
|
||||
else \
|
||||
crt->target = _deserialize_r; \
|
||||
crt->target = _deserialize_r; \
|
||||
} \
|
||||
} \
|
||||
_deserialize_matched; \
|
||||
|
||||
Reference in New Issue
Block a user