From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtcdK-00013h-Jy for qemu-devel@nongnu.org; Mon, 01 Jul 2013 07:51:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtcdJ-0000XG-EC for qemu-devel@nongnu.org; Mon, 01 Jul 2013 07:51:02 -0400 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:46905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtcdJ-0000Vs-7H for qemu-devel@nongnu.org; Mon, 01 Jul 2013 07:51:01 -0400 Received: by mail-we0-f181.google.com with SMTP id p58so3229396wes.12 for ; Mon, 01 Jul 2013 04:51:00 -0700 (PDT) Date: Mon, 1 Jul 2013 13:50:57 +0200 From: Stefan Hajnoczi Message-ID: <20130701115057.GC5543@stefanha-thinkpad.redhat.com> References: <1371114186-8854-1-git-send-email-qemulist@gmail.com> <1371114186-8854-4-git-send-email-qemulist@gmail.com> <20130618124133.GJ7649@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v2 3/6] net: make netclient re-entrant with refcnt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: qemu-devel@nongnu.org, Stefan Hajnoczi , mdroth On Thu, Jun 20, 2013 at 05:14:56PM +0800, liu ping fan wrote: > On Tue, Jun 18, 2013 at 8:41 PM, Stefan Hajnoczi wrote: > > On Thu, Jun 13, 2013 at 05:03:03PM +0800, Liu Ping Fan wrote: > >> @@ -1109,6 +1146,7 @@ void net_cleanup(void) > >> qemu_del_net_client(nc); > >> } > >> } > >> + qemu_mutex_destroy(&net_clients_lock); > > > > Why is it okay to iterate over net_clients here without the lock? > > atexit(&net_cleanup); So no other racers exist. What about dataplane? The device may not be reset when net_cleanup runs. It's best not to make assumptions, taking the lock is easy. Stefan