SHA256
1
0
forked from pool/libvirt
libvirt/e50457d-lxc-unmount-check.patch
2014-12-03 12:25:32 +00:00

43 lines
1.6 KiB
Diff

From e50457dd4cc5d4ba1ac7b05734157524620d087f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
Date: Mon, 24 Nov 2014 15:10:19 +0100
Subject: [PATCH 5/5] lxc: don't unmount subtree if it contains the source of
the mount
The typical case where we had a problem is with such a filesystem
definition as created by virt-sandbox-service:
<filesystem type='bind' accessmode='passthrough'>
<source dir='/var/lib/libvirt/filesystems/mysshd/var'/>
<target dir='/var'/>
</filesystem>
In this case, we don't want to unmount the /var subtree or we may
loose the access to the source folder.
---
src/lxc/lxc_container.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: libvirt-1.2.10/src/lxc/lxc_container.c
===================================================================
--- libvirt-1.2.10.orig/src/lxc/lxc_container.c
+++ libvirt-1.2.10/src/lxc/lxc_container.c
@@ -1600,11 +1600,15 @@ static int lxcContainerMountAllFS(virDom
if (STREQ(vmDef->fss[i]->dst, "/"))
continue;
+ VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src, vmDef->fss[i]->dst);
+
if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
return -1;
- if (lxcContainerUnmountSubtree(vmDef->fss[i]->dst,
- false) < 0)
+
+ if (!(vmDef->fss[i]->src &&
+ STRPREFIX(vmDef->fss[i]->src, vmDef->fss[i]->dst)) &&
+ lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0)
return -1;
if (lxcContainerMountFS(vmDef->fss[i], sec_mount_options) < 0)