public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* mount --bind /A /A multiplies mount entries
@ 2013-11-04 11:09 Bernhard Voelker
  2013-11-04 13:58 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Bernhard Voelker @ 2013-11-04 11:09 UTC (permalink / raw)
  To: util-linux@vger.kernel.org

Using the same mount point as SRC and DST with mount --bind
somehow multiplies the number of mount points:

  $ ./mount | grep sdb
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)

  $ ./mount --bind /home /home

  $ ./mount | grep sdb
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)

  $ ./mount --bind /home /home

  $ ./mount | grep sdb
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)

  $ ./mount --bind /home /home

  $ ./mount | grep sdb
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
  /dev/sdb on /home type ext4 (rw,relatime,data=ordered)

This is probably a kernel bug, but as bind mounts to self
are not that much of use, wouldn't it be worthwhile to
prohibit it at all in mount(8)?

System (mount from latest git):

  $ lsb_release -a
  LSB Version:    n/a
  Distributor ID: openSUSE project
  Description:    openSUSE 12.3 (x86_64)
  Release:        12.3
  Codename:       Dartmouth

  $ uname -r
  3.7.10-1.16-desktop

Have a nice day,
Berny

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mount --bind /A /A multiplies mount entries
  2013-11-04 11:09 mount --bind /A /A multiplies mount entries Bernhard Voelker
@ 2013-11-04 13:58 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2013-11-04 13:58 UTC (permalink / raw)
  To: Bernhard Voelker; +Cc: util-linux@vger.kernel.org

On Mon, Nov 04, 2013 at 12:09:12PM +0100, Bernhard Voelker wrote:
>   $ ./mount | grep sdb
>   /dev/sdb on /home type ext4 (rw,relatime,data=ordered)
>   /dev/sdb on /home type ext4 (rw,relatime,data=ordered)

 Yes, it seems correct, use findmnt(8) to see what happen.  It's more
 tricky :-) (or see /proc/self/mountinfo where is Id<->Parent
 relationship described by two first columns).

 ... and don't forget that mounts are propagated in shared trees, so
 try to compare:

  mkdir /mnt/test

  mount --bind /mnt/test /mnt/test
  mount --make-private /mnt/test
  mount --bind /mnt/test /mnt/test
  mount --bind /mnt/test /mnt/test

 and:

  mount --bind /mnt/test /mnt/test
  mount --make-shared /mnt/test
  mount --bind /mnt/test /mnt/test
  mount --bind /mnt/test /mnt/test

you can also try to mount something else to /mnt/test/A to see what
happen.

> This is probably a kernel bug

 I don't think it's bug :-)

>, but as bind mounts to self
> are not that much of use, wouldn't it be worthwhile to
> prohibit it at all in mount(8)?

  mount --bind  /A /A

 is pretty common operation if you want to create a mountpoint
 from non-mountpoint directory.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-04 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-04 11:09 mount --bind /A /A multiplies mount entries Bernhard Voelker
2013-11-04 13:58 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox