Re: [PATCH 0/2] Send a SIGCHLD to the init's pid namespace parent when reboot

Daniel Lezcano
2011-08-18T23:46:41Z

On 08/15/2011 04:47 PM, Oleg Nesterov wrote:
> On 08/14, Serge E. Hallyn wrote:
>> Quoting Oleg Nesterov (oleg@redhat.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();
> }

Hi Oleg,

what would be your advice to get rid of from_ancestor_ns which prevent
the signal to be delivered to the init process ?

Thanks
-- Daniel