What happens if the last process in a namespace exits?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I am running Linux.
I have a single process in a mount namespace.
I did in this process a mount -t tmpfs tmpfs /mountpoint
.
What happens if the process exits and there are no more processes in that mount namespace?
Will the filesystem be automatically unmounted?
Will the mount namespace be destroyed?
If the namespaces and the mount are still active how do I access it?
What happens to tun/tap/macvtap interfaces if a network namespace has no more processes?
linux namespace network-namespaces
add a comment |Â
up vote
4
down vote
favorite
I am running Linux.
I have a single process in a mount namespace.
I did in this process a mount -t tmpfs tmpfs /mountpoint
.
What happens if the process exits and there are no more processes in that mount namespace?
Will the filesystem be automatically unmounted?
Will the mount namespace be destroyed?
If the namespaces and the mount are still active how do I access it?
What happens to tun/tap/macvtap interfaces if a network namespace has no more processes?
linux namespace network-namespaces
1
I guess that nothing would happen. At least according to my understanding of namespaces(7)
â Basile Starynkevitch
Jun 25 '15 at 16:16
According to the manpage you refer, network interfaces in a names space will be handed back to the origin namespace. What happens to mounts in mount namespaces?
â abraXxl
Jun 26 '15 at 12:00
I really don't know; study the kernel's source code.
â Basile Starynkevitch
Jun 26 '15 at 12:42
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I am running Linux.
I have a single process in a mount namespace.
I did in this process a mount -t tmpfs tmpfs /mountpoint
.
What happens if the process exits and there are no more processes in that mount namespace?
Will the filesystem be automatically unmounted?
Will the mount namespace be destroyed?
If the namespaces and the mount are still active how do I access it?
What happens to tun/tap/macvtap interfaces if a network namespace has no more processes?
linux namespace network-namespaces
I am running Linux.
I have a single process in a mount namespace.
I did in this process a mount -t tmpfs tmpfs /mountpoint
.
What happens if the process exits and there are no more processes in that mount namespace?
Will the filesystem be automatically unmounted?
Will the mount namespace be destroyed?
If the namespaces and the mount are still active how do I access it?
What happens to tun/tap/macvtap interfaces if a network namespace has no more processes?
linux namespace network-namespaces
linux namespace network-namespaces
edited Jun 25 '15 at 15:47
Mikel
38k996123
38k996123
asked Jun 25 '15 at 15:40
abraXxl
384
384
1
I guess that nothing would happen. At least according to my understanding of namespaces(7)
â Basile Starynkevitch
Jun 25 '15 at 16:16
According to the manpage you refer, network interfaces in a names space will be handed back to the origin namespace. What happens to mounts in mount namespaces?
â abraXxl
Jun 26 '15 at 12:00
I really don't know; study the kernel's source code.
â Basile Starynkevitch
Jun 26 '15 at 12:42
add a comment |Â
1
I guess that nothing would happen. At least according to my understanding of namespaces(7)
â Basile Starynkevitch
Jun 25 '15 at 16:16
According to the manpage you refer, network interfaces in a names space will be handed back to the origin namespace. What happens to mounts in mount namespaces?
â abraXxl
Jun 26 '15 at 12:00
I really don't know; study the kernel's source code.
â Basile Starynkevitch
Jun 26 '15 at 12:42
1
1
I guess that nothing would happen. At least according to my understanding of namespaces(7)
â Basile Starynkevitch
Jun 25 '15 at 16:16
I guess that nothing would happen. At least according to my understanding of namespaces(7)
â Basile Starynkevitch
Jun 25 '15 at 16:16
According to the manpage you refer, network interfaces in a names space will be handed back to the origin namespace. What happens to mounts in mount namespaces?
â abraXxl
Jun 26 '15 at 12:00
According to the manpage you refer, network interfaces in a names space will be handed back to the origin namespace. What happens to mounts in mount namespaces?
â abraXxl
Jun 26 '15 at 12:00
I really don't know; study the kernel's source code.
â Basile Starynkevitch
Jun 26 '15 at 12:42
I really don't know; study the kernel's source code.
â Basile Starynkevitch
Jun 26 '15 at 12:42
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
It seems that the mounts remain, but become unaccessible.
I did the following as a test:
- Entered a new namespace and mounted tmpfs:
root@localhost:~# mkdir tmp
root@localhost:~# unshare -m bash
root@localhost:~# mount -t tmpfs tmpfs tmp
- Checked memory usage before and after creating a 200 megabyte file on the tmpfs. You can notice the "shared" usage going from 404 megabytes to 604 megabytes:
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 681 404 6237 6148
Swap: 8191 293 7898
root@localhost:~# dd if=/dev/urandom of=tmp/dummy bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 12.0075 s, 17.5 MB/s
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 481 604 6437 5948
Swap: 8191 293 7898
- Exited the unshare shell, the memory did not get reclaimed:
root@localhost:~# exit
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2963 484 604 6437 5951
Swap: 8191 293 7898
Whereas if I unmount the tmpfs, the shared
count goes back to initial value.
add a comment |Â
up vote
0
down vote
Cannot add a comment, because not enough rep, so here it goes:
I did exactly the same test as jpa on a unmodified debian stretch and the memory gets back to the initial value, even though I did NOT unmount. So it seems this behaviour has changed.
http://man7.org/linux/man-pages/man7/namespaces.7.html
implies this at least by saying:
Bind mounting (see mount(2)) one of the files in this directory to
somewhere else in the filesystem keeps the corresponding namespace of
the process specified by pid alive even if all processes currently in
the namespace terminate.
So not doing that destroys the namespace (?).
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
It seems that the mounts remain, but become unaccessible.
I did the following as a test:
- Entered a new namespace and mounted tmpfs:
root@localhost:~# mkdir tmp
root@localhost:~# unshare -m bash
root@localhost:~# mount -t tmpfs tmpfs tmp
- Checked memory usage before and after creating a 200 megabyte file on the tmpfs. You can notice the "shared" usage going from 404 megabytes to 604 megabytes:
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 681 404 6237 6148
Swap: 8191 293 7898
root@localhost:~# dd if=/dev/urandom of=tmp/dummy bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 12.0075 s, 17.5 MB/s
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 481 604 6437 5948
Swap: 8191 293 7898
- Exited the unshare shell, the memory did not get reclaimed:
root@localhost:~# exit
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2963 484 604 6437 5951
Swap: 8191 293 7898
Whereas if I unmount the tmpfs, the shared
count goes back to initial value.
add a comment |Â
up vote
2
down vote
It seems that the mounts remain, but become unaccessible.
I did the following as a test:
- Entered a new namespace and mounted tmpfs:
root@localhost:~# mkdir tmp
root@localhost:~# unshare -m bash
root@localhost:~# mount -t tmpfs tmpfs tmp
- Checked memory usage before and after creating a 200 megabyte file on the tmpfs. You can notice the "shared" usage going from 404 megabytes to 604 megabytes:
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 681 404 6237 6148
Swap: 8191 293 7898
root@localhost:~# dd if=/dev/urandom of=tmp/dummy bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 12.0075 s, 17.5 MB/s
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 481 604 6437 5948
Swap: 8191 293 7898
- Exited the unshare shell, the memory did not get reclaimed:
root@localhost:~# exit
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2963 484 604 6437 5951
Swap: 8191 293 7898
Whereas if I unmount the tmpfs, the shared
count goes back to initial value.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
It seems that the mounts remain, but become unaccessible.
I did the following as a test:
- Entered a new namespace and mounted tmpfs:
root@localhost:~# mkdir tmp
root@localhost:~# unshare -m bash
root@localhost:~# mount -t tmpfs tmpfs tmp
- Checked memory usage before and after creating a 200 megabyte file on the tmpfs. You can notice the "shared" usage going from 404 megabytes to 604 megabytes:
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 681 404 6237 6148
Swap: 8191 293 7898
root@localhost:~# dd if=/dev/urandom of=tmp/dummy bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 12.0075 s, 17.5 MB/s
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 481 604 6437 5948
Swap: 8191 293 7898
- Exited the unshare shell, the memory did not get reclaimed:
root@localhost:~# exit
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2963 484 604 6437 5951
Swap: 8191 293 7898
Whereas if I unmount the tmpfs, the shared
count goes back to initial value.
It seems that the mounts remain, but become unaccessible.
I did the following as a test:
- Entered a new namespace and mounted tmpfs:
root@localhost:~# mkdir tmp
root@localhost:~# unshare -m bash
root@localhost:~# mount -t tmpfs tmpfs tmp
- Checked memory usage before and after creating a 200 megabyte file on the tmpfs. You can notice the "shared" usage going from 404 megabytes to 604 megabytes:
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 681 404 6237 6148
Swap: 8191 293 7898
root@localhost:~# dd if=/dev/urandom of=tmp/dummy bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 12.0075 s, 17.5 MB/s
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2966 481 604 6437 5948
Swap: 8191 293 7898
- Exited the unshare shell, the memory did not get reclaimed:
root@localhost:~# exit
root@localhost:~# free -m
total used free shared buff/cache available
Mem: 9885 2963 484 604 6437 5951
Swap: 8191 293 7898
Whereas if I unmount the tmpfs, the shared
count goes back to initial value.
answered Mar 1 '17 at 8:52
jpa
56327
56327
add a comment |Â
add a comment |Â
up vote
0
down vote
Cannot add a comment, because not enough rep, so here it goes:
I did exactly the same test as jpa on a unmodified debian stretch and the memory gets back to the initial value, even though I did NOT unmount. So it seems this behaviour has changed.
http://man7.org/linux/man-pages/man7/namespaces.7.html
implies this at least by saying:
Bind mounting (see mount(2)) one of the files in this directory to
somewhere else in the filesystem keeps the corresponding namespace of
the process specified by pid alive even if all processes currently in
the namespace terminate.
So not doing that destroys the namespace (?).
add a comment |Â
up vote
0
down vote
Cannot add a comment, because not enough rep, so here it goes:
I did exactly the same test as jpa on a unmodified debian stretch and the memory gets back to the initial value, even though I did NOT unmount. So it seems this behaviour has changed.
http://man7.org/linux/man-pages/man7/namespaces.7.html
implies this at least by saying:
Bind mounting (see mount(2)) one of the files in this directory to
somewhere else in the filesystem keeps the corresponding namespace of
the process specified by pid alive even if all processes currently in
the namespace terminate.
So not doing that destroys the namespace (?).
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Cannot add a comment, because not enough rep, so here it goes:
I did exactly the same test as jpa on a unmodified debian stretch and the memory gets back to the initial value, even though I did NOT unmount. So it seems this behaviour has changed.
http://man7.org/linux/man-pages/man7/namespaces.7.html
implies this at least by saying:
Bind mounting (see mount(2)) one of the files in this directory to
somewhere else in the filesystem keeps the corresponding namespace of
the process specified by pid alive even if all processes currently in
the namespace terminate.
So not doing that destroys the namespace (?).
Cannot add a comment, because not enough rep, so here it goes:
I did exactly the same test as jpa on a unmodified debian stretch and the memory gets back to the initial value, even though I did NOT unmount. So it seems this behaviour has changed.
http://man7.org/linux/man-pages/man7/namespaces.7.html
implies this at least by saying:
Bind mounting (see mount(2)) one of the files in this directory to
somewhere else in the filesystem keeps the corresponding namespace of
the process specified by pid alive even if all processes currently in
the namespace terminate.
So not doing that destroys the namespace (?).
answered Sep 10 at 17:45
spawn
261
261
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f212172%2fwhat-happens-if-the-last-process-in-a-namespace-exits%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
I guess that nothing would happen. At least according to my understanding of namespaces(7)
â Basile Starynkevitch
Jun 25 '15 at 16:16
According to the manpage you refer, network interfaces in a names space will be handed back to the origin namespace. What happens to mounts in mount namespaces?
â abraXxl
Jun 26 '15 at 12:00
I really don't know; study the kernel's source code.
â Basile Starynkevitch
Jun 26 '15 at 12:42