Fix racy joinSandbox behavior
Fix racy joinSandbox behavior

The current lazy network sandbox initialization code has a race
in that if multiple go routines race to join the network the second
and subsequent go routines might try to use the sandbox before it is
fully initialized. Fix this by blocking the go routines in once.Do
calls and also take of care of rolling back properly in case of
error.

Signed-off-by: Jana Radhakrishnan <045898bda7d4800fe4909a9831e702ab79e266be@docker.com>

sanimej/libnetwork,junxu/libnetwork,ityangchen/libnetwork,AdoHe/libnetwork,mYmNeo/libnetwork,vdemeester/libnetwork,kolyshkin/libnetwork,argvader/libnetwork,msabansal/libnetwork,junxu/libnetwork,thockin/libnetwork,frntn/libnetwork,msagheer/libnetwork,allencloud/libnetwork,jimmycmh/libnetwork,sanimej/libnetwork,YujiOshima/libnetwork,tgraf/libnetwork,allencloud/libnetwork,abhi/libnetwork,mYmNeo/libnetwork,wcwxyz/libnetwork,aboch/libnetwork_new,hw-qiaolei/libnetwork,cloudflare/libnetwork,carlye566/libnetwork,medallia/libnetwork,bprashanth/libnetwork,mahak/libnetwork,mavenugo/libnetwork,carlye566/libnetwork,anarcher/libnetwork,lindenlab/libnetwork,hackersdotmu/libnetwork,anshulr/libnetwork,fcrisciani/libnetwork,docker/libnetwork,amitkris/libnetwork,mbanikazemi/libnetwork,mavenugo/libnetwork,anshulr/libnetwork,docker/libnetwork,brahmaroutu/libnetwork,msabansal/libnetwork,frntn/libnetwork,YujiOshima/libnetwork,amitkris/libnetwork,anortef/libnetwork,tgraf/libnetwork,sainath14/libnetwork,anarcher/libnetwork,argvader/libnetwork,pyakpyak/libnetwork,jimmycmh/libnetwork,kunalkushwaha/libnetwork,jmzwcn/libnetwork,tmakita/libnetwork,sharmasushant/libnetwork,minhoryang/libnetwork,fcrisciani/libnetwork,runcom/libnetwork,cpuguy83/libnetwork,thockin/libnetwork,mahak/libnetwork,cloudflare/libnetwork,mapuri/libnetwork,coolljt0725/libnetwork,aboch/libnetwork_new,minhoryang/libnetwork,ityangchen/libnetwork,docker/libnetwork,AdoHe/libnetwork,vdemeester/libnetwork,sainath14/libnetwork,sharmasushant/libnetwork,kunalkushwaha/libnetwork,anortef/libnetwork,medallia/libnetwork,abhi/libnetwork,kolyshkin/libnetwork,tmakita/libnetwork,hw-qiaolei/libnetwork,curtiszimmerman/libnetwork,bprashanth/libnetwork,pyakpyak/libnetwork,kolyshkin/libnetwork,msagheer/libnetwork,vdemeester/libnetwork,cpuguy83/libnetwork,WeiZhang555/libnetwork,lindenlab/libnetwork,mapuri/libnetwork,medallia/libnetwork,jmzwcn/libnetwork,abhi/libnetwork,axsh/libnetwork,runcom/libnetwork,coolljt0725/libnetwork,mbanikazemi/libnetwork,wcwxyz/libnetwork,WeiZhang555/libnetwork,mahak/libnetwork,curtiszimmerman/libnetwork,axsh/libnetwork,hackersdotmu/libnetwork,brahmaroutu/libnetwork