]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: Tone down cgroup path resolution
authorMichal Koutný <mkoutny@suse.com>
Fri, 21 Feb 2025 09:29:26 +0000 (10:29 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 25 Feb 2025 18:21:08 +0000 (10:21 -0800)
Sockets and cgroups have different lifetimes (e.g. fd passing between
cgroups) so obtaining a cgroup id to a removed cgroup dir is not an
error. Furthermore, the message is printed for each such a socket (which
is redundant each such socket's cgroup is shown as 'unreachable').
Improve user experience by silencing these specific errors.

Signed-off-by: Michal Koutný <mkoutny@suse.com>
lib/fs.c

index 622f28b35536b3d94c5e2b51daba9782e4fad483..6fe1d6db4ee0287a24874874b6e81143d44f7e6f 100644 (file)
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -223,7 +223,8 @@ char *get_cgroup2_path(__u64 id, bool full)
 
        fd = open_by_handle_at(mnt_fd, fhp, 0);
        if (fd < 0) {
-               fprintf(stderr, "Failed to open cgroup2 by ID\n");
+               if (errno != ESTALE)
+                       fprintf(stderr, "Failed to open cgroup2 by ID\n");
                goto out;
        }