diff --git a/criu/files.c b/criu/files.c index 34ba473b0..6c66e0931 100644 --- a/criu/files.c +++ b/criu/files.c @@ -73,12 +73,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 588b30518..abfb5f8a1 100644 --- a/criu/include/files.h +++ b/criu/include/files.h @@ -131,6 +131,7 @@ struct file_desc { struct file_desc_ops *ops; /* Associated operations */ struct list_head fake_master_list;/* To chain in the list of file_desc, which don't have a fle in a task, that having permissions */ + struct ns_id *setns_userns; /* Minimal user_ns to be able to restore this file */ }; struct fdtype_ops {