journald: correctly attribute log messages also with cgroupsv1
authorMichal Sekletar <msekleta@redhat.com>
Fri, 14 Dec 2018 14:17:27 +0000 (15:17 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 17 Dec 2018 14:16:11 +0000 (15:16 +0100)
commit672773b63a4ebf95242b27e63071b93073ebc1f5
tree913fbf041c45777031c794c49056e63b1132fab2
parenta9238f6a33d6cdb68c31e5503690df08abf4c02a
journald: correctly attribute log messages also with cgroupsv1

With cgroupsv1 a zombie process is migrated to root cgroup in all
hierarchies. This was changed for unified hierarchy and /proc/PID/cgroup
reports cgroup to which process belonged before it exited.

Be more suspicious about cgroup path reported by the kernel and use
unit_id provided by the log client if the kernel reports that process is
running in the root cgroup.

Users tend to care the most about 'log->unit_id' mapping so systemctl
status can correctly report last log lines. Also we wouldn't be able to
infer anything useful from "/" path anyway.

See: https://github.com/torvalds/linux/commit/2e91fa7f6d451e3ea9fec999065d2fd199691f9d
src/journal/journald-context.c