OpenVZ Forum


Home » General » Support » mount --bind Bug in OpenVZ?
mount --bind Bug in OpenVZ? [message #35793] Wed, 22 April 2009 21:20 Go to next message
divB is currently offline  divB
Messages: 79
Registered: April 2009
Member
Hi,

The following scenario without OpenVZ:

# mount /dev/sda1 /home
# mount --bind /home /dest1
# mount --bind /home /dest2
...


Now the content from /home is mapped to dest1 and dest2. Now I want to unmount these mapping but never ever the original mount to /home:

# umount /dest1
# umound /dest2
...
# ls /home
(there are files)


Well this is how should bind-mounts work. Now OpenVZ comes into play. In $VEID.mount, I have the following command:

mount --bind /home /var/lib/vz/root/${VEID}/home


When the VE starts everything is fine. In the $VEID.unmount-Skript I have the following command:

umount /home /var/lib/vz/root/${VEID}/home


But now suddenly /home has been unmounted too on the host!! But this should never ever happen!

# ls /home
. ..


When I just ignore unmounting the bind-mounts it seems to work without problems but it seems to be not elegant to me.

I just don't understand it. Without the mount-Scripts everything works fine. But inside the mount/umount script, the original mount (/dev/sda1 to /home on VE0) is unmounted too.

And this is a fiasco: I have mounted /home into multiple VEs stopping one VE which has /home mounted removes /home from all other VEs!

Does anybody know something about this issue?

Regards,
divB

Re: mount --bind Bug in OpenVZ? [message #35800 is a reply to message #35793] Thu, 23 April 2009 06:53 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

Quote:


umount /home /var/lib/vz/root/${VEID}/home


This is a wrong syntax.
Invoking such command from HN tells your system to umount home. No wonder that /home is umounted.

Don't put anything in umount script in such situation because /home directory will be properly umounted from inside a VE when a VE is stopped.
Look at /proc/mounts output inside VE. The information about bind mount can be obtained from it, so you can umount this directory from inside the VE and init scripts actually do this.
Re: mount --bind Bug in OpenVZ? [message #35801 is a reply to message #35800] Thu, 23 April 2009 09:29 Go to previous message
divB is currently offline  divB
Messages: 79
Registered: April 2009
Member
CORRECTION!!! This was a copy & paste error. Sorry.

I certainly meant:

umount /var/lib/vz/root/${VEID}/home


Sorry.

Now it is really a bug, isn't it? Smile

However, you say I should just leave the umount-scripts empty? It is unmounted automatically? Is this really the "right way"?

(I always try to avoid using things without cleanup code - it seems to me like using malloc without free or like creating a service with "start" but without "stop"...)

Previous Topic: IPsec with rebuilt kernel possible?
Next Topic: Mysql Sockets?
Goto Forum:
  


Current Time: Sun Jul 14 13:40:40 GMT 2024

Total time taken to generate the page: 0.02291 seconds