netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] lib: ignore invalid mounts in cg_init_map
@ 2020-10-08 17:59 Dmitry Yakunin
  2020-10-08 18:17 ` Donald Sharp
  2020-10-12  6:03 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Yakunin @ 2020-10-08 17:59 UTC (permalink / raw)
  To: sharpd, dsahern, netdev

In case of bad entries in /proc/mounts just skip cgroup cache initialization.
Cgroups in output will be shown as "unreachable:cgroup_id".

Fixes: d5e6ee0dac64 ("ss: introduce cgroup2 cache and helper functions")
Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Reported-by: Donald Sharp <sharpd@nvidia.com>
---
 lib/cg_map.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/cg_map.c b/lib/cg_map.c
index 77f030e..39f244d 100644
--- a/lib/cg_map.c
+++ b/lib/cg_map.c
@@ -96,11 +96,10 @@ static void cg_init_map(void)
 
 	mnt = find_cgroup2_mount(false);
 	if (!mnt)
-		exit(1);
+		return;
 
 	mntlen = strlen(mnt);
-	if (nftw(mnt, nftw_fn, 1024, FTW_MOUNT) < 0)
-		exit(1);
+	(void) nftw(mnt, nftw_fn, 1024, FTW_MOUNT);
 
 	free(mnt);
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2] lib: ignore invalid mounts in cg_init_map
  2020-10-08 17:59 [PATCH iproute2] lib: ignore invalid mounts in cg_init_map Dmitry Yakunin
@ 2020-10-08 18:17 ` Donald Sharp
  2020-10-12  6:03 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Donald Sharp @ 2020-10-08 18:17 UTC (permalink / raw)
  To: Dmitry Yakunin, dsahern, netdev

I've tested this patch and it works for me.

donald

On 10/8/20, 2:00 PM, "Dmitry Yakunin" <zeil@yandex-team.ru> wrote:

    External email: Use caution opening links or attachments


    In case of bad entries in /proc/mounts just skip cgroup cache initialization.
    Cgroups in output will be shown as "unreachable:cgroup_id".

    Fixes: d5e6ee0dac64 ("ss: introduce cgroup2 cache and helper functions")
    Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
    Reported-by: Donald Sharp <sharpd@nvidia.com>
    ---
     lib/cg_map.c | 5 ++---
     1 file changed, 2 insertions(+), 3 deletions(-)

    diff --git a/lib/cg_map.c b/lib/cg_map.c
    index 77f030e..39f244d 100644
    --- a/lib/cg_map.c
    +++ b/lib/cg_map.c
    @@ -96,11 +96,10 @@ static void cg_init_map(void)

            mnt = find_cgroup2_mount(false);
            if (!mnt)
    -               exit(1);
    +               return;

            mntlen = strlen(mnt);
    -       if (nftw(mnt, nftw_fn, 1024, FTW_MOUNT) < 0)
    -               exit(1);
    +       (void) nftw(mnt, nftw_fn, 1024, FTW_MOUNT);

            free(mnt);
     }
    --
    2.7.4



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2] lib: ignore invalid mounts in cg_init_map
  2020-10-08 17:59 [PATCH iproute2] lib: ignore invalid mounts in cg_init_map Dmitry Yakunin
  2020-10-08 18:17 ` Donald Sharp
@ 2020-10-12  6:03 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2020-10-12  6:03 UTC (permalink / raw)
  To: Dmitry Yakunin; +Cc: sharpd, dsahern, netdev

On Thu,  8 Oct 2020 20:59:27 +0300
Dmitry Yakunin <zeil@yandex-team.ru> wrote:

> In case of bad entries in /proc/mounts just skip cgroup cache initialization.
> Cgroups in output will be shown as "unreachable:cgroup_id".
> 
> Fixes: d5e6ee0dac64 ("ss: introduce cgroup2 cache and helper functions")
> Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
> Reported-by: Donald Sharp <sharpd@nvidia.com>

Applied with one suggestion.
This code has no comments so it is not obvious exactly what it is doing.
Some explanations would help the next person.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-12  6:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 17:59 [PATCH iproute2] lib: ignore invalid mounts in cg_init_map Dmitry Yakunin
2020-10-08 18:17 ` Donald Sharp
2020-10-12  6:03 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).