mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
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.
This commit is contained in:
parent
72fecf1813
commit
e50457dd4c
@ -1597,11 +1597,15 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef,
|
|||||||
if (STREQ(vmDef->fss[i]->dst, "/"))
|
if (STREQ(vmDef->fss[i]->dst, "/"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src, vmDef->fss[i]->dst);
|
||||||
|
|
||||||
if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
|
if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
|
||||||
return -1;
|
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;
|
return -1;
|
||||||
|
|
||||||
if (lxcContainerMountFS(vmDef->fss[i], sec_mount_options) < 0)
|
if (lxcContainerMountFS(vmDef->fss[i], sec_mount_options) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user