[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E495C4A.5040101@free.fr>
Date: Mon, 15 Aug 2011 19:50:02 +0200
From: Daniel Lezcano <daniel.lezcano@...e.fr>
To: "Serge E. Hallyn" <serge@...lyn.com>
CC: Oleg Nesterov <oleg@...hat.com>, akpm@...ux-foundation.org,
bonbons@...ux-vserver.org, containers@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/2] Send a SIGCHLD to the init's pid namespace parent
when reboot
On 08/15/2011 07:39 PM, Serge E. Hallyn wrote:
> Quoting Oleg Nesterov (oleg@...hat.com):
>> On 08/14, Serge E. Hallyn wrote:
>>> Quoting Oleg Nesterov (oleg@...hat.com):
>>>> On 08/11, Daniel Lezcano wrote:
>>>>> In the case of a VPS, when we shutdown/halt/reboot the container, the
>>>>> reboot utility will invoke the sys_reboot syscall which has the bad
>>>>> effect to reboot the host.
>>>> Stupid question. Can't sys_reboot() simply kill init (and thus the whole
>>>> pid_ns) in this case?
>>> The goal is to be able to distinguish a request for reboot from shutdown.
>>> If we just kill the init, then the parent of init (the container monitor)
>>> cannot restart the container to emulate reboot.
>> OK, thanks.
>>
>> What if init reports the reason it was killed?
>>
>> Ignoring LINUX_REBOOT_CMD_CAD_/etc, I mean, roughly,
>>
>> - add "int reboot_cmd" into struct pid_namespace
>>
>> - sys_reboot(cmd) does
>>
>> if (!global_namespace) {
>> task_active_pid_ns(current)->reboot_cmd = cmd;
>> sigkill_my_init();
>> }
>>
>> - change zap_pid_ns_processes() to do
>>
>> if (pid_ns->reboot_cmd) // approximately
>> current->exit_state = pid_ns->reboot_cmd;
>>
>> Then its parent can look at status after wait(&status).
> That looks good to me. Daniel, is there a reason this wouldn't work?
No, it is an alternative we can try. Oleg raise a good point about the
SIGCHLD not being queue.
Let me write this patch and test it.
-- Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists