• Andrey Vagin's avatar
    unix: restore sockets on correct mount points · 019ebec0
    Andrey Vagin authored
    Currently we restore all sockets in the root mount namespace, because we
    were not able to get any information about a mount point where a socket
    is bound. It is obviously incorrect in some cases.
    
    In 4.10 kernel, we added the SIOCUNIXFILE ioctl for unix sockets.  This
    ioctl opens a file to which a socket is bound and returns a file
    descriptor.
    
    This new ioctl allows us to get mnt_id by reading fdinfo, and mnt_id
    is enough to find a proper mount point and a mount namespace.
    
    The logic of this patch is straight forward. On dump, we save mnt_id for
    sockets, on restore we find a mount namespace by mnt_id and restore this
    socket in its mount namespace.
    Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
    Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
    019ebec0