From owner-freebsd-jail@freebsd.org Wed May 1 15:18:23 2019 Return-Path: Delivered-To: freebsd-jail@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D8DB159974B for ; Wed, 1 May 2019 15:18:23 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from gritton.org (gritton.org [199.192.165.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56B8181E48 for ; Wed, 1 May 2019 15:18:22 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from gritton.org ([127.0.0.131]) by gritton.org (8.15.2/8.15.2) with ESMTP id x41ErI5h061977; Wed, 1 May 2019 08:53:18 -0600 (MDT) (envelope-from jamie@freebsd.org) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 01 May 2019 08:53:18 -0600 From: James Gritton To: freebsd-jail@freebsd.org Cc: squiggly foo Subject: Re: Application Jail Shutdown Problem In-Reply-To: <22066461556647435@iva8-3b901672a9c5.qloud-c.yandex.net> References: <22066461556647435@iva8-3b901672a9c5.qloud-c.yandex.net> Message-ID: <9f04fc825b4a931e51c4d7fd5d7ed7e0@freebsd.org> X-Sender: jamie@freebsd.org User-Agent: Roundcube Webmail/1.3.8 X-Greylist: inspected by milter-greylist-4.6.2 (gritton.org [127.0.0.131]); Wed, 01 May 2019 08:53:19 -0600 (MDT) for IP:'127.0.0.131' DOMAIN:'[127.0.0.131]' HELO:'gritton.org' FROM:'jamie@freebsd.org' RCPT:'' X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (gritton.org [127.0.0.131]); Wed, 01 May 2019 08:53:19 -0600 (MDT) X-Rspamd-Queue-Id: 56B8181E48 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:30247, ipnet:199.192.164.0/22, country:US] X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 May 2019 15:18:23 -0000 On 2019-04-30 12:03, squiggly foo wrote: > Hi All, > > I use the mount.fstab parameter to mount a number of file systems > before starting a jail which works without any problem. However since > it is an application jail, there are no other processes running inside > the jail other than the one application. As soon as that application > terminates the jail is removed by the host. > > This is actually my preferred behavior; I want the jail to be removed > when the process inside of it terminates. But the problem is that the > mount points are not unmounted after the jail is removed that way. > The only way I can get the jails to unmount is if I do a "jail -r > jailname" which is what I want to avoid as I would not do that while > the process inside the jail is still running. > > > Does anyone know of a way for the jails to umount the mount points in > its fstab file when the only process inside the jail exits? No easy way. Those filesystems have to be unmounted by somebody; the jail can't do it because it doesn't have the permission (because it didn't mount them). So some process needs to be watching to see when the jail goes away. That would be some kind of watcher that wakes up occasionally and sees if the jail is still there. It might be nice to have some kqueue support for jails. - Jamie