Patchwork [12/22] migration: Use migrate_fd_error() in last place that set status to ERROR

login
register
mail settings
Submitter Juan Quintela
Date Feb. 23, 2011, 12:44 a.m.
Message ID <85a3ad2293fc320bc67d06222d992742593065fa.1298421307.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/84025/
State New
Headers show

Comments

Juan Quintela - Feb. 23, 2011, 12:44 a.m.
We are also calling to migrate_fd_cleanup(), but notice that it is the
right thing to do.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
Yoshiaki Tamura - Feb. 23, 2011, 8:25 a.m.
2011/2/23 Juan Quintela <quintela@redhat.com>:
> We are also calling to migrate_fd_cleanup(), but notice that it is the
> right thing to do.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index ab98664..3983257 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -351,11 +351,7 @@ static ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size
>     if (ret == -EAGAIN) {
>         qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
>     } else if (ret < 0) {
> -        if (s->mon) {
> -            monitor_resume(s->mon);
> -        }
> -        s->state = MIG_STATE_ERROR;
> -        notifier_list_notify(&migration_state_notifiers);
> +        migrate_fd_error(s);
>     }

Are you sure about this?  migrate_fd_error may call qemu_fclose
through migrate_fd_cleanup, but the caller of
migrate_fd_put_buffer gets called by buffered_file that sits
under qemu file.  In my previous posting,

http://permalink.gmane.org/gmane.comp.emulators.qemu/94688

I thought migrate_fd_put_buffer should just return error, and let
the original caller (migrate_fd_put_notify or any) to actually call
migrate_fd_error.

Thanks,

Yoshi

>
>     return ret;
> --
> 1.7.4
>
>
>

Patch

diff --git a/migration.c b/migration.c
index ab98664..3983257 100644
--- a/migration.c
+++ b/migration.c
@@ -351,11 +351,7 @@  static ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size
     if (ret == -EAGAIN) {
         qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
     } else if (ret < 0) {
-        if (s->mon) {
-            monitor_resume(s->mon);
-        }
-        s->state = MIG_STATE_ERROR;
-        notifier_list_notify(&migration_state_notifiers);
+        migrate_fd_error(s);
     }

     return ret;