Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2013 03:22:36 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Jamie Gritton <jamie@FreeBSD.org>
Cc:        freebsd-jail@FreeBSD.org
Subject:   Re: automatic garbage collection of stuff mounted (etc.) by jailed root
Message-ID:  <20130425012236.GB23151@dft-labs.eu>
In-Reply-To: <51758192.2050300@FreeBSD.org>
References:  <20130422091711.GA3115@dft-labs.eu> <517553B0.6010602@FreeBSD.org> <517575BF.8020305@quip.cz> <51758192.2050300@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 22, 2013 at 12:29:38PM -0600, Jamie Gritton wrote:
> On 04/22/13 11:39, Miroslav Lachman wrote:
> >>This already happens when jails are created using a jail.conf file. Any
> >>mounts there are unmounted as part of the jail removal process. Just
> >>recently I fixed it to properly do this unmounting in reverse order.
> >
> >Do you mean mounts defined in jail.conf or all mounts manually done by
> >root user in jail?
> >
> 
> Ah, I see the difference. Yes, that's only for mounts in the jail.conf.
> For mounts done by the jail itself, I guess we would go off the mount
> record's credential. So is this something you expect to be happening
> entirely in the kernel?
> 

If we want to clean this up from userspace, we need to teach the kernel how
to export vnet and mount table of a jail and then it would be nice to teach
jls how to print it (or maybe create a separate tool - jstat?), and of
course jail(8) how to use this information to clean things up.

Bonus points if jail(8) -r is able to clean up the jail without looking at
config file.

I would prefer if the jail would be able to just die if no problems were
encountered and that is easly done with a kernel-only implementation,
but this still would benefit from features described above (the
difference would be that if someone wants to kill the jail, jail(8)
would only call jail_remove). If jail could not die because some clean
up operations failed, jls (or jstat) would show what resources are
remaining along with error message (say, fs could not be unmounted
because it was busy). And then the user can fix the problem and do
jail(8) -r to re-run kernel clean up or clean on his own (say, unmount
filesystems), which effectively should kill the jail.

Thoughts?

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130425012236.GB23151>