Ok, thanks!
I think the patch looks good:
Acked-by: Kairui Song <kasong(a)redhat.com>
Thanks, and I will send another patch to improve the note issue as
discussed.
On Wed, Jul 15, 2020 at 10:12 AM piliu <piliu(a)redhat.com>
wrote:
>
>
>
> On 07/15/2020 01:24 AM, Kairui Song wrote:
>> On Wed, Jul 8, 2020 at 10:06 AM Pingfan Liu <piliu(a)redhat.com> wrote:
>>>
>>> The following scenario is observed:
>>>
>>> kdump: kdump_pre script exited with non-zero status!
>>> [ 5.104841] systemd[1]: Shutting down.
>>> [ 5.122162] printk: systemd-shutdow: 27 output lines suppressed due to
ratelimiting
>>> kdump: dump target is /dev/mapper/rhel_hpe--dl380pgen8--02--vm--12-root
>>> kdump: saving to /sysroot//var/crash/127.0.0.1-2020-06-27-03:55:01/
>>> kdump: saving vmcore-dmesg.txt
>>> kdump: saving vmcore-dmesg.txt complete
>>> kdump: saving vmcore
>>> Checking for memory holes : [ 0.0 %] /
Checking for memory holes : [100.0 %] | [
5.516573] systemd-shutdown[1]: Syncing filesystems and block devices.
>>> [ 5.519515] systemd-shutdown[1]: Sending SIGTERM to remaining
processes...
>>>
>>> It is caused by the following script
>>> if [ $? -ne 0 ]; then
>>> echo "kdump: kdump_pre script exited with non-zero status!"
>>> do_final_action
>>> fi
>>>
>>> When do_final_action runs, a systemd service is forked for reboot, then the
>>> subshell returns, and parent continues to execute. Place "exit 1"
to stop
>>> executing and make kdump service failure.
>>>
>>> Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
>>> ---
>>> dracut-kdump.sh | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/dracut-kdump.sh b/dracut-kdump.sh
>>> index b71278d..c74c4b7 100755
>>> --- a/dracut-kdump.sh
>>> +++ b/dracut-kdump.sh
>>> @@ -251,6 +251,8 @@ do_kdump_pre
>>> if [ $? -ne 0 ]; then
>>> echo "kdump: kdump_pre script exited with non-zero status!"
>>> do_final_action
>>> + # During systemd service to reboot the machine, stop this shell script
running
>>> + exit 1
>>> fi
>>> make_trace_mem "kdump saving vmcore" '1:shortmem'
'2+:mem' '3+:slab'
>>> do_dump
>>> --
>>> 2.7.5
>>> _______________________________________________
>>> kexec mailing list -- kexec(a)lists.fedoraproject.org
>>> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
>>> Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
>>> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
>>> List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
>>
>> Hi Pingfan, thanks for the patch
>>
>> If kdump.sh exit with 1, kdump-capture.service is considered failed by
>> systemd and will it execute the failure actions and lead to some kind
>> of race?
> Hmm, I have considered about it. In theory, 'reboot' makes systemd
> refuse to start new service. While there may be some bug in systemed
> which can run a service (kdump-error-handler.service) in parallel before
> rebooting, it is rare case. And if it happens, there seems no negative
> effect. Anyway, rebooting continue
>>
>> And I think maybe we need to update the doc:
>>
>> kdump_pre
>> - Works like the "kdump_post" directive, but instead of running
>> after the dump process, runs immediately before it.
>> Exit status of this binary is interpreted as follows:
>> 0 - continue with dump process as usual
>> non 0 - reboot the system
>>
>> For "non 0", instead of "reboot the system" it actually runs
final action.
> Yes. Final action can be reboot/poweroff/halt
>
> Thanks,
> Pingfan
>