From owner-freebsd-jail@FreeBSD.ORG Thu Jul 7 05:43:04 2011 Return-Path: Delivered-To: freebsd-jail@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1CED106564A for ; Thu, 7 Jul 2011 05:43:04 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from gritton.org (gritton.org [64.34.175.71]) by mx1.freebsd.org (Postfix) with ESMTP id 6AA3B8FC08 for ; Thu, 7 Jul 2011 05:43:04 +0000 (UTC) Received: from glorfindel.gritton.org (c-174-52-135-209.hsd1.ut.comcast.net [174.52.135.209]) (authenticated bits=0) by gritton.org (8.14.3/8.14.3) with ESMTP id p675h3fi002101; Wed, 6 Jul 2011 23:43:03 -0600 (MDT) (envelope-from jamie@FreeBSD.org) Message-ID: <4E15475C.9020500@FreeBSD.org> Date: Wed, 06 Jul 2011 23:42:52 -0600 From: Jamie Gritton User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101110 Thunderbird/3.1.6 MIME-Version: 1.0 To: freebsd-jail@FreeBSD.org References: <4E114EA9.4000605@FreeBSD.org> In-Reply-To: Content-Type: multipart/mixed; boundary="------------050903050407000004030401" Cc: Subject: Re: New jail(8) with configuration files, not yet in head X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2011 05:43:04 -0000 This is a multi-part message in MIME format. --------------050903050407000004030401 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This is code that notes error return codes from processes run under the jail (e.g. the exec.start script). But in this case, it's reporting an error from a process that was part of the jail's shutdown. The reason the command is "(null)" is this wasn't a command started from jail(8) itself. I've fixed that dual-use bit of code to stay silent about existing processes that die as part of jail shutdown. A small patch for that is attached. - Jamie On 07/04/11 15:36, Brandon Gooch wrote: > I did however notice a minor nit in the output when removing a jail. > Here's the scenario: > > I set out with a new jail.conf(5) file: > > exec.start = "/bin/sh /etc/rc"; > exec.stop = "/bin/sh /etc/rc.shutdown"; > exec.clean; > mount.devfs; > > ports { > path = "/usr/jails/$name"; > ip4.addr = 10.1.1.1; > } > > I run the jail creation command: > > # jail -c ports > ports: created > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5). > Creating and/or trimming log files. > ln: /dev/log: Operation not permitted > Starting syslogd. > ELF ldconfig path: /lib /usr/lib /usr/lib/compat > 32-bit compatibility ldconfig path: /usr/lib32 > Clearing /tmp (X related). > Updating motd:. > Starting sshd. > Starting cron. > Starting ftpd. > > Mon Jul 4 21:21:30 UTC 2011 > > ...and the jail is running: > > # jls > JID IP Address Hostname Path > 3 10.1.1.1 /usr/jails/ports > > Now, when I go to remove the jail: > > # jail -r ports > Stopping cron. > Waiting for PIDS: 29824. > Terminated > . > jail: ports: (null): failed > > I don't think it's anything to worry about, as the jail does indeed > get removed. I wonder though if this might be a indicator of some > underlying problem I haven't ran into yet with my simplistic testing. --------------050903050407000004030401 Content-Type: text/plain; name="jail.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="jail.diff" Index: command.c =================================================================== --- command.c (revision 223747) +++ command.c (working copy) @@ -150,11 +150,15 @@ if (!(j->flags & JF_SLEEPQ)) return 0; j->flags &= ~JF_SLEEPQ; - if (*j->comparam != IP_STOP_TIMEOUT) { - paralimit++; - if (!TAILQ_EMPTY(&runnable)) - requeue(TAILQ_FIRST(&runnable), &ready); + if (*j->comparam == IP_STOP_TIMEOUT) + { + j->flags &= ~JF_TIMEOUT; + j->pstatus = 0; + return 0; } + paralimit++; + if (!TAILQ_EMPTY(&runnable)) + requeue(TAILQ_FIRST(&runnable), &ready); error = 0; if (j->flags & JF_TIMEOUT) { j->flags &= ~JF_TIMEOUT; @@ -270,8 +274,8 @@ case IP__OP: if (down) { - if (jail_remove(j->jid) == 0 && verbose >= 0 && - (verbose > 0 || (j->flags & JF_STOP + (void)jail_remove(j->jid); + if (verbose > 0 || (verbose == 0 && (j->flags & JF_STOP ? note_remove : j->name != NULL))) jail_note(j, "removed\n"); j->jid = -1; --------------050903050407000004030401--