Summary: | sys-apps/systemd-212-r5 unmounts the sources of rbind mounts | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Khumba <bog> |
Component: | [OLD] Core system | Assignee: | Gentoo systemd Team <systemd> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
emerge --info
rbind-test.sh rbind-test.openrc.out rbind-test.systemd.out |
Description
Khumba
2014-07-12 16:58:51 UTC
Created attachment 380638 [details]
emerge --info
Created attachment 380640 [details]
rbind-test.sh
Created attachment 380642 [details]
rbind-test.openrc.out
Created attachment 380644 [details]
rbind-test.systemd.out
Forgot to mention: using mount --bind to manually mount subdirectories, unmounting under systemd works okay: ~ # mount --bind /dev foo ~ # mount --bind /dev/pts foo/pts ~ # mount --bind /dev/shm foo/shm ~ # mount | grep -e /dev -e /foo | grep -v /sda devtmpfs on /dev type devtmpfs (rw,nosuid,size=1869668k,nr_inodes=467417,mode=755) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620) hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) mqueue on /dev/mqueue type mqueue (rw,relatime) devtmpfs on /root/foo type devtmpfs (rw,nosuid,size=1869668k,nr_inodes=467417,mode=755) devpts on /root/foo/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620) tmpfs on /root/foo/shm type tmpfs (rw,nosuid,nodev) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) ~ # umount foo/pts ~ # umount foo/shm ~ # umount foo ~ # mount | grep -e /dev -e /foo | grep -v /sda devtmpfs on /dev type devtmpfs (rw,nosuid,size=1869668k,nr_inodes=467417,mode=755) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620) hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) mqueue on /dev/mqueue type mqueue (rw,relatime) This seems to be some quirk of shared subtrees. systemd mounts everything as shared by default. See mount(8) for more info. If you run this before trying to umount the bind mounts, it should work ok. mount --make-rprivate /foo You can also make this the default using a simple oneshot service unit. http://lists.freedesktop.org/archives/systemd-devel/2013-February/008586.html I'm not sure if this umount behavior with recursive shared bind mounts is a bug, or intentional behavior. However, that would be a topic for a kernel mailing list. I had completely missed the different subtree mount modes, thanks for the insight. Reading /usr/src/linux/Documentation/filesystems/sharedsubtree.txt, it sounds like umounts being propagated is intended for 'shared' mounts. Also thanks for the reference to making this system-wide -- I should look into this, but for now I've settled on this to unmount: mount | cut -d' ' -f3 | while read mountpoint; do if [[ $mountpoint = ${chrootBase}* ]]; then mount --make-rprivate "$mountpoint" fi done mount | cut -d' ' -f3 | tac | while read mountpoint; do if [[ $mountpoint = ${chrootBase}* ]]; then umount "$mountpoint" fi done Closing, as I'm not trying to change systemd in this bug :). |