mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-22 18:05:10 +00:00
files-ext: Allow plugin files to retry
amdgpu dmabuf CRIU requires the ability of the amdgpu plugin to retry. Change files_ext.c to read a response of 1 from a plugin restore function to mean retry. Signed-off-by: David Francis <David.Francis@amd.com>
This commit is contained in:
parent
7a4ee0ae8e
commit
fb02dbf685
3 changed files with 11 additions and 5 deletions
|
|
@ -45,10 +45,11 @@ static int open_fd(struct file_desc *d, int *new_fd)
|
|||
{
|
||||
struct ext_file_info *xfi;
|
||||
int fd;
|
||||
bool retry_needed;
|
||||
|
||||
xfi = container_of(d, struct ext_file_info, d);
|
||||
|
||||
fd = run_plugins(RESTORE_EXT_FILE, xfi->xfe->id);
|
||||
fd = run_plugins(RESTORE_EXT_FILE, xfi->xfe->id, &retry_needed);
|
||||
if (fd < 0) {
|
||||
pr_err("Unable to restore %#x\n", xfi->xfe->id);
|
||||
return -1;
|
||||
|
|
@ -57,8 +58,11 @@ static int open_fd(struct file_desc *d, int *new_fd)
|
|||
if (restore_fown(fd, xfi->xfe->fown))
|
||||
return -1;
|
||||
|
||||
*new_fd = fd;
|
||||
return 0;
|
||||
if (!retry_needed)
|
||||
*new_fd = fd;
|
||||
else
|
||||
*new_fd = -1;
|
||||
return retry_needed;
|
||||
}
|
||||
|
||||
static struct file_desc_ops ext_desc_ops = {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ 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__RESTORE_EXT_FILE, int id, bool *retry_needed);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1614,7 +1614,7 @@ exit:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int amdgpu_plugin_restore_file(int id)
|
||||
int amdgpu_plugin_restore_file(int id, bool *retry_needed)
|
||||
{
|
||||
int ret = 0, fd;
|
||||
char img_path[PATH_MAX];
|
||||
|
|
@ -1625,6 +1625,8 @@ int amdgpu_plugin_restore_file(int id)
|
|||
size_t img_size;
|
||||
FILE *img_fp = NULL;
|
||||
|
||||
*retry_needed = false;
|
||||
|
||||
if (plugin_disabled)
|
||||
return -ENOTSUP;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue