2010-11-03 09:40:01

by Michael Tokarev

[permalink] [raw]
Subject: bind-mount vs second mount of the same blockdev?

Hello.

I'm trying to understand the differences between
a bind-mount of a whole filesystem versus mounting
the same block device the second time. Like this:

mount -t ext3 /dev/block /mnt/a
mount --bind /mnt/a /mnt/b

versus

mount -t ext3 /dev/block /mnt/a
mount -t ext3 /dev/block /mnt/b

In the second case, second mount does not happen
but the first one is "reused" instead - this is
visible in dmesg, since only once ext3fs prints
a note about the mounting.

Now, the first case is quite clear: we've one fs
visible in two places, pretty much like two hard-
links to the same file. So things like, for
example, fcntl locking will work "from" both
ends. But it is not that obvious in the second
case, even if we clearly have some common
"inode" in this case too.

What are the differences in behavour?

Thanks!

/mjt


2010-11-03 10:23:56

by Al Viro

[permalink] [raw]
Subject: Re: bind-mount vs second mount of the same blockdev?

On Wed, Nov 03, 2010 at 12:39:57PM +0300, Michael Tokarev wrote:
> mount -t ext3 /dev/block /mnt/a
> mount --bind /mnt/a /mnt/b
>
> versus
>
> mount -t ext3 /dev/block /mnt/a
> mount -t ext3 /dev/block /mnt/b

[snip]

> What are the differences in behavour?

None. Both lead to the identical states.