Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Jul 2011 23:42:52 -0600
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        freebsd-jail@FreeBSD.org
Subject:   Re: New jail(8) with configuration files, not yet in head
Message-ID:  <4E15475C.9020500@FreeBSD.org>
In-Reply-To: <CALBk6y%2BYWzOUzju-yN-bREX=4PY1pfhqX=QhW3K2qAExXkn8Mg@mail.gmail.com>
References:  <4E114EA9.4000605@FreeBSD.org> <CALBk6y%2BYWzOUzju-yN-bREX=4PY1pfhqX=QhW3K2qAExXkn8Mg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



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