[root@localhost ~]# mount -t tmpfs /mnt/tmp /mnt/tmp
[root@localhost ~]# mkdir /mnt/tmp/rw
[root@localhost ~]# mount -o bind /mnt/tmp/rw /mnt/tmp/rw
[root@localhost ~]# mount -o bind,ro,remount /mnt/tmp/
[root@localhost ~]# cat /proc/self/mountinfo | grep "/mnt/tmp"
66 22 0:56 / /mnt/tmp rw,relatime shared:10 - tmpfs /mnt/tmp rw,rootcontext=system_u:object_r:mnt_t:s0,seclabel
69 66 0:56 /rw /mnt/tmp/rw ro,relatime shared:10 - tmpfs /mnt/tmp rw,rootcontext=system_u:object_r:mnt_t:s0,seclabel
Notice I told it to make /mnt/tmp ro, but instead /mnt/tmp/rw is ro!
strace shows for the bind mount on top of itself:
mount("/mnt/tmp/rw", "/mnt/tmp/rw", 0x7f56abe3d164, MS_MGC_VAL|MS_BIND, NULL) = 0
and it shows for the remount ro:
mount("/mnt/tmp", "/mnt/tmp/rw", 0x7fd660de1164, MS_RDONLY|MS_REMOUNT|MS_RELATIME|MS_BIND, "seclabel") = 0
See how /mnt/tmp/rw magic'd itself up in there? WTH?
mount -o bind,ro,remount /mnt/tmp /mnt/tmp
results in the right thing. Why does mount magic up /mnt/tmp/rw?
If (on remount) both <source> and <target> are not specified, then we use
for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev)
if (streq(mc->m.mnt_dir, name) ||
and that's wrong... we need to scan whole mtab (or mountinfo) for mc->m.mnt_dir and then in another loop for mc->m.mnt_fsname.
I'll fix it ASAP.
Note that in new (F17?) libmount based mount(8) command will be --target and --source command line options to avoid ambivalent interpretation of the dir|device command line argument.
Fixed by upstream commit 277a6dd53569a409e05316a7bdaed0e78e326762.
util-linux-2.20.1-1.fc16 has been submitted as an update for Fedora 16.
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing util-linux-2.20.1-1.fc16'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
util-linux-2.20.1-1.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report.