From patchwork Wed Jun 28 11:48:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/8] net_ns: Make net_ns check in do_restore_task_net_ns more universal From: Kirill Tkhai X-Patchwork-Id: 5644 Message-Id: <149865053879.12218.5692206956633568522.stgit@localhost.localdomain> To: criu@openvz.org, ktkhai@virtuozzo.com, avagin@virtuozzo.com, xemul@virtuozzo.com Date: Wed, 28 Jun 2017 14:48:58 +0300 setns() on the same net_ns is OK (just a noop), while the task has permissions to do that. But if the namespace is inherited from parent task, we can't do that. So, 1)speedup existing cases, and 2)support "inherited ns" case. Signed-off-by: Kirill Tkhai --- criu/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu/net.c b/criu/net.c index 15aae2be4..18c13e4ae 100644 --- a/criu/net.c +++ b/criu/net.c @@ -2162,7 +2162,7 @@ static int do_restore_task_net_ns(struct ns_id *nsid, struct pstree_item *curren { int fd; - if (!(root_ns_mask & CLONE_NEWNET)) + if (current->net_ns == nsid) return 0; fd = fdstore_get(nsid->net.nsfd_id);