mount --bind behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

As far as my understanding of bind mounts is, that they get the mount
options of the source and cannot have different mount options.
This is what is stated in mount(2): 
"The filesystemtype, mountflags, and data arguments are ignored."

Lets say we have /test and bind mount it to /mnt
# mount --bind /test /mnt
# mount
/test on /mnt type none (rw,bind)

Now some people have the idea to do the bind mount read-only, of course
this is not possible since the mount syscall ignores additional options.
But:
# mount --bind -r /test /mnt
# mount
/test on /mnt type none (ro,bind)

The mount *program* thinks the mount is ro, which is opposite to
what /proc/mounts states:
# cat /proc/mounts
/dev/sda3 /mnt ext3 rw,data=ordered 0 0

We cannot just ignore additional options in mount, because the source
could have been mounted with different options (e.g. ro).
I think we will have to clone the options of the source in case
of bind mounts.

Matthias
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux