From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuGaK-0001zm-SW for qemu-devel@nongnu.org; Wed, 03 Jul 2013 02:30:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UuGaI-0006ls-CO for qemu-devel@nongnu.org; Wed, 03 Jul 2013 02:30:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuGaI-0006lo-5w for qemu-devel@nongnu.org; Wed, 03 Jul 2013 02:30:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r636UWpa027874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Jul 2013 02:30:32 -0400 Date: Wed, 3 Jul 2013 14:30:30 +0800 From: Fam Zheng Message-ID: <20130703063030.GA1112@t430s.nay.redhat.com> References: <1372744789-997-1-git-send-email-famz@redhat.com> <1372744789-997-4-git-send-email-famz@redhat.com> <51D2A890.4060806@redhat.com> <20130703011009.GE1949@t430s.nay.redhat.com> <51D3BD75.4030408@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51D3BD75.4030408@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/7] nbd: use BDS refcount Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, rjones@redhat.com, obarenbo@redhat.com, roliveri@redhat.com, hbrock@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, pmyers@redhat.com, imain@redhat.com, stefanha@redhat.com On Wed, 07/03 07:58, Paolo Bonzini wrote: > Il 03/07/2013 03:10, Fam Zheng ha scritto: > > > This has the important side effect of marking the exported disk as > > > "in_use" (to use the terms before the series). Right now you can serve > > > a disk and, at the same time, stream it or mirror it or create a live > > > snapshot of it. > > > > > > Do we really want to block anything for a device being served? Perhaps > > > truncation, but maybe not even that. The NBD server is meant to be as > > > unobtrusive as possible (in some sense NBD accesses are the same as > > > guest accesses). > > > > OK, it is better to work like that. But I don't quite understand why was > > there drive_get_ref() on the device (w/o the series), as there's already > > a close notifier? And it just drive_put_ref() when bs is closed? > > The close notifier runs when the user invokes a drive_del or eject > command from the monitor. The drive_get_ref/drive_put_ref delays the > bdrv_delete until after nbd.c has cleaned up all the connections. But drive_put_ref is called by close notifier. I think it can be omitted, registering a close notifier is enough, and close the export when drive_del calls it. It doesn't make more sense w/ drive_get_ref, does it? -- Fam