[systemd-bugs] [Bug 81695] New: duplicate bind mounts
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Jul 23 19:27:41 PDT 2014
https://bugs.freedesktop.org/show_bug.cgi?id=81695
Priority: medium
Bug ID: 81695
Assignee: systemd-bugs at lists.freedesktop.org
Summary: duplicate bind mounts
QA Contact: systemd-bugs at lists.freedesktop.org
Severity: normal
Classification: Unclassified
OS: Linux (All)
Reporter: bugfood-c at fatooh.org
Hardware: All
Status: NEW
Version: unspecified
Component: general
Product: systemd
Hi,
I'm not absolutely certain this is due to systemd, but I cannot reproduce it
when booted with "init=/bin/bash". I can reproduce it on debian unstable and on
centos 7, but not on any non-systemd OS. My apologies if I'm wrong about the
reason.
Expected behavior: Bind mounts are nonrecursive, and anything mounted outside
the bind mount's target will not be reflected inside the bind mount.
Example: centos 6.5
[root at dpuppetcorey01 ~]# cd /mnt
[root at dpuppetcorey01 mnt]# mkdir foo bar
[root at dpuppetcorey01 mnt]# mount --bind / foo
[root at dpuppetcorey01 mnt]# mount | egrep '(foo|bar)'
/ on /mnt/foo type none (rw,bind)
[root at dpuppetcorey01 mnt]# # so far so good
[root at dpuppetcorey01 mnt]# mount --bind / bar
[root at dpuppetcorey01 mnt]# mount | egrep '(foo|bar)'
/ on /mnt/foo type none (rw,bind)
/ on /mnt/bar type none (rw,bind)
[root at dpuppetcorey01 mnt]# # still good
[root at dpuppetcorey01 mnt]# umount foo
[root at dpuppetcorey01 mnt]# umount bar
[root at dpuppetcorey01 mnt]# # all good
Observed behavior: Any mount (bind or otherwise) made to a subdirectory within
the source of a bind mount is propagated to the corresponding subdirectory
within the bind mount, resulting in an unwanted duplicate. This only applies to
mounts made _after_ the bind mount has been made. Also, these bind mounts
prevent the original bind mount from being umounted. Attempting to umount the
unwanted extra mount also umounts the original.
Example: centos 7.0
[root at dcoreytest01 ~]# cd /mnt
[root at dcoreytest01 mnt]# mkdir foo bar
[root at dcoreytest01 mnt]# mount --bind / foo
[root at dcoreytest01 mnt]# mount | egrep '(foo|bar)'
/dev/vda3 on /mnt/foo type ext4 (rw,relatime,data=ordered)
[root at dcoreytest01 mnt]# # so far so good
[root at dcoreytest01 mnt]# mount --bind / bar
[root at dcoreytest01 mnt]# mount | egrep '(foo|bar)'
/dev/vda3 on /mnt/foo type ext4 (rw,relatime,data=ordered)
/dev/vda3 on /mnt/bar type ext4 (rw,relatime,data=ordered)
/dev/vda3 on /mnt/foo/mnt/bar type ext4 (rw,relatime,data=ordered)
[root at dcoreytest01 mnt]# # at this point, bar is mounted twice--undesirable
[root at dcoreytest01 mnt]# umount foo
umount: /mnt/foo: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root at dcoreytest01 mnt]# # help! let's try umounting the subdirectory
[root at dcoreytest01 mnt]# umount foo/mnt/bar
[root at dcoreytest01 mnt]# mount | egrep '(foo|bar)'
/dev/vda3 on /mnt/foo type ext4 (rw,relatime,data=ordered)
[root at dcoreytest01 mnt]# # oh no, that got rid of both of them!
Both of the systems I can reproduce this on (debian unstable and centos 7) are
running sytemd 208.
# systemctl --version
systemd 208
+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ
I would test this on a newer version of systemd, but I'm kind of afraid of
messing with it since it's so integrated with the distribution. I would be
happy to test patches, though, since I can probably apply them to the
distributions' versions.
Thanks,
Corey
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20140724/a7c60f8d/attachment.html>
More information about the systemd-bugs
mailing list