From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc8BY-0007Yz-Dq for qemu-devel@nongnu.org; Wed, 16 Sep 2015 04:35:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zc8BT-0003dI-Eo for qemu-devel@nongnu.org; Wed, 16 Sep 2015 04:35:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc8BT-0003cZ-AF for qemu-devel@nongnu.org; Wed, 16 Sep 2015 04:35:19 -0400 References: <55F91755.1010704@cn.fujitsu.com> <55F925AC.6060406@redhat.com> <55F926E3.4010006@cn.fujitsu.com> From: Paolo Bonzini Message-ID: <55F929C2.4080703@redhat.com> Date: Wed, 16 Sep 2015 10:35:14 +0200 MIME-Version: 1.0 In-Reply-To: <55F926E3.4010006@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] nbd: wait all read/write requests finished when shutdowning nbd socket List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , qemu-devl Cc: Li Zhijian On 16/09/2015 10:22, Wen Congyang wrote: >>> >> if (exp->blk) { >>> >> + bdrv_drain(blk_bs(exp->blk)); >>> >> blk_remove_aio_context_notifier(exp->blk, blk_aio_attached, >>> >> blk_aio_detach, exp); >>> >> blk_unref(exp->blk); >> > >> > I think a better fix is to move the whole "if" to nbd_export_put. In >> > fact, nbd_export_close is wrong because exp can be freed by >> > nbd_export_close's call to nbd_export_put. > OK, I will fix it in the next version. To be clear, the bug is pre-existing (commit 38b54b6, "nbd: use BlockDriverState refcnt", 2013-08-23). Paolo