Re: [systemd-devel] A question about the race condition between two service

2018-11-06 Thread Cristian Rodríguez



El 05-11-2018 a las 3:17, piliu escribió:


During this service, the power state can not be got from sysfs, neither
it can be got by systemd's utility. So is it acceptable to signal the
failure of service by a tmp file under /tmp ? I.e adding
FailureAction=touch /tmp/poweroff_fail in systemd-poweroff.service.


No, that will likely race too.. please focus on why you think you need 
this contrieved,hackish solution.


If as you say in your other message, if you start just one operation, 
either reboot or poweroff but not both it will be ok.





___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] A question about the race condition between two service

2018-11-05 Thread piliu


On 11/05/2018 07:42 PM, Cristian Rodríguez wrote:
> 
> 
> El 01-11-2018 a las 5:34, piliu escribió:
> 
>> Any suggestion?
>>
> 
> Yeah. Don't..if poweroff fails reboot will too..please attack the root
> cause of this problem.. why the machine fails to poweroff, is it a
> service blocking poweroff ? is there a kernel bug ?
No, it is not kernel bug. Our kdump script always uses reboot as a
back-end method. And if in kdump.conf, choosing poweroff as default
action, then there is the race sequence poweroff -> reboot.
Maybe the script should not launch reboot-service if it already launched
a poweroff service
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] A question about the race condition between two service

2018-11-05 Thread Cristian Rodríguez



El 01-11-2018 a las 5:34, piliu escribió:


Any suggestion?



Yeah. Don't..if poweroff fails reboot will too..please attack the root 
cause of this problem.. why the machine fails to poweroff, is it a 
service blocking poweroff ? is there a kernel bug ?

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] A question about the race condition between two service

2018-11-04 Thread piliu


On 11/01/2018 05:52 PM, Andrei Borzenkov wrote:
> On Thu, Nov 1, 2018 at 11:34 AM piliu  wrote:
>>
>> Hi,
>>
>> I encounter an issue during the poweroff. In my bash script, firstly I
>> use poweroff cmd to start systemd-poweroff.service, and use reboot cmd
>> as a bake up if the poweroff fails. But during tests, many times, the
>> machine is rebooted directly, without waiting for the result of poweroff.
>> Since both of the cmds use "systemctl" without --no-block option, so I
>> think they should execute one-by-one. But the test result is not.
>> Any suggestion?
>>
> 
> 
> Most likely your systemctl is killed during shutdown processing (which
> is implicitly initiated by systemd-poweroff.service).
> 
During this service, the power state can not be got from sysfs, neither
it can be got by systemd's utility. So is it acceptable to signal the
failure of service by a tmp file under /tmp ? I.e adding
FailureAction=touch /tmp/poweroff_fail in systemd-poweroff.service.

Thanks,
Pingfan
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] A question about the race condition between two service

2018-11-01 Thread Andrei Borzenkov
On Thu, Nov 1, 2018 at 11:34 AM piliu  wrote:
>
> Hi,
>
> I encounter an issue during the poweroff. In my bash script, firstly I
> use poweroff cmd to start systemd-poweroff.service, and use reboot cmd
> as a bake up if the poweroff fails. But during tests, many times, the
> machine is rebooted directly, without waiting for the result of poweroff.
> Since both of the cmds use "systemctl" without --no-block option, so I
> think they should execute one-by-one. But the test result is not.
> Any suggestion?
>


Most likely your systemctl is killed during shutdown processing (which
is implicitly initiated by systemd-poweroff.service).
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] A question about the race condition between two service

2018-11-01 Thread Reindl Harald


Am 01.11.18 um 09:34 schrieb piliu:
> I encounter an issue during the poweroff. In my bash script, firstly I
> use poweroff cmd to start systemd-poweroff.service, and use reboot cmd
> as a bake up if the poweroff fails. But during tests, many times, the
> machine is rebooted directly, without waiting for the result of poweroff.
> Since both of the cmds use "systemctl" without --no-block option, so I
> think they should execute one-by-one. But the test result is not.
> Any suggestion?

just don't do that!

when power-off fails reboot would fail too and so that all makes no
sense - the only differnece between reboot and power off is the action
after OS shutdown
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel