32d58144fd
Some snapshotters (like overlayfs or zfs) can't mount the same directories twice. For example if the same directroy is used as an upper directory in two mounts the kernel will output this warning: overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior. And indeed accessing the files from both mounts will result in an "No such file or directory" error. This change introduces reference counts for the mounts, if a directory is already mounted the mount interface will only increment the mount counter and return the mount target effectively making sure that the filesystem doesn't end up in an undefined behavior. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
17 lines
333 B
Go
17 lines
333 B
Go
//go:build !windows
|
|
|
|
package snapshotter
|
|
|
|
import (
|
|
"github.com/containerd/containerd/mount"
|
|
"github.com/docker/docker/daemon/graphdriver"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func checker() graphdriver.Checker {
|
|
return graphdriver.NewDefaultChecker()
|
|
}
|
|
|
|
func unmount(target string) error {
|
|
return mount.Unmount(target, unix.MNT_DETACH)
|
|
}
|