All of lore.kernel.org
 help / color / mirror / Atom feed
* overlayfs does not pin underlying layers
@ 2019-12-03 13:49 Fabian Vogt
  2019-12-03 14:19 ` Miklos Szeredi
  0 siblings, 1 reply; 5+ messages in thread
From: Fabian Vogt @ 2019-12-03 13:49 UTC (permalink / raw)
  To: linux-unionfs; +Cc: iforster

Hi,

I noticed that you can still unmount the lower/upper/work layers, even if
they're currently part of an active overlay mount. This is the case even when
files in the overlay mount are currently open. After unmounting, the usual
effects of a lazy umount can be observed, like still active loop devices.

Is this intentional? From a quick look, for open files this might be a side
effect of using open_with_fake_path, but just getting a reference to the paths
in ovl_mount_dir and preventing unmounting for the duration of the overlay
mount would cover that as well AFAICT.

Thanks,
Fabian

---< demo script >---

#!/bin/bash
set -euxo pipefail

tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT
mkdir ${tmpdir}/{lower,upper,work,mount}

# Create ext4 fs, mount as lower
dd if=/dev/zero of=${tmpdir}/fs.img bs=1M count=10
mkfs.ext4 -q ${tmpdir}/fs.img
mount ${tmpdir}/fs.img ${tmpdir}/lower

# Create a file
echo "This is in lower" > ${tmpdir}/lower/lowerfile

# Mount overlayfs
mount -t overlay overlay ${tmpdir}/mount -o lowerdir=${tmpdir}/lower,workdir=${tmpdir}/work,upperdir=${tmpdir}/upper

# Open the file and print its contentghzogo8ugz312 iutv123u1
exec 3<${tmpdir}/mount/lowerfile
cat <&3

# Umount the lower fs
umount ${tmpdir}/lower && echo "Lower successfully unmounted"

# Show that the overlay mount is still there
mountpoint -q ${tmpdir}/lower || echo "Lower is not mounted anymore"
mountpoint -q ${tmpdir}/mount && echo "Overlay still mounted"
cat ${tmpdir}/mount/lowerfile

# Clean up
exec 3<&-
umount ${tmpdir}/mount

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-12-04 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 13:49 overlayfs does not pin underlying layers Fabian Vogt
2019-12-03 14:19 ` Miklos Szeredi
2019-12-04 17:05   ` Fabian Vogt
2019-12-04 17:56     ` Amir Goldstein
2019-12-04 20:36     ` Miklos Szeredi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.