Received: from eggs.gnu.org ([2001:4830:134:3::10]:52656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsOFg-0002jy-1X for qemu-devel@nongnu.org; Thu, 27 Jun 2013 22:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsOFd-0003Jz-N6 for qemu-devel@nongnu.org; Thu, 27 Jun 2013 22:17:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsOFd-0003Jt-F8 for qemu-devel@nongnu.org; Thu, 27 Jun 2013 22:17:29 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5S2HSw2020585 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Jun 2013 22:17:28 -0400 Date: Fri, 28 Jun 2013 10:17:31 +0800 From: Fam Zheng Message-ID: <20130628021731.GA14421@t430s.nay.redhat.com> References: <1372219161-12209-1-git-send-email-famz@redhat.com> <1372219161-12209-2-git-send-email-famz@redhat.com> <20130627081536.GE13780@stefanha-thinkpad.redhat.com> <20130627094134.GA8076@t430s.nay.redhat.com> <51CC1A8F.3070004@redhat.com> <20130627113722.GA22728@t430s.nay.redhat.com> <51CC24AF.9010001@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51CC24AF.9010001@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 1/3] block: add target-id option to drive-backup QMP command Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, obarenbo@redhat.com, armbru@redhat.com, roliveri@redhat.com, hbrock@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com, pmyers@redhat.com, imain@redhat.com, Stefan Hajnoczi On Thu, 06/27 13:40, Paolo Bonzini wrote: > Il 27/06/2013 13:37, Fam Zheng ha scritto: > >>> > > > >>> > > Yes, this makes me realize that ref count it not a solution to retire > >>> > > bs->in_use, because we can't tell if drive-del or block-resize is safe > >>> > > with only reference number. But I can't think of two situations to deny > >>> > > different subsets of commands, shouldn't a general blocker, like in_use > >>> > > does, be good enough? > >> > > >> > For example, right now nbd-server-add does not check bdrv_in_use. But > >> > shrinking a device that is exposed via NBD could be surprising to the > >> > NBD clients. > >> > > > So it seems to me that both block job and nbd server have the same > > restriction on device: don't resize, and notify on close. So my question > > is if we implement bdrv_add_command_blocker(), do the callers still need to distinguish what actions to block, or it's generally to block all the actions those change the device parameter? > > It would be a good start to have a list of things that are setting and > checking bdrv_in_use. Then we can make a matrix. > Grapping the code and get: Commands fail with -EBUSY if bdrv_in_use(): bdrv_commit() bdrv_truncate() external_snapshot_prepare() eject_device() drive_del() drive_mirror() block_job_create() Commands to set bdrv in_use to 1: init_blk_migration() block_job_create() virtio_blk_data_plane_create() -- Fam