From nobody Mon Feb 9 02:12:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517932330701691.3484470469016; Tue, 6 Feb 2018 07:52:10 -0800 (PST) Received: from localhost ([::1]:59504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej5XV-0003bm-IT for importer@patchew.org; Tue, 06 Feb 2018 10:52:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej5Vh-0002Kw-3q for qemu-devel@nongnu.org; Tue, 06 Feb 2018 10:50:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej5Vg-0003lP-9J for qemu-devel@nongnu.org; Tue, 06 Feb 2018 10:50:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54460) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej5Vg-0003kK-2f for qemu-devel@nongnu.org; Tue, 06 Feb 2018 10:50:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D08E79F735; Tue, 6 Feb 2018 15:50:14 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-30.ams2.redhat.com [10.36.117.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 991DE80DA; Tue, 6 Feb 2018 15:50:06 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, quintela@redhat.com Date: Tue, 6 Feb 2018 15:49:23 +0000 Message-Id: <20180206154936.13565-2-dgilbert@redhat.com> In-Reply-To: <20180206154936.13565-1-dgilbert@redhat.com> References: <20180206154936.13565-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 06 Feb 2018 15:50:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/14] migration: Allow migrate_fd_connect to take an Error * X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, groug@kaod.org, peterx@redhat.com, ross.lagerwall@citrix.com, wei.w.wang@intel.com, danielhb@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Allow whatever is performing the connection to pass migrate_fd_connect an error to indicate there was a problem during connection, an allow us to clean up. The caller must free the error. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- migration/channel.c | 2 +- migration/migration.c | 7 ++++++- migration/migration.h | 2 +- migration/rdma.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index 70ec7ea3b7..fdb7ddbd17 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -78,6 +78,6 @@ void migration_channel_connect(MigrationState *s, =20 s->to_dst_file =3D f; =20 - migrate_fd_connect(s); + migrate_fd_connect(s, NULL); } } diff --git a/migration/migration.c b/migration/migration.c index c99a4e62d7..1fbd304c66 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2378,10 +2378,15 @@ static void *migration_thread(void *opaque) return NULL; } =20 -void migrate_fd_connect(MigrationState *s) +void migrate_fd_connect(MigrationState *s, Error *error_in) { s->expected_downtime =3D s->parameters.downtime_limit; s->cleanup_bh =3D qemu_bh_new(migrate_fd_cleanup, s); + if (error_in) { + migrate_fd_error(s, error_in); + migrate_fd_cleanup(s); + return; + } =20 qemu_file_set_blocking(s->to_dst_file, true); qemu_file_set_rate_limit(s->to_dst_file, diff --git a/migration/migration.h b/migration/migration.h index 786d971ce2..d3b214e5ba 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -190,7 +190,7 @@ uint64_t migrate_max_downtime(void); void migrate_set_error(MigrationState *s, const Error *error); void migrate_fd_error(MigrationState *s, const Error *error); =20 -void migrate_fd_connect(MigrationState *s); +void migrate_fd_connect(MigrationState *s, Error *error_in); =20 MigrationState *migrate_init(void); bool migration_is_blocked(Error **errp); diff --git a/migration/rdma.c b/migration/rdma.c index 9d5a424011..da474fc19f 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3758,7 +3758,7 @@ void rdma_start_outgoing_migration(void *opaque, trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 s->to_dst_file =3D qemu_fopen_rdma(rdma, "wb"); - migrate_fd_connect(s); + migrate_fd_connect(s, NULL); return; err: g_free(rdma); --=20 2.14.3