mutex cgmanager access
mutex cgmanager access

It looks like either libdbus or libnih is showing some corruption with
threaded access to the cgmanager-client library.  Until we can
straighten that out, mutex access to the cgmanager.

The worst part of this is having to take and drop the mutex at every
fork.  This also means that we can't keep a connection open for the
duration of container startup, since that would deadlock forks.

If we were going to keep it like this, then we could get rid of some
code in start.c.  However we take a performance hit here which I
really hope we can rectify soon.

The other approach we could take would be to keep a global count of
references to cgroup_manager.  Mutex the open, close, and each use
of the cgroup_manager proxy (and the inc/dec of the refcount).  This
way we could in fact keep the connection open for the duration of
container start.  The atfork handler child_fn would have to close
the connection if open.

Signed-off-by: Serge Hallyn <3df611b026e4639bee8aef7a4beb2e39fcebb313@ubuntu.com>
Acked-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>

tych0/lxc,efiop/lxc,fwilson42/lxc,sapun/lxc,federicobriata/lxc,cjwatson/lxc,rowhit/lxc,LynxChaus/lxc,Ponce/lxc,rldleblanc/lxc,lisongmin/lxc,efiop/lxc,fwilson42/lxc,GreatFruitOmsk/lxc,virajs/lxc,bmoar/lxc,tych0/lxc,thmo/lxc,DarknessBeforeDawn/lxc,yubo/lxc,hkjolhede/lxc,bostjan/lxc,lazy404/lxc,Pelagicore/lxc,rowhit/lxc,Pelagicore/lxc,akshaykarle/lxc,ioops/lxc,raspberrypython/lxc,major/lxc,rowhit/lxc,virajs/lxc,ysbnim/lxc,tych0/lxc,Ponce/lxc,christiaan/lxc,aeris/lxc,lazy404/lxc,raspberrypython/lxc,ecarrara/lxc,regit/lxc,caglar10ur/lxc,Distrotech/lxc,thmo/lxc,christiaan/lxc,LynxChaus/lxc,major/lxc,fwilson42/lxc,hfuCN/lxc,hfuCN/lxc,weizhenwei/lxc,virajs/lxc,regit/lxc,armcc/lxc,aeris/lxc,weizhenwei/lxc,efiop/lxc,yubo/lxc,akshaykarle/lxc,ksperis/lxc,lisongmin/lxc,terceiro/lxc,ioops/lxc,hkjolhede/lxc,ss1h2a3tw/lxc,Distrotech/lxc,akshaykarle/lxc,szaszg/lxc,JohnPeacockMessageSystems/lxc,thmo/lxc,ss1h2a3tw/lxc,Ponce/lxc,GreatFruitOmsk/lxc,weizhenwei/lxc,ysbnim/lxc,Pelagicore/lxc,cjwatson/lxc,major/lxc,aeris/lxc,QingweiPeterLan/cs188-lxc,bostjan/lxc,QingweiPeterLan/cs188-lxc,jirislaby/lxc,bmoar/lxc,jirislaby/lxc,yubo/lxc,JohnPeacockMessageSystems/lxc,DarknessBeforeDawn/lxc,codebauss/lxc,ksperis/lxc,armcc/lxc,lazy404/lxc,ioops/lxc,szaszg/lxc,hfuCN/lxc,caglar10ur/lxc,ysbnim/lxc,bostjan/lxc,bmoar/lxc,ecarrara/lxc,terceiro/lxc,hkjolhede/lxc,codebauss/lxc,jirislaby/lxc,JohnPeacockMessageSystems/lxc,Distrotech/lxc,federicobriata/lxc,hallyn/lxc,szaszg/lxc,caglar10ur/lxc,GreatFruitOmsk/lxc,QingweiPeterLan/cs188-lxc,hallyn/lxc,federicobriata/lxc,cjwatson/lxc,sapun/lxc,LynxChaus/lxc,christiaan/lxc,raspberrypython/lxc,ss1h2a3tw/lxc,rldleblanc/lxc,hallyn/lxc,DarknessBeforeDawn/lxc,codebauss/lxc,terceiro/lxc,rldleblanc/lxc,lisongmin/lxc,sapun/lxc,ecarrara/lxc,regit/lxc,ksperis/lxc,armcc/lxc