]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lsns: show namespaces only kept alive by open file descriptors
authorMasatake YAMATO <yamato@redhat.com>
Sat, 24 Feb 2024 19:56:51 +0000 (04:56 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Tue, 2 Apr 2024 14:44:25 +0000 (23:44 +0900)
commit7d5036fdafe0498a09146a5637a9f7f8351e6e72
tree34aab78d58f09e7ab6e828e3ce3e35ac4d3f95f9
parentd6cdbf8d0d1dcfdb73d138b524acdea6575ead73
lsns: show namespaces only kept alive by open file descriptors

Close #1884.

Quoted from the original issue comment submitted by @hesch:

  It can happen, that a namespace is only kept alive by an open file
  descriptor of a program as ilustrated by A.B:

    1. 'ip netns add foo' - add a namespace
    2. 'sleep 999 4< /run/netns/foo & sleep 2' - open the fd to the
       namespace in a background job
    3. 'ip netns delete foo' - delete the namespace (only deletes
       the /run/netns/foo)

  Now there exists a namespace with no process running in it and it has
  no bind mount so it does not show up in /proc/mounts, but it is still
  there and could be mounted back.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
sys-utils/lsns.c
tests/ts/lsns/filedesc [new file with mode: 0755]