From nobody Wed May 1 17:10:27 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491319395039594.9410099687955; Tue, 4 Apr 2017 08:23:15 -0700 (PDT) Received: from localhost ([::1]:36216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvQIb-0000Sd-HA for importer@patchew.org; Tue, 04 Apr 2017 11:23:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvQG3-0007CK-A2 for qemu-devel@nongnu.org; Tue, 04 Apr 2017 11:20:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvQG1-0005ho-Tw for qemu-devel@nongnu.org; Tue, 04 Apr 2017 11:20:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54316) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cvQG1-0005hS-MZ for qemu-devel@nongnu.org; Tue, 04 Apr 2017 11:20:33 -0400 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 93D6C80487; Tue, 4 Apr 2017 15:20:32 +0000 (UTC) Received: from dhcp-17-113.lcy.redhat.com (unknown [10.42.17.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AD0D9AF5C; Tue, 4 Apr 2017 15:20:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 93D6C80487 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=berrange@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 93D6C80487 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Tue, 4 Apr 2017 16:20:10 +0100 Message-Id: <20170404152011.16119-2-berrange@redhat.com> In-Reply-To: <20170404152011.16119-1-berrange@redhat.com> References: <20170404152011.16119-1-berrange@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.28]); Tue, 04 Apr 2017 15:20:32 +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 v1 1/2] io: fix incoming client socket initialization 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: Peter Maydell , zhanghailiang , Wang guang 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: Wang guang The channel socket was initialized manually, but forgot to set QIO_CHANNEL_FEATURE_SHUTDOWN. Thus, the colo_process_incoming_thread would hang at recvmsg. This patch just call qio_channel_socket_new to get channel, Which set QIO_CHANNEL_FEATURE_SHUTDOWN already. Signed-off-by: Wang Guang Signed-off-by: zhanghailiang Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrange --- io/channel-socket.c | 8 +------- tests/test-io-channel-socket.c | 8 ++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index f546c68..64b36f5 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -331,16 +331,10 @@ qio_channel_socket_accept(QIOChannelSocket *ioc, { QIOChannelSocket *cioc; =20 - cioc =3D QIO_CHANNEL_SOCKET(object_new(TYPE_QIO_CHANNEL_SOCKET)); - cioc->fd =3D -1; + cioc =3D qio_channel_socket_new(); cioc->remoteAddrLen =3D sizeof(ioc->remoteAddr); cioc->localAddrLen =3D sizeof(ioc->localAddr); =20 -#ifdef WIN32 - QIO_CHANNEL(cioc)->event =3D CreateEvent(NULL, FALSE, FALSE, NULL); -#endif - - retry: trace_qio_channel_socket_accept(ioc); cioc->fd =3D qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr, diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c index aaa9116..c5c1314 100644 --- a/tests/test-io-channel-socket.c +++ b/tests/test-io-channel-socket.c @@ -234,6 +234,8 @@ static void test_io_channel(bool async, qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)= ); g_assert(!passFD || qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)= ); + g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN= )); + g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN= )); =20 test =3D qio_channel_test_new(); qio_channel_test_run_threads(test, true, src, dst); @@ -248,6 +250,8 @@ static void test_io_channel(bool async, qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)= ); g_assert(!passFD || qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)= ); + g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN= )); + g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN= )); =20 test =3D qio_channel_test_new(); qio_channel_test_run_threads(test, false, src, dst); @@ -262,6 +266,8 @@ static void test_io_channel(bool async, qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)= ); g_assert(!passFD || qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)= ); + g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN= )); + g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN= )); =20 test =3D qio_channel_test_new(); qio_channel_test_run_threads(test, true, src, dst); @@ -276,6 +282,8 @@ static void test_io_channel(bool async, qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_FD_PASS)= ); g_assert(!passFD || qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_FD_PASS)= ); + g_assert(qio_channel_has_feature(src, QIO_CHANNEL_FEATURE_SHUTDOWN= )); + g_assert(qio_channel_has_feature(dst, QIO_CHANNEL_FEATURE_SHUTDOWN= )); =20 test =3D qio_channel_test_new(); qio_channel_test_run_threads(test, false, src, dst); --=20 2.9.3 From nobody Wed May 1 17:10:27 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491319308338377.58543404292857; Tue, 4 Apr 2017 08:21:48 -0700 (PDT) Received: from localhost ([::1]:36211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvQHD-0007rh-2e for importer@patchew.org; Tue, 04 Apr 2017 11:21:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvQG5-0007Dg-B7 for qemu-devel@nongnu.org; Tue, 04 Apr 2017 11:20:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvQG4-0005j1-Kn for qemu-devel@nongnu.org; Tue, 04 Apr 2017 11:20:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44230) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cvQG4-0005iT-EJ for qemu-devel@nongnu.org; Tue, 04 Apr 2017 11:20:36 -0400 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 73B20C04BD35; Tue, 4 Apr 2017 15:20:35 +0000 (UTC) Received: from dhcp-17-113.lcy.redhat.com (unknown [10.42.17.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8439A9C05F; Tue, 4 Apr 2017 15:20:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 73B20C04BD35 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=berrange@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 73B20C04BD35 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Tue, 4 Apr 2017 16:20:11 +0100 Message-Id: <20170404152011.16119-3-berrange@redhat.com> In-Reply-To: <20170404152011.16119-1-berrange@redhat.com> References: <20170404152011.16119-1-berrange@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.31]); Tue, 04 Apr 2017 15:20:35 +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 v1 2/2] io: fix FD socket handling in DNS lookup 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: Peter Maydell 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" The qio_dns_resolver_lookup_sync() method is required to be a no-op for socket kinds that don't require name resolution. Thus the KIND_FD handling should not return an error. Signed-off-by: Daniel P. Berrange --- io/dns-resolver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/io/dns-resolver.c b/io/dns-resolver.c index a407075..759d1b4 100644 --- a/io/dns-resolver.c +++ b/io/dns-resolver.c @@ -158,16 +158,13 @@ int qio_dns_resolver_lookup_sync(QIODNSResolver *reso= lver, =20 case SOCKET_ADDRESS_KIND_UNIX: case SOCKET_ADDRESS_KIND_VSOCK: + case SOCKET_ADDRESS_KIND_FD: return qio_dns_resolver_lookup_sync_nop(resolver, addr, naddrs, addrs, errp); =20 - case SOCKET_ADDRESS_KIND_FD: - error_setg(errp, "Unsupported socket address type 'fd'"); - return -1; - default: abort(); } --=20 2.9.3