Fix forkmount to work with 4.8 and higher
Fix forkmount to work with 4.8 and higher

A new restriction was placed in the 4.8 kernel that mkdir will return
EOVERFLOW if the resulting uid/gid is outside of the container's map.

This is a problem for us as we only attach to the mount namespace.

So to fix that, we must detect that the kernel supports userns and that
the container is in a userns, then attach.

Signed-off-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>

akshaykarle/lxd,chrisglass/lxd,mjeanson/lxd,pcdummy/lxd,lxc/lxd,stgraber/lxd,stgraber/lxd,Skarlso/lxd,techtonik/lxd,ollie314/lxd,Skarlso/lxd,hallyn/lxd,chrisglass/lxd,mjeanson/lxd,ollie314/lxd,hallyn/lxd,hallyn/lxd,lxc/lxd,erikmack/lxd,jsavikko/lxd,ollie314/lxd,lxc/lxd,stgraber/lxd,jsavikko/lxd,atxwebs/lxd,Skarlso/lxd,georghopp/lxd,stgraber/lxd,stgraber/lxd,atxwebs/lxd,lxc/lxd,akshaykarle/lxd,erikmack/lxd,erikmack/lxd,stgraber/lxd,hallyn/lxd,atxwebs/lxd,pcdummy/lxd,lxc/lxd,lxc/lxd,pcdummy/lxd,georghopp/lxd,techtonik/lxd,chrisglass/lxd,mjeanson/lxd,lxc/lxd,hallyn/lxd,atxwebs/lxd,stgraber/lxd,Skarlso/lxd,techtonik/lxd,hallyn/lxd,jsavikko/lxd,akshaykarle/lxd,georghopp/lxd