On Sun, Jan 08, 2006 at 10:39:07PM +0100, Oliver Welter wrote:
> Hi Folks,
> 
> I am running some vservers and use one block device per server (in fact 
> a drbd device, see http://linux-vserver.org/advanced+DRBD+mount+issues, 
> Solution 1).
> 
> Now I run into problems with UNmounting...
> 
> If I want to unmount one corresponding block device and get an error, 
> that someone has mounted the device, even after shuting down ALL of the 
> server's...
> 
> So, I have only the root context running, there is no mount visible via 
> /proc/mount on the device I want to shut down, but it is not working...I 
> can solve the issue only with a reboot....(not really a smart solution 
> for a server)..
> Even "vps" or vserver-stat show any non-root-context proces running....
> 
> So, any ideas ? Can anyone tell me where else to look for "mounts" ?

you have to start 'thinking' in namespaces and avoid leftovers
and unwanted 'copies' or duplicate mounts ...

basically every process can have a private namespace
when they are ceated, a personal view into the virtual
filesystem which 'maps' somehow to the real filesystems

here is an example of startup and shutdown of some guests ...


        H
   _____|____________________T0     at this time a guest is started (A)
        |\                          a new namespace is created (copy of H)
        | `---A---.
        |          \                now both the host and the guest name
   _____|_________ | ________T1     space are modified, cdrom unmounted
        |          |                data mounted, proc inside guest
        H'         A'
        |_________ | ________T2     at this time guest A is shut down and
        |\         |                a new namespace (guest B) is created
        | `---B    *
   _____|_____ \ ____________T3     again, both namespaces are modified
        |      |                    the data is unmounted on the host,
        H''    B'                   guest B mounts /proc



 device          HOST            GUEST A         GUEST B

 /dev/hda2       /                  -               -
 /dev/hda3       /vservers          -               -
 /dev/hdb1       /mnt/cdrom         -               -
 /dev/hdc1          -               -               -
  none           /proc              -               -
 --------------------------------------------------------------------- T0
 /dev/hda2       /               /                  -
 /dev/hda3       /vservers       /vservers          -
 /dev/hdb1       /mnt/cdrom      /mnt/cdrom         -
 /dev/hdc1          -               -               -
  none           /proc           proc               -
 --------------------------------------------------------------------- T1
 /dev/hda2       /               /                  -
 /dev/hda3       /vservers       /vservers          -
 /dev/hdb1          -            /mnt/cdrom         -
 /dev/hdc1       /data              -               -
  none           /proc           proc,A:/proc       -
 --------------------------------------------------------------------- T2
 /dev/hda2       /                  -            /
 /dev/hda3       /vservers          -            /vservers
 /dev/hdb1          -               -               -
 /dev/hdc1       /data              -            /data
  none           /proc              -            /proc
 --------------------------------------------------------------------- T3
 /dev/hda2       /                  -            /
 /dev/hda3       /vservers          -            /vservers
 /dev/hdb1          -               -               -
 /dev/hdc1          -               -            /data
  none           /proc              -            proc,B:/proc


if you look closely, you'll find that between T0 and T1 the
cdrom is mounted twice, and in T1-T2 the cdrom can not be
ejected, because it is still mounted inside guest A.
the cdrom is released with the shutdown of guest A in T2-T3
so it can be ejected, but similar happens to data in the
last interval, which will lead to /dev/hdc1 being busy
although neither proc nor mount will show it mounted.
again, shutting down the guest B or unmounting it in that
particular namespace will release the device ...

the tool for namespaces is called vnamespace, and it allows
you to enter existing namespaces very easily. keep in mind
that inside the namespace the processes 'might' have evlolved
and do not use this particular namespace anylonger ... 

this is currently being addressed in mainline with namespace
propagation and inheritance ...


HTH,
Herbert

_______________________________________________
Vserver mailing list
[email protected]
http://list.linux-vserver.org/mailman/listinfo/vserver

Reply via email to