• D
    Workaround for broken kernel autofs mounts · 878cc33a
    Daniel P. Berrange 提交于
    The kernel automounter is mostly broken wrt to containers. Most
    notably if you start a new filesystem namespace and then attempt
    to unmount any autofs filesystem, it will typically fail with a
    weird error message like
    
      Failed to unmount '/.oldroot/sys/kernel/security':Too many levels of symbolic links
    
    Attempting to detach the autofs mount using umount2(MNT_DETACH)
    will also fail with the same error. Therefore if we get any error on
    unmount()ing a filesystem from the old root FS when starting a
    container, we must immediately break out and detach the entire
    old root filesystem (ignoring any mounts below it).
    
    This has the effect of making the old root filesystem inaccessible
    to anything inside the container, but at the cost that the mounts
    live on in the kernel until the container exits. Given that SystemD
    uses autofs by default, we need LXC to be robust this scenario and
    thus this tradeoff is worthwhile.
    
    * src/lxc/lxc_container.c: Detach root filesystem if any umount
      operation fails.
    878cc33a
lxc_container.c 35.3 KB