From patchwork Tue Apr 5 09:50:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8749261 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 50AFCC0553 for ; Tue, 5 Apr 2016 09:54:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8AB220220 for ; Tue, 5 Apr 2016 09:54:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B42B20114 for ; Tue, 5 Apr 2016 09:54:40 +0000 (UTC) Received: from localhost ([::1]:35664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anNh1-0002UP-FF for patchwork-qemu-devel@patchwork.kernel.org; Tue, 05 Apr 2016 05:54:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anNd5-0003ZS-Qk for qemu-devel@nongnu.org; Tue, 05 Apr 2016 05:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anNd4-0001BF-ND for qemu-devel@nongnu.org; Tue, 05 Apr 2016 05:50:35 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anNd4-0001BB-DB for qemu-devel@nongnu.org; Tue, 05 Apr 2016 05:50:34 -0400 Received: by mail-wm0-x243.google.com with SMTP id 20so2670726wmh.3 for ; Tue, 05 Apr 2016 02:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=aNQcNY3GHWQ6pKomY6+PPCUdKcHkwWOW6LFTUQSYHQ8=; b=PG/tRlsL+bcENMtBuI56b2Ufg0vUBFzr9RKJU3Nsy0fNXnuz7uQRHwCC9ng94kscTR +jX7Pd3kMLfJ2Yb4euG1Mtl3ChDzlTraiP27cqR3jl3KpLhJphvaEhyCBzenH3Ojlh8f WMJxooPQt9dlZByui26eU0M6ws6jZ8idUg2VKAJ+67IQ1HujRAM/ZUGCpZ7aVXxIiIq+ 7CG21MOWtfuv6Kb5eYuJcHD+2iFewL/0fZGougjJDHpVXu4/h1ClzoWU4FhOzHBTbWW0 hpIAshsLVAJ23ne2aD2JDxGbIPvW0U2/IFm0HLihVEVYCMwgbd3PV8xI7EoCqASkttjI XuqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=aNQcNY3GHWQ6pKomY6+PPCUdKcHkwWOW6LFTUQSYHQ8=; b=GlOKCReLuifdiRAhsGHeBVUMvdrtYoPS61cANDsW8IJRihrH0rFp1qeGeznTW5ozDu ptd82Z6I6HpmacN4WXtQjYVZ+c3Iga2dEqEzLa2KadPrW/c4YzIWFVRvJol/2UHphlL8 YVP51uIdMRP1hf+i/ip49uYNevZoJOsAQUSkcQu0dJ3Jo6VRQh7PJ7rRfsd5KE31EFaN 6/e+ZC2cPU8fQhRr8vVDB0vMC/f9OOLBxR3MXM5hKb3IiCoel9/eSF+5UqCMEv27apR5 4+FBBtvPkBUQndyCcPyifU/gwHdPqlCMHrhff9vvNfQI5YLU3rIOjO4n6IpMJ+RHb5yY bOHw== X-Gm-Message-State: AD7BkJLGP8MLjPvtco6BwjQrywZ+mOgCiSIb1zgaN1lvsBOLzwcWwX9KxK4BRvYZcF/2cg== X-Received: by 10.28.212.19 with SMTP id l19mr16709711wmg.97.1459849833815; Tue, 05 Apr 2016 02:50:33 -0700 (PDT) Received: from donizetti.lan (94-39-141-76.adsl-ull.clienti.tiscali.it. [94.39.141.76]) by smtp.gmail.com with ESMTPSA id ka4sm33721377wjc.47.2016.04.05.02.50.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Apr 2016 02:50:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 5 Apr 2016 11:50:12 +0200 Message-Id: <1459849818-26649-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1459849818-26649-1-git-send-email-pbonzini@redhat.com> References: <1459849818-26649-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Cc: Paolo Bonzini Subject: [Qemu-devel] [PULL 09/15] char: ensure all clients are in non-blocking mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Daniel P. Berrange" Only some callers of tcp_chr_new_client are putting the socket client into non-blocking mode. Move the call to qio_channel_set_blocking() into the tcp_chr_new_client method to guarantee that all code paths set non-blocking mode Reported-by: Andrew Baumann Reported-by: Laurent Vivier Signed-off-by: Daniel P. Berrange Message-Id: <1458324041-22709-1-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-char.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu-char.c b/qemu-char.c index 93fd733..b597ee1 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3081,6 +3081,8 @@ static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc) s->sioc = sioc; object_ref(OBJECT(sioc)); + qio_channel_set_blocking(s->ioc, false, NULL); + if (s->do_nodelay) { qio_channel_set_delay(s->ioc, false); } @@ -3112,7 +3114,6 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd) if (!sioc) { return -1; } - qio_channel_set_blocking(QIO_CHANNEL(sioc), false, NULL); ret = tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); return ret;