Skip to content

Commit

Permalink
migration: Report error when shutdown fails
Browse files Browse the repository at this point in the history
This will help detect issues regarding I/O channels usage.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/r/20240304122844.1888308-7-clg@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
  • Loading branch information
legoater authored and xzpeter committed Mar 11, 2024
1 parent 12ab1e4 commit e8c4436
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion migration/qemu-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ struct QEMUFile {
*/
int qemu_file_shutdown(QEMUFile *f)
{
Error *err = NULL;

/*
* We must set qemufile error before the real shutdown(), otherwise
* there can be a race window where we thought IO all went though
Expand Down Expand Up @@ -91,7 +93,8 @@ int qemu_file_shutdown(QEMUFile *f)
return -ENOSYS;
}

if (qio_channel_shutdown(f->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL) < 0) {
if (qio_channel_shutdown(f->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, &err) < 0) {
error_report_err(err);
return -EIO;
}

Expand Down

0 comments on commit e8c4436

Please sign in to comment.