<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - duplicate bind mounts"
href="https://bugs.freedesktop.org/show_bug.cgi?id=81695">81695</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>duplicate bind mounts
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bugfood-c@fatooh.org
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Product</th>
<td>systemd
</td>
</tr></table>
<p>
<div>
<pre>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@dpuppetcorey01 ~]# cd /mnt
[root@dpuppetcorey01 mnt]# mkdir foo bar
[root@dpuppetcorey01 mnt]# mount --bind / foo
[root@dpuppetcorey01 mnt]# mount | egrep '(foo|bar)'
/ on /mnt/foo type none (rw,bind)
[root@dpuppetcorey01 mnt]# # so far so good
[root@dpuppetcorey01 mnt]# mount --bind / bar
[root@dpuppetcorey01 mnt]# mount | egrep '(foo|bar)'
/ on /mnt/foo type none (rw,bind)
/ on /mnt/bar type none (rw,bind)
[root@dpuppetcorey01 mnt]# # still good
[root@dpuppetcorey01 mnt]# umount foo
[root@dpuppetcorey01 mnt]# umount bar
[root@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@dcoreytest01 ~]# cd /mnt
[root@dcoreytest01 mnt]# mkdir foo bar
[root@dcoreytest01 mnt]# mount --bind / foo
[root@dcoreytest01 mnt]# mount | egrep '(foo|bar)'
/dev/vda3 on /mnt/foo type ext4 (rw,relatime,data=ordered)
[root@dcoreytest01 mnt]# # so far so good
[root@dcoreytest01 mnt]# mount --bind / bar
[root@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@dcoreytest01 mnt]# # at this point, bar is mounted twice--undesirable
[root@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@dcoreytest01 mnt]# # help! let's try umounting the subdirectory
[root@dcoreytest01 mnt]# umount foo/mnt/bar
[root@dcoreytest01 mnt]# mount | egrep '(foo|bar)'
/dev/vda3 on /mnt/foo type ext4 (rw,relatime,data=ordered)
[root@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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>