sk-unix: Add trivial name resolver for sockets with relative names
Unix sockets may be created with non-absolute (relative) path (when kernel creates one it always use AT_FDCWD for name resolving), So when we collect sockets we see them as having names without leading slash. In common cases for such sockets application doesn't change own working directory after that but this is not always the true. So we need to invent some name resolver. The good candidate is IRMAP cache but after a number of testings I found that it might slow down performance very dramatically. Thus we need some more intelligent way here. For a while, for common applications such as postfix, fetching dumpee working directory and root is enough. So here what we do - when socket get collected from diag interface we remember its relative name parameters (device and inode) but postprone name resolving to not bring perf penalty until really needed - when we meet a socket to dump with relative name assigned we try to use $cwd/name and $root/name for this socket to check if it has been created in those directories. On success we simply remember the directory in image and when restore such socket call for chdir helper to change working dir and generate relative name v2: - Use new unlink_stale to remove sockets we're to restore - Use *at() helpers once we're changed working dir in bind_unix_sk - Add more debug ouput Signed-off-by:Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
Showing
Please
register
or
sign in
to comment