diff --git a/criu/files-ext.c b/criu/files-ext.c index 95ec8e37c3..7a7e1ff837 100644 --- a/criu/files-ext.c +++ b/criu/files-ext.c @@ -16,7 +16,7 @@ static int dump_one_ext_file(int lfd, u32 id, const struct fd_parms *p) FileEntry fe = FILE_ENTRY__INIT; ExtFileEntry xfe = EXT_FILE_ENTRY__INIT; - ret = run_plugins(DUMP_EXT_FILE, lfd, id); + ret = run_plugins(DUMP_EXT_FILE, lfd, p->fd, id); if (ret < 0) return ret; @@ -44,11 +44,13 @@ struct ext_file_info { static int open_fd(struct file_desc *d, int *new_fd) { struct ext_file_info *xfi; + struct fdinfo_list_entry *fle_m; int fd; xfi = container_of(d, struct ext_file_info, d); + fle_m = file_master(d); - fd = run_plugins(RESTORE_EXT_FILE, xfi->xfe->id); + fd = run_plugins(RESTORE_EXT_FILE, xfi->xfe->id, fle_m->fe->fd); if (fd < 0) { pr_err("Unable to restore %#x\n", xfi->xfe->id); return -1; diff --git a/criu/include/criu-plugin.h b/criu/include/criu-plugin.h index 392ea9f534..7dac6a55d7 100644 --- a/criu/include/criu-plugin.h +++ b/criu/include/criu-plugin.h @@ -67,8 +67,8 @@ enum { DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_UNIX_SK, int fd, int id); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_UNIX_SK, int id); -DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_FILE, int fd, int id); -DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_FILE, int id); +DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_FILE, int fd, int real_fd, int id); +DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_FILE, int id, int target_fd); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_MOUNT, char *mountpoint, int id); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT, int id, char *mountpoint, char *old_root, int *is_file); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_LINK, int index, int type, char *kind); @@ -143,8 +143,8 @@ typedef int(cr_plugin_init_t)(void); typedef void(cr_plugin_fini_t)(void); typedef int(cr_plugin_dump_unix_sk_t)(int fd, int id); typedef int(cr_plugin_restore_unix_sk_t)(int id); -typedef int(cr_plugin_dump_file_t)(int fd, int id); -typedef int(cr_plugin_restore_file_t)(int id); +typedef int(cr_plugin_dump_file_t)(int fd, int real_fd, int id); +typedef int(cr_plugin_restore_file_t)(int id, int target_fd); typedef int(cr_plugin_dump_ext_mount_t)(char *mountpoint, int id); typedef int(cr_plugin_restore_ext_mount_t)(int id, char *mountpoint, char *old_root, int *is_file); typedef int(cr_plugin_dump_ext_link_t)(int index, int type, char *kind); diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index 96c0861628..80cffc9bab 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -1183,7 +1183,7 @@ bool kernel_supports_criu(int fd) return ret; } -int amdgpu_plugin_dump_file(int fd, int id) +int amdgpu_plugin_dump_file(int fd, int real_fd, int id) { struct kfd_ioctl_criu_args args = { 0 }; char img_path[PATH_MAX]; @@ -1551,7 +1551,7 @@ static int restore_bo_data(int id, struct kfd_criu_bo_bucket *bo_buckets, CriuKf return ret; } -int amdgpu_plugin_restore_file(int id) +int amdgpu_plugin_restore_file(int id, int target_fd) { int ret = 0, fd; char img_path[PATH_MAX];