[CRIU] External network namespaces

Andrey Vagin avagin at virtuozzo.com
Tue Sep 18 01:52:49 MSK 2018


On Fri, Sep 14, 2018 at 08:26:55AM +0200, Adrian Reber wrote:
> On Thu, Sep 13, 2018 at 11:33:17AM +0200, Adrian Reber wrote:
> > when we initially talked about external network namespace and how RPC
> > can get those FDs you mentioned FD clashes.
> > 
> > I am now hitting such a FD clash:
> > 
> > (00.197735)      1: Inherit fd extRootNetNS -> 4 has been reused
> > (00.197738)      1: Error (criu/util.c:251): fd 4 already in use (called at criu/files.c:1102)
> > (00.197743)      1: Error (criu/files.c:1205): Unable to open fd=4 id=0x7d
> > 
> > I understand it in such a way that CRIU gets the network namespace via
> > FD 4, but the restored process also uses FD 4 and cannot use the
> > information from inherit FD. Any idea how to solve this? Thanks.
> 
> So if I just 'dup2(4, 99);' then it works. What is the right way in CRIU
> to move an FD out of the way. There are so many FD related functions and
> I am not sure which one is the right for this use case.

Could you try out the next patch:

diff --git a/criu/net.c b/criu/net.c
index 0431b62f9..0331dffb8 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -2210,7 +2210,6 @@ int net_set_ext(struct ns_id *ns)
        }
 
        ret = switch_ns_by_fd(fd, &net_ns_desc, NULL);
-       close(fd);
 
        return ret;
 }

> 
> 		Adrian



More information about the CRIU mailing list