Fix overlay use of rootdir and defer
Fix overlay use of rootdir and defer

Check for the rootDir first because the mergeDir may not exist if root
is present.

Also fix unmounting in the defer to make sure it does not have a
refcount.

Signed-off-by: Michael Crosby <951f4c7b5d47e32d0112c78d14a98eaa23e6b5ef@gmail.com>

Mokolea/docker,hypriot/docker,cr7pt0gr4ph7/docker,ffoysal/docker,bonczj/moby-json-file-logger,moypray/docker,alexisbellido/docker.github.io,dgageot/docker,lixiaobing10051267/docker,msabansal/docker,michelvocks/docker,shhsu/docker,gnailuy/docker,rhatdan/docker,rremer/moby,denverdino/denverdino.github.io,kolyshkin/moby,kunalkushwaha/docker,YuPengZTE/docker,yasiramin10p/moby,thtanaka/docker,denverdino/denverdino.github.io,HideoYamauchi/docker,nalind/docker,shishir-a412ed/docker,tianon/docker,danyalKhaliq10p/moby,pramodhkp/moby,medallia/docker,johnstep/moby-moby,thaJeztah/docker,jameszhan/docker,HuKeping/docker,johnstep/docker.github.io,mstanleyjones/docker,ibuildthecloud/docker,xiaods/docker,gnailuy/docker,flavio/docker,brahmaroutu/docker,troy0820/docker.github.io,bdwill/docker.github.io,mohmost12/docker,ColinHebert/docker,charleswhchan/docker,joaofnfernandes/docker.github.io,shubheksha/docker.github.io,mike1729/docker,sterchelen/docker,hypriot/docker,liaoqingwei/docker,duglin/docker,PatrickLang/moby,asbjornenge/docker,ajaymdesai/docker,charleswhchan/docker,JMesser81/docker,kojiromike/docker,dongjoon-hyun/docker,docker/docker.github.io,justyntemme/docker,eskaaren/docker,dims/docker,danyalKhaliq10p/moby,mixja/docker,sfsmithcha/docker,nawawi/docker,thaJeztah/docker,mtrmac/docker,moby/moby,djs55/docker,kencochrane/docker,mahak/docker,dgageot/docker,pradipd/moby,naveed-jamil-tenpearls/moby,jvanz/docker,xiaods/docker,aduermael/docker.github.io,coreos/docker,shubheksha/docker.github.io,sanscontext/docker.github.io,splunk/docker,Shopify/docker,shishir-a412ed/docker,alexisbellido/docker.github.io,shubheksha/docker.github.io,tmp6154/docker,KingEmet/docker,JimGalasyn/docker.github.io,mike1729/docker,allencloud/docker,menglingwei/denverdino.github.io,michael-holzheu/docker,dongjoon-hyun/docker,eskaaren/docker,cpuguy83/docker,bearstech/moby,AkihiroSuda/docker,mohmost12/docker,KarthikNayak/docker,dmcgowan/docker,asbjornenge/docker,aduermael/docker.github.io,tagomoris/docker,mtesselH/docker,wenchma/docker,nalind/docker,errordeveloper/docker,bluebreezecf/docker,stainboy/docker,q384566678/docker,hqhq/moby,q384566678/docker,rillig/docker.github.io,gigidwan/docker,erikstmartin/docker,kencochrane/docker,twaugh/docker,laijs/docker,moby/moby,projectatomic/docker,jameszhan/docker,mikebrow/docker,JimGalasyn/docker.github.io,pecameron/docker,resin-io/docker,phiroict/docker,erikh/docker,eskaaren/docker,ndeloof/docker,HuKeping/docker,xiekeyang/docker,charleszheng44/moby,yongtang/docker,fcrisciani/docker,sanscontext/docker.github.io,kolyshkin/moby,sterchelen/docker,SvenDowideit/docker,bdwill/docker.github.io,catinthesky/docker,danix800/docker.github.io,medallia/docker,ripcurld0/moby,docker/docker.github.io,jwhonce/docker,paralin/docker,bearstech/moby,konstruktoid/docker-1,thaJeztah/docker.github.io,dsheets/moby,BSWANG/denverdino.github.io,yummypeng/docker,jlebon/docker,dmcgowan/docker,menglingwei/denverdino.github.io,troy0820/docker.github.io,harche/docker,toli/docker,charleswhchan/docker,docker-zh/docker.github.io,xiekeyang/docker,jzwlqx/denverdino.github.io,jzwlqx/denverdino.github.io,justincormack/docker,dperny/docker,ripcurld0/moby,johnstep/docker.github.io,twaugh/docker,mtesselH/docker,willmtemple/docker,flavio/docker,cyphar/docker,mtanlee/docker,prertik/docker,13W/docker,dnephin/docker,x1022as/docker,joeuo/docker.github.io,LuisBosquez/docker.github.io,LuisBosquez/docker.github.io,sanjeo/docker,rhatdan/storage,KingEmet/docker,joeuo/docker.github.io,ibuildthecloud/docker,cpuguy83/docker,Shopify/docker,sterchelen/docker,cr7pt0gr4ph7/docker,q384566678/docker,gjaskiewicz/moby,toli/docker,jthelin/docker,jlhawn/docker,BSWANG/denverdino.github.io,alexisbellido/docker.github.io,anweiss/docker.github.io,amatsus/docker,laijs/moby,kojiromike/docker,mikedougherty/docker,whuwxl/docker,michelvocks/docker,docker-zh/docker.github.io,medallia/docker,jlhawn/docker,kencochrane/docker,denverdino/denverdino.github.io,Ramzec/docker,diogomonica/docker,madhanrm/docker,pramodhkp/moby,docker/docker,toli/docker,moul/docker,joaofnfernandes/docker.github.io,rillig/docker.github.io,lixiaobing1/docker,danix800/docker.github.io,containers/storage,gnailuy/docker,AkihiroSuda/docker,noironetworks/docker,troy0820/docker.github.io,tkopczynski/docker,aduermael/docker.github.io,tianon/docker,londoncalling/docker.github.io,konstruktoid/docker-upstream,scotttlin/docker,maxamillion/docker,mstanleyjones/docker,allencloud/docker,prertik/docker,JimGalasyn/docker.github.io,x1022as/docker,Syntaxide/docker,alfred-landrum/docker,dperny/docker,Morsicus/docker,yosifkit/docker,joaofnfernandes/docker.github.io,anweiss/docker.github.io,wenchma/docker,yongtang/docker,sarnautov/moby,jimjag/docker,nghiant2710/docker,dperny/docker,jhorwit2/docker,moul/docker,fcrisciani/docker,jvanz/docker,Mokolea/docker,tophj-ibm/moby,johnstep/docker.github.io,raja-sami-10p/moby,yasiramin10p/moby,catinthesky/docker,mike1729/docker,LuisBosquez/docker.github.io,jzwlqx/denverdino.github.io,bluebreezecf/docker,tophj-ibm/docker,mkumatag/docker,mahak/docker,londoncalling/docker.github.io,darrenstahlmsft/docker,londoncalling/docker.github.io,rancher/docker,paralin/docker,shin-/docker.github.io,gschaetz/moby,tagomoris/docker,miminar/docker,michelvocks/docker,zhuguihua/docker,lixiaobing10051267/docker,hqhq/moby,akira-baruah/docker,cloudflare/docker,laijs/moby,afein/docker,harche/docker,mikedougherty/docker,trebonian/docker,scotttlin/docker,darrenstahlmsft/docker,sdurrheimer/docker,mikebrow/docker,amatsus/docker,estesp/docker,danyalKhaliq10p/moby,yummypeng/docker,jimjag/docker,unclejack/docker,darrenstahlmsft/docker,charleszheng44/moby,coolljt0725/docker,johnstep/moby-moby,troy0820/docker.github.io,denverdino/docker.github.io,msabansal/docker,naveed-jamil-tenpearls/moby,docker-zh/docker.github.io,sanjeo/docker,laijs/docker,moul/docker,stainboy/docker,nawawi/docker,diogomonica/docker,jhorwit2/docker,pecameron/docker,kerneltime/docker,paralin/docker,jwhonce/docker,michael-holzheu/docker,unclejack/docker,gschaetz/moby,sanscontext/docker.github.io,mtanlee/docker,jzwlqx/denverdino.github.io,icaoweiwei/docker,coolljt0725/docker,rhatdan/storage,Ramzec/docker,gjaskiewicz/moby,nawawi/docker,unclejack/docker,bonczj/moby-json-file-logger,ColinHebert/docker,haveatry/docker,mgoelzer/docker,qudongfang/docker,errordeveloper/docker,icaoweiwei/docker,afein/docker,nghiant2710/docker,dsau/docker,maxamillion/docker,mtrmac/docker,hypriot/docker,ajaymdesai/docker,mahak/docker,imkin/moby,dccurtis/docker,tklauser/docker,tonistiigi/docker,ibuildthecloud/docker,gdevillele/docker.github.io,coolljt0725/docker,resin-io/docker,moby/moby,jongiddy/docker,srust/docker,kunalkushwaha/docker,rhatdan/docker,tmp6154/docker,menglingwei/denverdino.github.io,dccurtis/docker,docker/docker,yummypeng/docker,Tenk42/docker,BSWANG/denverdino.github.io,noxiouz/docker,bonczj/moby-json-file-logger,phiroict/docker,thaJeztah/docker,estesp/docker,jlebon/docker,pecameron/docker,duglin/docker,BSWANG/denverdino.github.io,thtanaka/docker,fcrisciani/docker,anweiss/docker.github.io,dims/docker,KingEmet/docker,medallia/docker,vdemeester/docker,liaoqingwei/docker,lixiaobing1/docker,mstanleyjones/docker,thaJeztah/docker.github.io,joeuo/docker.github.io,sarnautov/moby,thtanaka/docker,yp-engineering/docker,projectatomic/docker,JimGalasyn/docker.github.io,lixiaobing1/docker,pradipd/moby,aduermael/docker.github.io,catinthesky/docker,YuPengZTE/docker,imkin/moby,dsheets/moby,paralin/docker,tophj-ibm/docker,mixja/docker,wenchma/docker,cpuguy83/docker,HideoYamauchi/docker,amatsus/docker,splunk/docker,mikebrow/docker,sarnautov/moby,dccurtis/docker,noxiouz/docker,tophj-ibm/docker,Morsicus/docker,djs55/docker,xiekeyang/docker,dsau/docker,xuxinkun/docker,rhatdan/docker,tklauser/docker,Tenk42/docker,djs55/docker,gigidwan/docker,thaJeztah/docker.github.io,kojiromike/docker,shin-/docker.github.io,trebonian/docker,bluebreezecf/docker,jlebon/docker,twaugh/docker,jimjag/docker,whuwxl/docker,noironetworks/docker,gdevillele/docker.github.io,sanscontext/docker.github.io,projectatomic/docker,dnephin/docker,charleszheng44/moby,BSWANG/denverdino.github.io,ndeloof/docker,flavio/docker,madhanrm/docker,errordeveloper/docker,KarthikNayak/docker,portworx/docker,yosifkit/docker,denverdino/docker.github.io,shishir-a412ed/docker,sdurrheimer/docker,xiaods/docker,brahmaroutu/docker,SvenDowideit/docker,phiroict/docker,cr7pt0gr4ph7/docker,ffoysal/docker,POLJM242/docker,vdemeester/docker,ibuildthecloud/docker,justincormack/docker,ColinHebert/docker,duglin/docker,asbjornenge/docker,thaJeztah/docker,darrenstahlmsft/moby,tophj-ibm/moby,erikstmartin/docker,whuwxl/docker,mkumatag/docker,moby/moby,POLJM242/docker,xuxinkun/docker,srust/docker,erikstmartin/docker,containers/storage,imkin/moby,konstruktoid/docker-upstream,mkumatag/docker,jlhawn/docker,tmp6154/docker,allencloud/docker,bdwill/docker.github.io,johnstep/docker.github.io,Ramzec/docker,phiroict/docker,Ramzec/docker,denverdino/docker.github.io,rillig/docker.github.io,rancher/docker,haveatry/docker,joaofnfernandes/docker.github.io,willmtemple/docker,nawawi/docker,darrenstahlmsft/moby,coreos/docker,jvanz/docker,londoncalling/docker.github.io,JMesser81/docker,shin-/docker.github.io,mikedougherty/docker,yosifkit/docker,zhuguihua/docker,LuisBosquez/docker.github.io,mohmost12/docker,13W/docker,miminar/docker,jongiddy/docker,KarthikNayak/docker,qudongfang/docker,danix800/docker.github.io,docker/docker.github.io,docker/docker.github.io,ffoysal/docker,srust/docker,gjaskiewicz/moby,Syntaxide/docker,Mokolea/docker,mixja/docker,justyntemme/docker,JMesser81/docker,tophj-ibm/moby,sfsmithcha/docker,endophage/docker,endophage/docker,jzwlqx/denverdino.github.io,Mokolea/docker,miminar/docker,konstruktoid/docker-upstream,abhinavdahiya/docker,Tenk42/docker,PatrickLang/moby,brahmaroutu/docker,stevvooe/docker,shin-/docker.github.io,kolyshkin/docker,yongtang/docker,alexisbellido/docker.github.io,coreos/docker,kolyshkin/moby,xuxinkun/docker,Morsicus/docker,resin-io/docker,kunalkushwaha/docker,denverdino/docker.github.io,raja-sami-10p/moby,14rcole/docker,joeuo/docker.github.io,erikh/docker,gigidwan/docker,haveatry/docker,denverdino/docker.github.io,rremer/moby,zhuguihua/docker,docker-zh/docker.github.io,AkihiroSuda/docker,Shopify/docker,abhinavdahiya/docker,HideoYamauchi/docker,johnstep/moby-moby,nghiant2710/docker,scotttlin/docker,crosbymichael/docker,bdwill/docker.github.io,crosbymichael/docker,cloudflare/docker,anweiss/docker.github.io,rillig/docker.github.io,docker/docker,gnailuy/docker,ndeloof/docker,sanjeo/docker,dmcgowan/docker,stainboy/docker,trebonian/docker,kerneltime/docker,cloudflare/docker,alfred-landrum/docker,sdurrheimer/docker,docker/docker.github.io,jongiddy/docker,gdevillele/docker.github.io,yp-engineering/docker,laijs/docker,raja-sami-10p/moby,konstruktoid/docker-1,portworx/docker,tonistiigi/docker,shubheksha/docker.github.io,afein/docker,denverdino/denverdino.github.io,yosifkit/docker,ripcurld0/moby,tonistiigi/docker,phiroict/docker,johnstep/docker.github.io,rremer/moby,YuPengZTE/docker,erikh/docker,yp-engineering/docker,londoncalling/docker.github.io,14rcole/docker,abhinavdahiya/docker,docker-zh/docker.github.io,cyphar/docker,joaofnfernandes/docker.github.io,gdevillele/docker.github.io,justincormack/docker,alfred-landrum/docker,rancher/docker,dnephin/docker,stevvooe/docker,laijs/moby,cyphar/docker,diogomonica/docker,noxiouz/docker,mtrmac/docker,13W/docker,mtesselH/docker,AkihiroSuda/docker,HuKeping/docker,tagomoris/docker,crosbymichael/docker,sanscontext/docker.github.io,denverdino/denverdino.github.io,nalind/docker,menglingwei/denverdino.github.io,x1022as/docker,michael-holzheu/docker,splunk/docker,qudongfang/docker,pramodhkp/moby,gdevillele/docker.github.io,alexisbellido/docker.github.io,cpuguy83/docker,mtanlee/docker,mahak/docker,thaJeztah/docker.github.io,konstruktoid/docker-upstream,shubheksha/docker.github.io,gschaetz/moby,Syntaxide/docker,SvenDowideit/docker,trebonian/docker,mgoelzer/docker,nalind/docker,13W/docker,bdwill/docker.github.io,pradipd/moby,shin-/docker.github.io,moypray/docker,kolyshkin/docker,menglingwei/denverdino.github.io,harche/docker,portworx/docker,msabansal/docker,moul/docker,icaoweiwei/docker,moypray/docker,kerneltime/docker,bearstech/moby,liaoqingwei/docker,madhanrm/docker,PatrickLang/moby,noironetworks/docker,joeuo/docker.github.io,rhatdan/storage,shhsu/docker,dongjoon-hyun/docker,lixiaobing10051267/docker,LuisBosquez/docker.github.io,hqhq/moby,maxamillion/docker,danix800/docker.github.io,jameszhan/docker,shhsu/docker,justyntemme/docker,naveed-jamil-tenpearls/moby,mgoelzer/docker,dgageot/docker,darrenstahlmsft/moby,ibuildthecloud/docker,endophage/docker,13W/docker,jwhonce/docker,tklauser/docker,tkopczynski/docker,JimGalasyn/docker.github.io,anweiss/docker.github.io,flavio/docker,jthelin/docker,containers/storage,prertik/docker,dims/docker,willmtemple/docker,jimjag/docker,yasiramin10p/moby,stevvooe/docker,jhorwit2/docker,estesp/docker,dsheets/moby,konstruktoid/docker-1,ajaymdesai/docker,akira-baruah/docker,thaJeztah/docker.github.io,vdemeester/docker,tkopczynski/docker,sfsmithcha/docker,dsau/docker,bearstech/moby