From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1FPo-00036u-Pe for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:36:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1FPm-0005bE-NE for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:36:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1FPm-0005b3-EO for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:36:02 -0400 From: Markus Armbruster References: <1344354826-10375-1-git-send-email-lcapitulino@redhat.com> <1344354826-10375-16-git-send-email-lcapitulino@redhat.com> <87vcgraz3e.fsf@blackfin.pond.sub.org> <87k3x1wwja.fsf@elfo.mitica> Date: Tue, 14 Aug 2012 13:35:59 +0200 In-Reply-To: <87k3x1wwja.fsf@elfo.mitica> (Juan Quintela's message of "Tue, 14 Aug 2012 13:19:37 +0200") Message-ID: <87has5zoww.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 15/35] migration: don't rely on any QERR_SOCKET_* List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: quintela@redhat.com Cc: kwolf@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, pbonzini@redhat.com, Luiz Capitulino , eblake@redhat.com Juan Quintela writes: > Markus Armbruster wrote: >> Luiz Capitulino writes: >> >>> Use the in_progress argument for QERR_SOCKET_CONNECT_IN_PROGRESS. The >>> other errors are handled the same by checking if the error is set and >>> then calling migrate_fd_error() if it's. >>> >>> It's also necessary to change inet_connect_opts() not to set >>> QERR_SOCKET_CONNECT_IN_PROGRESS. This error is only used by >>> tcp_start_outgoing_migration() and not changing it along with the >>> usage of in_progress would break migration. >>> >>> Furthermore this commit fixes a bug. Today, there's a spurious error >>> report when migration succeeds: >>> >>> (qemu) migrate tcp:0:4444 >>> migrate: Connection can not be completed immediately >>> (qemu) >>> >>> After this commit no spurious error is reported anymore. >>> >>> Signed-off-by: Luiz Capitulino >> >> I'd prefer >> >> s->fd = inet_connect(host_port, false, &in_progress, errp); >> if (error_is_set(errp)) { >> migrate_fd_error(s); >> return -1; >> } >> if (in_progress) { >> DPRINTF("connect in progress\n"); >> qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s); >> } else { >> migrate_fd_connect(s); >> } >> return 0; >> >> because it separates abnormal and normal code paths more clearly. >> >> Matter of taste. > > > The 1st migrate_fd_error() is not needed (it was already wrong). > > migrate_fd_* functions are supposed to be called only after > migrate_fd_connect() has been called. It's been committed. Could you post a patch for it?