[CRIU] [PATCH 21/28] files: Populate file_desc::setns_userns
Kirill Tkhai
ktkhai at virtuozzo.com
Mon Jun 5 20:26:33 MSK 2017
Do it here once to use cached value later.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/files.c | 5 +++++
criu/include/files.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/criu/files.c b/criu/files.c
index ce52ebd86..eaa41d3a6 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -71,12 +71,17 @@ void file_desc_init(struct file_desc *d, u32 id, struct file_desc_ops *ops)
d->id = id;
d->ops = ops;
+ d->setns_userns = NULL;
}
int file_desc_add(struct file_desc *d, u32 id, struct file_desc_ops *ops)
{
+ uint32_t file_user_ns;
file_desc_init(d, id, ops);
hlist_add_head(&d->hash, &file_desc_hash[id % FDESC_HASH_SIZE]);
+ if (d->ops->get_user_ns) {
+ d->ops->get_user_ns(d, &file_user_ns, &d->setns_userns);
+ }
return 0; /* this is to make tail-calls in collect_one_foo look nice */
}
diff --git a/criu/include/files.h b/criu/include/files.h
index 2351e41c6..520abf668 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -117,6 +117,7 @@ struct file_desc {
struct hlist_node hash; /* Descriptor hashing and lookup */
struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */
struct file_desc_ops *ops; /* Associated operations */
+ struct ns_id *setns_userns; /* Minimal user_ns to be able to restore this file */
};
struct fdtype_ops {
More information about the CRIU
mailing list