* [Qemu-devel] [PATCH] Reorganize and fix monitor resume after migration
@ 2011-08-05 7:11 Jan Kiszka
2011-08-05 7:28 ` Michael Tokarev
2011-08-05 16:58 ` Anthony Liguori
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2011-08-05 7:11 UTC (permalink / raw)
To: Luiz Capitulino, qemu-devel; +Cc: Marcelo Tosatti, Michael Tokarev
From: Jan Kiszka <jan.kiszka@siemens.com>
If migration failed in migrate_fd_put_buffer, the monitor may have been
resumed not only in the error path of that function but also once again
in migrate_fd_put_ready which is called unconditionally by
migrate_fd_connect.
Fix this by establishing a cleaner policy: the monitor shall be resumed
when the migration file is closed, either via callback
(migrate_fd_close) or in migrate_fd_cleanup if no file is open (i.e. no
callback invoked).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
migration.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/migration.c b/migration.c
index 2a15b98..756fa62 100644
--- a/migration.c
+++ b/migration.c
@@ -292,18 +292,17 @@ int migrate_fd_cleanup(FdMigrationState *s)
ret = -1;
}
s->file = NULL;
+ } else {
+ if (s->mon) {
+ monitor_resume(s->mon);
+ }
}
- if (s->fd != -1)
+ if (s->fd != -1) {
close(s->fd);
-
- /* Don't resume monitor until we've flushed all of the buffers */
- if (s->mon) {
- monitor_resume(s->mon);
+ s->fd = -1;
}
- s->fd = -1;
-
return ret;
}
@@ -330,9 +329,6 @@ 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, NULL);
}
@@ -458,6 +454,9 @@ int migrate_fd_close(void *opaque)
{
FdMigrationState *s = opaque;
+ if (s->mon) {
+ monitor_resume(s->mon);
+ }
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
return s->close(s);
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Reorganize and fix monitor resume after migration
2011-08-05 7:11 [Qemu-devel] [PATCH] Reorganize and fix monitor resume after migration Jan Kiszka
@ 2011-08-05 7:28 ` Michael Tokarev
2011-08-05 16:58 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2011-08-05 7:28 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Marcelo Tosatti, qemu-devel, Luiz Capitulino
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
05.08.2011 11:11, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> If migration failed in migrate_fd_put_buffer, the monitor may have been
> resumed not only in the error path of that function but also once again
> in migrate_fd_put_ready which is called unconditionally by
> migrate_fd_connect.
>
> Fix this by establishing a cleaner policy: the monitor shall be resumed
> when the migration file is closed, either via callback
> (migrate_fd_close) or in migrate_fd_cleanup if no file is open (i.e. no
> callback invoked).
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reported-By: Michael Tokarev <mjt@tls.msk.ru>
Tested-By: Michael Tokarev <mjt@tls.msk.ru>
This is a good candidate for 0.12, 0.14 and 0.15... ;)
Thank you !
/mjt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iJwEAQECAAYFAk47m5UACgkQUlPFrXTwyDgUKAP/ZsVlWiCKmcMhRSItuR6rIT/K
k/JY4FwARVpBdv6zVFPsLX4UgsPbC6QfUsYjgZtWhSaiboyi7rRAj75OEipYjBqu
IWgBXmXwt6ATxsxC7ffrUtO15QXABmaQyYjBGI+EzJZdKPuzjEfm5wFgHr0+epDn
4svPOur4pC6ttDT3Ldc=
=sHNU
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Reorganize and fix monitor resume after migration
2011-08-05 7:11 [Qemu-devel] [PATCH] Reorganize and fix monitor resume after migration Jan Kiszka
2011-08-05 7:28 ` Michael Tokarev
@ 2011-08-05 16:58 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2011-08-05 16:58 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Marcelo Tosatti, Michael Tokarev, qemu-devel, Luiz Capitulino
On 08/05/2011 02:11 AM, Jan Kiszka wrote:
> From: Jan Kiszka<jan.kiszka@siemens.com>
>
> If migration failed in migrate_fd_put_buffer, the monitor may have been
> resumed not only in the error path of that function but also once again
> in migrate_fd_put_ready which is called unconditionally by
> migrate_fd_connect.
>
> Fix this by establishing a cleaner policy: the monitor shall be resumed
> when the migration file is closed, either via callback
> (migrate_fd_close) or in migrate_fd_cleanup if no file is open (i.e. no
> callback invoked).
>
> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> migration.c | 19 +++++++++----------
> 1 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index 2a15b98..756fa62 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -292,18 +292,17 @@ int migrate_fd_cleanup(FdMigrationState *s)
> ret = -1;
> }
> s->file = NULL;
> + } else {
> + if (s->mon) {
> + monitor_resume(s->mon);
> + }
> }
>
> - if (s->fd != -1)
> + if (s->fd != -1) {
> close(s->fd);
> -
> - /* Don't resume monitor until we've flushed all of the buffers */
> - if (s->mon) {
> - monitor_resume(s->mon);
> + s->fd = -1;
> }
>
> - s->fd = -1;
> -
> return ret;
> }
>
> @@ -330,9 +329,6 @@ 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, NULL);
> }
> @@ -458,6 +454,9 @@ int migrate_fd_close(void *opaque)
> {
> FdMigrationState *s = opaque;
>
> + if (s->mon) {
> + monitor_resume(s->mon);
> + }
> qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
> return s->close(s);
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-05 16:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 7:11 [Qemu-devel] [PATCH] Reorganize and fix monitor resume after migration Jan Kiszka
2011-08-05 7:28 ` Michael Tokarev
2011-08-05 16:58 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).