Hi Vivek,
On Fri, May 27, 2022 at 8:56 PM Vivek Goyal <vgoyal(a)redhat.com> wrote:
On Fri, May 27, 2022 at 02:40:40PM +0800, Tao Liu wrote:
> Previously the sync for dump_fs is problematic, it always
> return success according to man 2 sync. So it cannot detect
> the error of the dump target is full and not all of vmcore
> data been written back the disk, which will leave the vmcore
> imcomplete and report misleading log as "saving vmcore
> complete".
>
> In this patch, we will use "sync -f vmcore" instead, which
> will return error if syncfs on the dump target fails. In
> this way, vmcore sync related failures, such as autoextend
> of lvm2 thinpool fails, can be detected and handled properly.
>
> Signed-off-by: Tao Liu <ltao(a)redhat.com>
> ---
> dracut-kdump.sh | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/dracut-kdump.sh b/dracut-kdump.sh
> index f4456a1..343e2b0 100755
> --- a/dracut-kdump.sh
> +++ b/dracut-kdump.sh
> @@ -175,8 +175,14 @@ dump_fs()
> _dump_exitcode=$?
> if [ $_dump_exitcode -eq 0 ]; then
> mv "$_dump_fs_path/vmcore-incomplete"
"$_dump_fs_path/vmcore"
I think it is better to call "syncfs" on "vmcore-incomeplete" and
not "vmcore". If this file can be synced properly, then one should move it
to vmcore.
In fact, that's the whole point of vmcore-incomplete. If dump could
not be saved successfuly, we will see vmcore-incomplete instead of
vmcore.
Agreed, thanks for pointing this out, I will syncfs against vmcore-incomplete.
BTW, where is the upstream git repo for this code now a days?
For fedora kexec-tools rpm git repo:
git clone
https://src.fedoraproject.org/rpms/kexec-tools.git
Thanks,
Tao Liu
Thanks
Vivek
> - sync
> - dinfo "saving vmcore complete"
> + sync -f "$_dump_fs_path/vmcore"
> + _sync_exitcode=$?
> + if [ $_sync_exitcode -eq 0 ]; then
> + dinfo "saving vmcore complete"
> + else
> + derror "sync vmcore failed,
exitcode:$_sync_exitcode"
> + return 1
> + fi
> else
> derror "saving vmcore failed, exitcode:$_dump_exitcode"
> return 1
> --
> 2.33.1
>