From patchwork Thu Feb 7 00:25:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 218807 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A14032C02FF for ; Thu, 7 Feb 2013 11:30:54 +1100 (EST) Received: from localhost ([::1]:50566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3FO8-0003IY-NF for incoming@patchwork.ozlabs.org; Wed, 06 Feb 2013 19:30:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3FNy-0003HN-Bv for qemu-devel@nongnu.org; Wed, 06 Feb 2013 19:30:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3FNx-0007eR-8q for qemu-devel@nongnu.org; Wed, 06 Feb 2013 19:30:42 -0500 Received: from mail-ie0-x233.google.com ([2607:f8b0:4001:c03::233]:62222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3FNx-0007eN-46 for qemu-devel@nongnu.org; Wed, 06 Feb 2013 19:30:41 -0500 Received: by mail-ie0-f179.google.com with SMTP id k11so2736621iea.38 for ; Wed, 06 Feb 2013 16:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=AydMb9jixmZB8LsIUY51BRcT1HCdA/matXweIff3u8M=; b=DJ2DWcOTf0qD5somy68K3cCVb612rX4SJyRmk26nElwmHAM4TSQag6HcWyGmBVptbm O9OIndZPTJvBtrOpaA6A7VAZZiXHQGOmZEMG2uBCZ0fXajqRCKDlU2xG1TsG4+QAxJWx Pq5ph/5HCCfNGxVXOQGJzX7rrjCwuQ2ukaV+iu7UUjxH6iKcg1Tk2wz8GyCyCIpXA5CB cCVoW4Z/OidOsgRmc2VX9fNqIwVi72wfCaCOuhibuEoXn7y8mux7tYC/KdnHFtmAKSd0 RT+BmeH33EmEsX0acVG1V/PO6CEiC70uFqbY8wUP9gRnD1TtU8EUyVlCxR5wsAhkl1Jb c2gg== X-Received: by 10.43.7.7 with SMTP id om7mr32315014icb.25.1360197040132; Wed, 06 Feb 2013 16:30:40 -0800 (PST) Received: from localhost ([32.97.110.59]) by mx.google.com with ESMTPS id fb10sm6398164igb.1.2013.02.06.16.30.38 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Feb 2013 16:30:39 -0800 (PST) From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 6 Feb 2013 18:25:48 -0600 Message-Id: <1360196748-15023-1-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c03::233 Cc: jasowang@redhat.com, aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH for-1.4] net: fix infinite loop on exit 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 1ceef9f27359cbe92ef124bf74de6f792e71f6fb added handling for cleaning up multiple queues in qemu_del_nic() for cases where multiqueue is in use. To determine the number of queues it looks at nic->conf->queues, then iterates through all the queues to cleanup the associated NetClientStates. If no queues are found, no NetClientStates are deleted. However, nic->conf->queues is only set when a peer is created via -netdev or netdev_add, and is otherwise 0. This causes us to spin in net_cleanup() if we attempt to shut down qemu before adding a host device. Since qemu_new_nic() unconditionally creates at least 1 queue/NetClientState at queue idx 0, make qemu_del_nic() always attempt to clean it up. Signed-off-by: Michael Roth Acked-by: Jason Wang Acked-by: Amos Kong Acked-by: Stefan Hajnoczi --- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/net.c b/net/net.c index 9806862..f9e7136 100644 --- a/net/net.c +++ b/net/net.c @@ -351,7 +351,7 @@ void qemu_del_net_client(NetClientState *nc) void qemu_del_nic(NICState *nic) { - int i, queues = nic->conf->queues; + int i, queues = MAX(nic->conf->queues, 1); /* If this is a peer NIC and peer has already been deleted, free it now. */ if (nic->peer_deleted) {