[CRIU] [PATCH] remote: Check if socket exist before dump/restore
Radostin Stoyanov
rstoyanov1 at gmail.com
Mon Sep 24 19:51:51 MSK 2018
When running `criu dump` with --remote before image-proxy was started
the following errors occur.
# criu dump -t 24159 -j --remote
Error (criu/img-remote.c:209): Unable to connect to local socket: img-proxy.sock: No such file or directory
Error (criu/img-remote.c:1150): Unable to open snapshot id push connection
Error (criu/cr-dump.c:1764): Failed to push image namespace.
Error (criu/stats.c:76): BUG at criu/stats.c:76
Aborted
And similar error will be shown on restore:
# criu restore -j --remote
Error (criu/img-remote.c:209): Unable to connect to local socket: img-cache.sock: No such file or directory
Error (criu/img-remote.c:1003): Error opening local connection for parent:null
Error (criu/img-remote.c:209): Unable to connect to local socket: img-cache.sock: No such file or directory
Error (criu/img-remote.c:1003): Error opening local connection for parent:null
Error (criu/img-remote.c:1193): Error, could not find current snapshot id (.) fd
Error (criu/img-remote.c:1216): Error, could not find snapshot id for idx -1
Error (criu/util.c:725): Can't read link of fd -404: No such file or directory
Error (criu/protobuf.c:75): Unexpected EOF on (null)
With this change the above messages will be replaced with:
# criu dump -t 24159 -j --remote
Error (criu/crtools.c:234): Can't access img-proxy.sock: No such file or directory
# criu restore -j --remote
Error (criu/crtools.c:255): Can't access img-cache.sock: No such file or directory
Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
criu/crtools.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/criu/crtools.c b/criu/crtools.c
index 64d298de..cbe4be08 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -230,6 +230,11 @@ int main(int argc, char *argv[], char *envp[])
pr_info("Will do snapshot from %s\n", opts.img_parent);
if (!strcmp(argv[optind], "dump")) {
+ if (opts.remote && euidaccess(DEFAULT_PROXY_SOCKET, R_OK|W_OK)) {
+ pr_perror("Can't access %s", DEFAULT_PROXY_SOCKET);
+ return 1;
+ }
+
if (!opts.tree_id)
goto opt_pid_missing;
return cr_dump_tasks(opts.tree_id);
@@ -246,6 +251,11 @@ int main(int argc, char *argv[], char *envp[])
if (opts.tree_id)
pr_warn("Using -t with criu restore is obsoleted\n");
+ if (opts.remote && euidaccess(DEFAULT_CACHE_SOCKET, R_OK|W_OK)) {
+ pr_perror("Can't access %s", DEFAULT_CACHE_SOCKET);
+ return 1;
+ }
+
ret = cr_restore_tasks();
if (ret == 0 && opts.exec_cmd) {
close_pid_proc();
--
2.17.1
More information about the CRIU
mailing list