mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
remap: Add cmdline option to allow linked remap
By default crtools shouldn't modify the environment, except for killing the dumped tasks. The link remap does so and should sit under explicit cmdline option. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -98,6 +98,7 @@ int main(int argc, char *argv[])
|
||||
{ "pidfile", required_argument, 0, 46},
|
||||
{ "veth-pair", required_argument, 0, 47},
|
||||
{ "action-script", required_argument, 0, 49},
|
||||
{ LREMAP_PARAM, no_argument, 0, 41},
|
||||
{ },
|
||||
};
|
||||
|
||||
@@ -160,6 +161,10 @@ int main(int argc, char *argv[])
|
||||
log_level++;
|
||||
}
|
||||
break;
|
||||
case 41:
|
||||
pr_info("Will allow link remaps on FS\n");
|
||||
opts.link_remap_ok = true;
|
||||
break;
|
||||
case 42:
|
||||
pr_info("Will dump TCP connections\n");
|
||||
opts.tcp_established_ok = true;
|
||||
@@ -302,6 +307,7 @@ usage:
|
||||
pr_msg(" -r|--root [PATH] change the root filesystem (when run in mount namespace)\n");
|
||||
pr_msg(" --evasive-devices use any path to a device file if the original one is inaccessible\n");
|
||||
pr_msg(" --veth-pair [IN=OUT] correspondence between outside and inside names of veth devices\n");
|
||||
pr_msg(" --link-remap allow to link unlinked files back when possible (modifies FS till restore)\n");
|
||||
pr_msg(" --action-script [SCR] add an external action script\n");
|
||||
pr_msg(" The environment variable CRTOOL_SCRIPT_ACTION contains one of the actions:\n");
|
||||
pr_msg(" * network-lock - lock network in a target network namespace");
|
||||
|
@@ -285,6 +285,12 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp)
|
||||
RegFileEntry rfe = REG_FILE_ENTRY__INIT;
|
||||
FownEntry fwn = FOWN_ENTRY__INIT;
|
||||
|
||||
if (!opts.link_remap_ok) {
|
||||
pr_err("Can't create link remap for %s. "
|
||||
"Use " LREMAP_PARAM " option.\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Linked remapping -- we create a hard link on a removed file
|
||||
* in the directory original file used to sit.
|
||||
|
@@ -95,6 +95,7 @@ struct cr_options {
|
||||
bool ext_unix_sk;
|
||||
bool tcp_established_ok;
|
||||
bool evasive_devices;
|
||||
bool link_remap_ok;
|
||||
unsigned int namespaces_flags;
|
||||
bool log_file_per_pid;
|
||||
char *output;
|
||||
|
@@ -95,4 +95,6 @@ extern int set_fd_flags(int fd, int flags);
|
||||
#define AT_EMPTY_PATH 0x1000
|
||||
#endif
|
||||
|
||||
#define LREMAP_PARAM "link-remap"
|
||||
|
||||
#endif /* FILES_H_ */
|
||||
|
@@ -232,7 +232,7 @@ EOF
|
||||
echo Dump $PID
|
||||
mkdir -p $ddump
|
||||
save_fds $PID $ddump/dump.fd
|
||||
setsid $CRTOOLS dump --tcp-established -x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || {
|
||||
setsid $CRTOOLS dump --tcp-established --link-remap -x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || {
|
||||
echo WARNING: process $tname is left running for your debugging needs
|
||||
return 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user