Date: Tue, 15 Jun 2010 21:05:24 +0300 From: Boyko Yordanov <b.yordanov@exsisto.com> To: Julian Elischer <julian@elischer.org> Cc: freebsd-hackers@freebsd.org Subject: Re: CLONE_NEWNS or similar in freebsd? Message-ID: <A8C92B0A-B0FF-4BA2-965D-3BD29839577F@exsisto.com> In-Reply-To: <4C17AF4A.3090600@elischer.org> References: <EF565524-1B4D-4F7D-AFA3-E9DCC02C03CF@exsisto.com> <4C17AF4A.3090600@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jun 15, 2010, at 7:50 PM, Julian Elischer wrote: > Since we are not Linux guru's, can you define EXACTLY what that does = and exactly what subset of that YOU need. (and why). >=20 > we may be able to achieve the same final effect in a different way. Hi Julian! Yes, of course, I apologize for not exposing any details = about the expected results at first place. Here is the case: In a typical Linux environment my application is spawning children with = the clone() syscall. clone(), with the CLONE_NEWNS flag, allows the = child to gain its own private mount namespace. This means that when a = child mounts a directory (with mount() or nmount() in freebsd) and then = it "dies", the directories that it mounted do not persist in the = "fathers" process environment. Dirs are mounted only from the child = perspective and other processes do not see these mounts nor can they = interact with the mounted dirs. For what I'm aware, with Linux this can = be achieved with either clone() or unshare(), but for what I read none = of these exists in freebsd. rfork() for example spawns a child that does not have this private = namespace, and thus when the child mounts a directory and then it dies, = the directories that it had mounted remain mounted on the system = (visible for all other processes). So if I run the program on freebsd = I'll end up having thousands of mounted directories (a couple per child) = in a while. What I am trying to achieve is either the children having their private = mount namespaces (so that they do not leave their directories behind = mounted) or eventually unmounting the dirs when the mounts are no longer = needed.. seems a solution too, although a child is executing execve() = after the dirs are mounted, so I am not sure how to unmount the dirs = when the executed process exits. Hope this makes it more clear, I really appreciate any help on this. Boyko=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A8C92B0A-B0FF-4BA2-965D-3BD29839577F>
