chiark / gitweb /
shutdown: do final unmounting only if not running inside the container
authorMichal Sekletar <msekleta@redhat.com>
Tue, 21 Oct 2014 16:38:42 +0000 (18:38 +0200)
committerMichal Sekletar <msekleta@redhat.com>
Mon, 27 Oct 2014 11:20:15 +0000 (12:20 +0100)
If we run in the container then we run in a mount namespace. If namespace dies
then kernel should do unmounting for us, hence we skip unmounting in containers.

Also, it may be the case that we no longer have capability to do umount,
because we are running in the unprivileged container.

See: http://lists.freedesktop.org/archives/systemd-devel/2014-October/023536.html

src/core/shutdown.c

index d361cbe631e45593dfc8b472186ae74d5bf8d0d6..20cf526ba2716b34fe1a2fc9bde05a396b160502 100644 (file)
@@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
 
         in_container = detect_container(NULL) > 0;
 
-        need_umount = true;
+        need_umount = !in_container;
         need_swapoff = !in_container;
         need_loop_detach = !in_container;
         need_dm_detach = !in_container;