[CRIU] [PATCH 1/3] ns: Override fake pid in rst_add_ns_id()
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Mar 1 01:13:34 PST 2017
On 01.03.2017 04:01, Andrei Vagin wrote:
> On Tue, Feb 28, 2017 at 04:41:43PM +0300, Kirill Tkhai wrote:
>> During reading of ns file, we add namespaces with fake pid -1.
>> Allow to override it later with real pid of a process.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>> ---
>> criu/namespaces.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/criu/namespaces.c b/criu/namespaces.c
>> index 992cd17e0..b1e65df43 100644
>> --- a/criu/namespaces.c
>> +++ b/criu/namespaces.c
>> @@ -320,7 +320,7 @@ int rst_add_ns_id(unsigned int id, struct pstree_item *i, struct ns_desc *nd)
>>
>> nsid = lookup_ns_by_id(id, nd);
>> if (nsid) {
>> - if (pid_rst_prio(pid, nsid->ns_pid))
>> + if (nsid->ns_pid == -1 || pid_rst_prio(pid, nsid->ns_pid))
>
> Where is ns_pid used on restore?
I see it in mount's code. But you should know better the reason of why we need rst prio here...
commit eac462922cd3a461e1688191c59bd9f17e4b6ed6
Author: Andrey Vagin <avagin at openvz.org>
Date: Mon Apr 21 18:23:14 2014 +0400
restore: add mount id-s in the ns_ids list (v4)
Currently ns_ids list is filled only on dump. Soon we'll need this
list for mount namespaces on restore, e.g. to know which tasks share
the namespaces.
v2: merge the patch "namespace: add a function to search an ns_id
item by id" into this one.
v3: add prefix rst_ to add_ns_id
v4: look up namespace by two values -- type AND ID
Signed-off-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
I just restore the behavior we had before nested user ns.
More information about the CRIU
mailing list