Mailinglist Archive: opensuse-kernel (75 mails)

< Previous Next >
Re: [opensuse-kernel] Problems with bind mount on OpenSUSE 11.4
On Sun, Mar 13, 2011 at 06:03:20PM +0100, richard -rw- weinberger wrote:
Hi,

bind mounts seem not to work as expected on OpenSUSE 11.4.

Yes, it behaves slightly different as a consequence of making
/etc/mtab a symlink to /proc/self/mounts.

It's documented in mount(8):
---------
Note that behavior of the remount operation depends on the
/etc/mtab file. The first command stores the 'bind' flag to the
/etc/mtab file and the second command reads the flag from the
file. If you have a system without the /etc/mtab file or if you
explicitly define source and target for the remount command (then
mount(8) does not read /etc/mtab), then you have to use bind flag (or
option) for the remount command too. For example:

mount --bind olddir newdir
mount -o remount,ro,bind olddir newdir
---------

E.g:
$ mount /home /mnt -o bind
$ mount | grep mnt
/dev/sda1 on /mnt type ext3
(rw,relatime,errors=continue,user_xattr,acl,commit=600,barrier=0,data=ordered)
$ mount | grep sda1
/dev/sda1 on / type ext3
(rw,relatime,errors=continue,user_xattr,acl,commit=600,barrier=0,data=ordered)
/dev/sda1 on /mnt type ext3
(rw,relatime,errors=continue,user_xattr,acl,commit=600,barrier=0,data=ordered)

mount shows me the for both / and /mnt /dev/sda1 as device.

Information about bind mounts is missing in /proc/self/mounts and thus
also in /etc/mtab. AFAIK this should and will be resolved with new
util-linux, which will store the bind information into
/dev/.mount/utab or something similar.


The expected output is:
/home on /mnt type none (rw,bind)

The read-only bind mount also does not work.
$ mount -o bind,ro /home /mnt
mount: warning: /mnt seems to be mounted read-write.
$ mount | grep mnt
/dev/sda1 on /mnt type ext3
(rw,relatime,errors=continue,user_xattr,acl,commit=600,barrier=0,data=ordered)

Try this:
mount -o bind /home /mnt
mount -o remount,ro,bind /mnt


I can reproduce this on OpenSUSE 11.4 using
kernel-desktop-2.6.37.1-1.2.2.i586,
kernel-vanilla-2.6.37.1-1.2.2.i586 and
kernel-vanilla-2.6.37.3-16.1.i586 (from tumbleweed repo)

But, on a CentOS 5.5 box with a hand compiled 2.6.37.3 kernel
everything works as expected.

Now I'm confused, is this a OpenSUSE or a kernel issue?

util-linux (known) issue.

HTH,

Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode
< Previous Next >