Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid unnecessary nested mounts in container mode
If directory modes for /foo and /foo/bar are given, and these two modes are the same, and /foo/bar is not already a mountpoint, there is no point in doing something for /foo/bar: The directory mode for /foo will apply to /foo/bar as well anyway. Avoiding these useless nested mounts is especially good for overlay mounts: Overlayfs complains (in the kernel log) if we first use .../temp/foo as upper directory of an overlayfs instance and then use .../temp/foo/bar as an upper directory of another overlayfs instance as well. The message says that we should not create overlayfs instances with overlapping upper directories. With the change of this commit we do this less often, we only create overlapping overlayfs mounts in the following two situations: a) if /foo and /foo/bar are both overlays and on different file systems, but currently this fails anyway due to #776; and b) if /foo is an overlay, /foo/bar is something else, and /foo/bar/child is an overlay again. However, so far this has worked without problems. This is likely because if we use both .../temp/foo and .../temp/foo/bar/child as upper directories for two overlayfs instances, we will never actually access the bar/child directory through the former instance. Each actual directory in the upper directory is accessed only via a single overlayfs instance.
- Loading branch information