From 374c29fc883846477e2db7e77af13068b0fb177a Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 2 Dec 2023 15:23:51 +0800 Subject: [PATCH] shared/killall: correctly warn about rootfs daemon's root Follow-up for 9e615117dab5ede72eec22bf6369e0138f9dace5 We'll typically send signals to all remaining processes in the following cases: 1. pid1 (in initrd) when transitioning from initrd to sysroot: SIGTERM 2. pid1 (in sysroot) before transitioning back to initrd (exitrd): SIGTERM + SIGKILL 3. systemd-shutdown (in exitrd): SIGTERM + SIGKILL 'warn_rootfs' is set to true only when we're not in initrd and we're sending SIGKILL, which means the second case. So, we want to emit the warning when the root of the storage daemon IS the same as that of pid1, rather than the other way around. The condition is spuriously reversed in the offending commit. --- src/shared/killall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/killall.c b/src/shared/killall.c index 9c2babe7d28..330b4c3272d 100644 --- a/src/shared/killall.c +++ b/src/shared/killall.c @@ -101,7 +101,7 @@ static bool ignore_proc(const PidRef *pid, bool warn_rootfs) { return false; if (warn_rootfs && - pid_from_same_root_fs(pid->pid) == 0) { + pid_from_same_root_fs(pid->pid) > 0) { _cleanup_free_ char *comm = NULL;