[CRIU] [PATCH v2 26/36] ns: Add ns_owner
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Feb 7 00:37:16 PST 2017
On 07.02.2017 01:40, Andrei Vagin wrote:
> On Fri, Feb 03, 2017 at 07:15:26PM +0300, Kirill Tkhai wrote:
>> Add a struct ns_id member to store information,
>> where the ns copy may be obtained.
>>
>> It's "/proc/[pid]/fd/[fd]", or "/proc/[pid]/ns/[ns]"
>> in dependence of ns_owner::fd value.
>
> https://patchwork.criu.org/patch/3457/
>
> Have you seen this patch? Maybe it will be useful for this task.
>
> This patch adds a new subsystem which is called fdstore and it
> allows to create a storage for file descriptors and this storage
> are shared between processes. It will work faster that opening a file
> descriptor via usernsd.
I think it wouldn't be a problem to rebase on fdstore, when it's in criu.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>> ---
>> criu/include/namespaces.h | 8 ++++++++
>> criu/namespaces.c | 2 ++
>> 2 files changed, 10 insertions(+)
>>
>> diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
>> index 21dc8beb7..546de7c5d 100644
>> --- a/criu/include/namespaces.h
>> +++ b/criu/include/namespaces.h
>> @@ -81,6 +81,13 @@ enum ns_type {
>> NS_OTHER,
>> };
>>
>> +struct ns_owner {
>> + struct {
>> + pid_t pid; /* Owner pid */
>> + int fd; /* Owner fd, or -1 if it's /proc/[pid]/ns/[ns] file */
>> + };
>> +};
>> +
>> struct ns_id {
>> unsigned int kid;
>> unsigned int id;
>> @@ -90,6 +97,7 @@ struct ns_id {
>> struct list_head children;
>> struct list_head siblings;
>> struct ns_id *user_ns;
>> + struct ns_owner owner;
>> struct ns_id *next;
>> enum ns_type type;
>>
>> diff --git a/criu/namespaces.c b/criu/namespaces.c
>> index 538074ab9..6151219d8 100644
>> --- a/criu/namespaces.c
>> +++ b/criu/namespaces.c
>> @@ -302,6 +302,8 @@ struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid,
>> nsid->type = type;
>> nsid_add(nsid, nd, id, pid);
>> nsid->ns_populated = false;
>> + nsid->owner.pid = -1;
>> + nsid->owner.fd = -1;
>> INIT_LIST_HEAD(&nsid->children);
>> INIT_LIST_HEAD(&nsid->siblings);
>> }
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list