Re: mount --bind behaviour | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Tue, Sep 25, 2007 at 11:53:07AM +0200, Matthias Koenig wrote:
> 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 this has to be fixed. These patches are already in -mm. So ..
2.6.24 (probably;-).
> 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.
Yes, I agree -- with exception for kernels with r/o bind mounts where
we need to modify rw/ro option. I think we can implement the support
for r/o bind mounts already now. Something like:
if (linux_version_code() >= MAKE_VERSION(2,6,24)))
... modify rw/ro ...
else
... blindly clone options ...
Grrr, mtab is hell.
Karel
--
Karel Zak <kzak@xxxxxxxxxx>
-
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
[Site Home] [Netdev] [Ethernet Bridging] [Linux Wireless] [Kernel Newbies] [Memory] [Security] [Linux for Hams] [Netfilter] [Bugtraq] [Rubini] [Photo] [Yosemite] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux RAID] [Linux Admin] [Samba] [Video 4 Linux] [Linux Resources]