[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/6] migration: Clear error at entry of migrate_fd_connect()
|
From: |
Dr. David Alan Gilbert (git) |
|
Subject: |
[PULL 5/6] migration: Clear error at entry of migrate_fd_connect() |
|
Date: |
Tue, 13 Jul 2021 16:23:23 +0100 |
From: Peter Xu <peterx@redhat.com>
For each "migrate" command, remember to clear the s->error before going on.
For one reason, when there's a new error it'll be still remembered; see
migrate_set_error() who only sets the error if error==NULL. Meanwhile if a
failed migration completes (e.g., postcopy recovered and finished), we
shouldn't dump an error when calling migrate_fd_cleanup() at last.
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20210708190653.252961-4-peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/migration/migration.c b/migration/migration.c
index 20c48cfff1..2d306582eb 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1855,6 +1855,15 @@ void migrate_set_error(MigrationState *s, const Error
*error)
}
}
+static void migrate_error_free(MigrationState *s)
+{
+ QEMU_LOCK_GUARD(&s->error_mutex);
+ if (s->error) {
+ error_free(s->error);
+ s->error = NULL;
+ }
+}
+
void migrate_fd_error(MigrationState *s, const Error *error)
{
trace_migrate_fd_error(error_get_pretty(error));
@@ -3970,6 +3979,13 @@ void migrate_fd_connect(MigrationState *s, Error
*error_in)
int64_t rate_limit;
bool resume = s->state == MIGRATION_STATUS_POSTCOPY_PAUSED;
+ /*
+ * If there's a previous error, free it and prepare for another one.
+ * Meanwhile if migration completes successfully, there won't have an error
+ * dumped when calling migrate_fd_cleanup().
+ */
+ migrate_error_free(s);
+
s->expected_downtime = s->parameters.downtime_limit;
if (resume) {
assert(s->cleanup_bh);
--
2.31.1
- [PULL 0/6] migration queue, Dr. David Alan Gilbert (git), 2021/07/13
- [PULL 1/6] migration/rdma: prevent from double free the same mr, Dr. David Alan Gilbert (git), 2021/07/13
- [PULL 2/6] migration: failover: emit a warning when the card is not fully unplugged, Dr. David Alan Gilbert (git), 2021/07/13
- [PULL 3/6] migration: Release return path early for paused postcopy, Dr. David Alan Gilbert (git), 2021/07/13
- [PULL 4/6] migration: Don't do migrate cleanup if during postcopy resume, Dr. David Alan Gilbert (git), 2021/07/13
- [PULL 5/6] migration: Clear error at entry of migrate_fd_connect(),
Dr. David Alan Gilbert (git) <=
- [PULL 6/6] migration: Move bitmap_mutex out of migration_bitmap_clear_dirty(), Dr. David Alan Gilbert (git), 2021/07/13
- Re: [PULL 0/6] migration queue, Peter Maydell, 2021/07/14