From patchwork Mon Jun 6 16:45:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 9158793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8DC0A60573 for ; Mon, 6 Jun 2016 16:50:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EDCC28349 for ; Mon, 6 Jun 2016 16:50:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72BC82834C; Mon, 6 Jun 2016 16:50:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id EFB0528349 for ; Mon, 6 Jun 2016 16:50:40 +0000 (UTC) Received: from localhost ([::1]:43816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9xjb-000897-JG for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Jun 2016 12:50:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9xee-0004J9-8l for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:45:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9xec-0005Zv-2v for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:45:31 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:35823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9xeb-0005Zq-Uv for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:45:30 -0400 Received: by mail-qk0-x244.google.com with SMTP id l185so8976206qkc.2 for ; Mon, 06 Jun 2016 09:45:29 -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 :mime-version:content-transfer-encoding; bh=e8zXQGnprl+tFP5QHt3y7C5mjSC+uOAHktiHq3aVpME=; b=YcOU/2wmC3oUhuqQ1CMiE9b/v/wDH0K4HWPqAdpol0JnUBttsb1z1SExZeZFzvctYX 7Hz5f+00T7s2eJ/2hjIjqzk2iSsufw3rIt/Q+Xx4R4k4Wc9OsKdn5cp0hbSuGRcWdPTF Jza8Qa7z/8csfLfxkC3CRku9Pq0dE5AZZhptRijO7LEv71uGPfRN7zq4xPBmJIM7ytvD rvwaD7tDhVpz7EP+Iv09RUUxek3GbeQsIg3IHeEYqGaciniwMo+QEJqm+lfvaTmScnrm Uz/2nq7BqtzRvCYXGz058HabKqiJnpSlxQpk39RMkQ7HFRdx2Ymqb4IbjidbEFQXuEDc g1MQ== 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:mime-version:content-transfer-encoding; bh=e8zXQGnprl+tFP5QHt3y7C5mjSC+uOAHktiHq3aVpME=; b=LS1GmAvhDaoSyTuhq8YQnu+9G1RFzdD0gAW4N2/V36aDJiAyDNFsXMUaXfWxGiKWFn xiDiqmhdBY4zQX9mWMwKNK5blvjc4kKOWQgsxDNS7jalimb9A7rWExmWrTqyqxmceA9V RWrqzSHg8L++ZHUxu1HdShTEIPgiRc2+4tXhKsAsTu6ySvh6j4McD9ic8aga19wGYjQ2 axZN0TZtgaWq4KDlcp7J1NZXUoha4Cso96uu9PFqVqGgCAp7THxj3iCyP3DhKjNv1cQg Xp5o9MYYpTwt+QZlYsONIve8UQIBd4gKIyc0sg1mbkCJBJIkJmr2OIn1kfwoTtcyjEsX +U7g== X-Gm-Message-State: ALyK8tLlGR0j/Rl8s4TZT2OtmPP8gF4OR0jrcIjAcz/ARrAJouk6zR8prhWM64Sx68RK9w== X-Received: by 10.55.23.72 with SMTP id i69mr17554453qkh.142.1465231529523; Mon, 06 Jun 2016 09:45:29 -0700 (PDT) Received: from localhost (APoitiers-110-1-1-130.w193-248.abo.wanadoo.fr. [193.248.103.130]) by smtp.gmail.com with ESMTPSA id w190sm5392508qkb.28.2016.06.06.09.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jun 2016 09:45:28 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Mon, 6 Jun 2016 18:45:03 +0200 Message-Id: <1465231508-30183-6-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1465231508-30183-1-git-send-email-marcandre.lureau@redhat.com> References: <1465231508-30183-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH 05/10] vhost-user: disconnect on start failure 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: Yuanhan Liu , "Michael S . Tsirkin" , Ilya Maximets , jonshin@cisco.com, Tetsuya Mukawa , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau If the backend failed to start (for example feature negociation failed), do not exit, but disconnect the char device instead. Slightly more robust for reconnect case. Signed-off-by: Marc-André Lureau Tested-by: Yuanhan Liu Reviewed-by: Yuanhan Liu --- net/vhost-user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/vhost-user.c b/net/vhost-user.c index 4a7fd5f..41ddb4b 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -202,7 +202,8 @@ static void net_vhost_user_event(void *opaque, int event) s->watch = qemu_chr_fe_add_watch(s->chr, G_IO_HUP, net_vhost_user_watch, s); if (vhost_user_start(queues, ncs) < 0) { - exit(1); + qemu_chr_disconnect(s->chr); + return; } qmp_set_link(name, true, &err); break;