]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Fix startup of LXC containers with filesystems containing symlinks
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 17 Jan 2012 21:33:02 +0000 (21:33 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 18 Jan 2012 13:34:42 +0000 (13:34 +0000)
commitc53ba61b21b09fdf2ce0b4cf97565566a56a2f32
tree82dab207a7344cbf56115dd47c3ba2fce34980ae
parent7aeb9794d235f8383c6901957f6e464e1f206b58
Fix startup of LXC containers with filesystems containing symlinks

Given an LXC guest with a root filesystem path of

  /export/lxc/roots/helloworld/root

During startup, we will pivot the root filesystem to end up
at

  /.oldroot/export/lxc/roots/helloworld/root

We then try to open

  /.oldroot/export/lxc/roots/helloworld/root/dev/pts

Now consider if '/export/lxc' is an absolute symlink pointing
to '/media/lxc'. The kernel will try to open

  /media/lxc/roots/helloworld/root/dev/pts

whereas it should be trying to open

  /.oldroot//media/lxc/roots/helloworld/root/dev/pts

To deal with the fact that the root filesystem can be moved,
we need to resolve symlinks in *any* part of the filesystem
source path.

* src/libvirt_private.syms, src/util/util.c,
  src/util/util.h: Add virFileResolveAllLinks to resolve
  all symlinks in a path
* src/lxc/lxc_container.c: Resolve all symlinks in filesystem
  paths during startup
src/libvirt_private.syms
src/lxc/lxc_container.c
src/util/util.c
src/util/util.h