mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
fsnotify: save mnt_id with path
Otherwise it's impossible to understand from which namespace this path should be opened. Signed-off-by: Andrew Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
dfef4e05d5
commit
00acf5228f
16
fsnotify.c
16
fsnotify.c
@ -169,6 +169,9 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino,
|
|||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
f_handle->has_mnt_id = true;
|
||||||
|
f_handle->mnt_id = mi->mnt_id;
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,12 +429,19 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
|
|||||||
*target = openat(mntns_root, remap->path, O_PATH);
|
*target = openat(mntns_root, remap->path, O_PATH);
|
||||||
} else if (f_handle->path) {
|
} else if (f_handle->path) {
|
||||||
int mntns_root;
|
int mntns_root;
|
||||||
|
char *path = ".";
|
||||||
|
uint32_t mnt_id = f_handle->has_mnt_id ? f_handle->mnt_id : -1;
|
||||||
|
|
||||||
|
|
||||||
/* irmap cache is collected in the root namespaces. */
|
/* irmap cache is collected in the root namespaces. */
|
||||||
mntns_root = mntns_get_root_by_mnt_id(-1);
|
mntns_root = mntns_get_root_by_mnt_id(mnt_id);
|
||||||
|
|
||||||
pr_debug("\t\tRestore with path hint %s\n", f_handle->path);
|
/* change "/foo" into "foo" and "/" into "." */
|
||||||
*target = openat(mntns_root, f_handle->path, O_PATH);
|
if (f_handle->path[1] != '\0')
|
||||||
|
path = f_handle->path + 1;
|
||||||
|
|
||||||
|
pr_debug("\t\tRestore with path hint %d:%s\n", mnt_id, path);
|
||||||
|
*target = openat(mntns_root, path, O_PATH);
|
||||||
} else
|
} else
|
||||||
*target = open_handle(s_dev, i_ino, f_handle);
|
*target = open_handle(s_dev, i_ino, f_handle);
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ message fh_entry {
|
|||||||
/* The minimum is fh_n_handle repetitions */
|
/* The minimum is fh_n_handle repetitions */
|
||||||
repeated uint64 handle = 3;
|
repeated uint64 handle = 3;
|
||||||
optional string path = 4;
|
optional string path = 4;
|
||||||
|
optional uint32 mnt_id = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message irmap_cache_entry {
|
message irmap_cache_entry {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user