moby/daemon/snapshotter
Djordje Lukic 32d58144fd c8d: Use reference counting while mounting a snapshot
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>
2023-06-07 15:50:01 +02:00
..
mount.go c8d: Use reference counting while mounting a snapshot 2023-06-07 15:50:01 +02:00
mount_default.go c8d: Use reference counting while mounting a snapshot 2023-06-07 15:50:01 +02:00
mount_windows.go c8d: Use reference counting while mounting a snapshot 2023-06-07 15:50:01 +02:00