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.
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;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[email protected]"

Reply via email to