From nobody@FreeBSD.org  Wed Feb 27 17:28:01 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id 14CACFFB
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Feb 2013 17:28:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 0272EE3
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Feb 2013 17:28:01 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RHS06l097587
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Feb 2013 17:28:00 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r1RHS0ir097586;
	Wed, 27 Feb 2013 17:28:00 GMT
	(envelope-from nobody)
Message-Id: <201302271728.r1RHS0ir097586@red.freebsd.org>
Date: Wed, 27 Feb 2013 17:28:00 GMT
From: Spank Me <spankthespam@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Jails not unmounting devfs on exit
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         176482
>Category:       kern
>Synopsis:       [jail] Jails not unmounting devfs on exit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-jail
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 27 17:30:00 UTC 2013
>Closed-Date:    Thu Mar 28 21:17:40 UTC 2013
>Last-Modified:  Thu Mar 28 21:17:40 UTC 2013
>Originator:     Spank Me
>Release:        9.1-STABLE
>Organization:
>Environment:
FreeBSD 222-freebsd 9.1-STABLE FreeBSD 9.1-STABLE #1: Wed Feb 27 10:30:10 CET 2013     root@222-freebsd:/usr/obj/usr/src/sys/KAROL amd64
>Description:
When creating jails using 'jail' command with mount.devfs option, and then killing jail using 'jail -r' or exiting the '/bin/sh' only jail, the devfs filesystem is being left mounted leading to multiple mounts under the same directory when overlooked.
>How-To-Repeat:
root@222-freebsd:~ # jls
   JID  IP Address      Hostname                      Path
root@222-freebsd:~ # mount
/dev/ad0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
storage on /storage (zfs, local, nfsv4acls)
storage/generic on /storage/generic (zfs, local, nfsv4acls)
root@222-freebsd:~ # jail -c host.hostname=generic path=/storage/generic ip4.addr=10.1.1.222 mount.devfs command=/bin/tcsh
root@generic:/ # jls
   JID  IP Address      Hostname                      Path
root@generic:/ # mount
storage/generic on / (zfs, local, nfsv4acls)
root@generic:/ # exit
root@222-freebsd:~ # jls
   JID  IP Address      Hostname                      Path
root@222-freebsd:~ # mount
/dev/ad0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
storage on /storage (zfs, local, nfsv4acls)
storage/generic on /storage/generic (zfs, local, nfsv4acls)
devfs on /storage/generic/dev (devfs, local, multilabel)
root@222-freebsd:~ # jail -c host.hostname=generic path=/storage/generic ip4.addr=10.1.1.222 mount.devfs command=/bin/tcsh
root@generic:/ # jls
   JID  IP Address      Hostname                      Path
root@generic:/ # mount
storage/generic on / (zfs, local, nfsv4acls)
root@generic:/ # exit
root@222-freebsd:~ # jls
   JID  IP Address      Hostname                      Path
root@222-freebsd:~ # mount
/dev/ad0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
storage on /storage (zfs, local, nfsv4acls)
storage/generic on /storage/generic (zfs, local, nfsv4acls)
devfs on /storage/generic/dev (devfs, local, multilabel)
devfs on /storage/generic/dev (devfs, local, multilabel)
root@222-freebsd:~ #
>Fix:
Unknown.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-jail 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Feb 28 01:29:33 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer(s). 

This would certainly explain some of the odd results seen on the package 
build machines. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=176482 
State-Changed-From-To: open->closed 
State-Changed-By: jamie 
State-Changed-When: Thu Mar 28 21:09:47 UTC 2013 
State-Changed-Why:  
Working as expected. 

When mount.devfs (or any other sort of mount) is given on the command 
line along with the -c option, that mount is duly made as part of the 
jail creation.  But there is nowhere to mark those mount points as 
"belonging" to that ephemeral jail, or to mark the jail as having those 
mounts.  When such a jail is them removed, there's then no way to know 
the directory should be unmounted. 

If you want to keep track of such things for proper handling in later 
removal, you should put those options in /etc/jail.conf (or some other 
config file that you should take care to include in the removal command 
line.  Then the jail's parameters will be read when the jail is removed, 
and all of the desired takedown steps can occur - including not only 
unmounting a dev directory, but running rc.shutdown and other good 
things. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=176482 
>Unformatted:
