Re: [Qemu-block] [PATCH 2/2] block: Inactivate all children

2016-05-09 Thread Fam Zheng
On Fri, 05/06 09:49, Kevin Wolf wrote: > Am 05.05.2016 um 02:32 hat Fam Zheng geschrieben: > > On Wed, 05/04 12:12, Kevin Wolf wrote: > > > Am 19.04.2016 um 03:42 hat Fam Zheng geschrieben: > > > > Currently we only inactivate the top BDS. Actually bdrv_inactivate > > > > should be the opposite of

[Qemu-block] [PATCH v4 27/27] qemu-iotests: Add test case 153 for image locking

2016-05-09 Thread Fam Zheng
Signed-off-by: Fam Zheng --- tests/qemu-iotests/153 | 191 +++ tests/qemu-iotests/153.out | 241 + tests/qemu-iotests/group | 1 + 3 files changed, 433 insertions(+) create mode 100755

[Qemu-block] [PATCH v4 26/27] block: Turn on image locking by default

2016-05-09 Thread Fam Zheng
Now that test cases are covered, we can turn it on. RO (shared) lock is disabled to allow existing libguestfs use cases (invoking QEMU for reading image that is exclusively locked by another QEMU). Signed-off-by: Fam Zheng --- block.c| 7 +++ blockdev.c | 2 +- 2 files

[Qemu-block] [PATCH v4 21/27] qemu-iotests: Wait for QEMU processes before checking image in 091

2016-05-09 Thread Fam Zheng
We should wait for the QEMU process to terminate and close the image before we check the data. Signed-off-by: Fam Zheng --- tests/qemu-iotests/091 | 3 +++ tests/qemu-iotests/091.out | 1 + 2 files changed, 4 insertions(+) diff --git a/tests/qemu-iotests/091

[Qemu-block] [PATCH v4 23/27] iotests: 087: Disable image lock in cases where file is shared

2016-05-09 Thread Fam Zheng
Otherwise the error handling we are expceting will be masked by the preceding image locking check, and is going to be indistinguishable because the error messages are all the same. Signed-off-by: Fam Zheng --- tests/qemu-iotests/087 | 6 ++ 1 file changed, 6 insertions(+)

[Qemu-block] [PATCH v4 19/27] qemu-iotests: 140: Disable image lock for qemu-io access

2016-05-09 Thread Fam Zheng
The VM is still on, the image locking check would complain. Signed-off-by: Fam Zheng --- tests/qemu-iotests/140 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140 index 49f9df4..3be656a 100755 ---

[Qemu-block] [PATCH v4 25/27] tests: Use null-co:// instead of /dev/null

2016-05-09 Thread Fam Zheng
With image locking, opening /dev/null can fail when multiple tests run in parallel (make -j2, for example). Use null-co:// as the null protocol doesn't do image locking. While it's arguable we could special-case /dev/null, /dev/zero, /dev/urandom etc in raw-posix driver, it is not really

[Qemu-block] [PATCH v4 24/27] iotests: Disable image locking in 085

2016-05-09 Thread Fam Zheng
The cases is about live snapshot features. Disable image locking because otherwise a few tests are going to fail because we reuse the same images at blockdev-add. Signed-off-by: Fam Zheng --- tests/qemu-iotests/085 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[Qemu-block] [PATCH v4 22/27] qemu-iotests: 030: Disable image lock when checking test image

2016-05-09 Thread Fam Zheng
The VM is running, qemu-io would fail the lock acquisition. Signed-off-by: Fam Zheng --- tests/qemu-iotests/030 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 3ac2443..fa996ef 100755 ---

[Qemu-block] [PATCH v4 16/27] qemu-nbd: Add "--no-lock/-L" option

2016-05-09 Thread Fam Zheng
Signed-off-by: Fam Zheng --- qemu-nbd.c| 7 ++- qemu-nbd.texi | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index c55b40f..a675a19 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -95,6 +95,7 @@ static void usage(const char

[Qemu-block] [PATCH v4 18/27] mirror: Disable image locking on target backing chain

2016-05-09 Thread Fam Zheng
In sync=none the backing image of s->target is s->common.bs, which could be exclusively locked, the image locking wouldn't work here. Later we can update completion code to lock it after the replaced node has dropped its lock. Signed-off-by: Fam Zheng --- blockdev.c | 6 ++

[Qemu-block] [PATCH v4 20/27] qemu-iotests: 046: Move version detection out from verify_io

2016-05-09 Thread Fam Zheng
So the image lock won't complain. Signed-off-by: Fam Zheng --- tests/qemu-iotests/046 | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046 index e528b67..365658e 100755 ---

[Qemu-block] [PATCH v4 17/27] block: Don't lock drive-backup target image in none mode

2016-05-09 Thread Fam Zheng
As a very special case, in sync=none mode, the source, as the backing image of the target, will be RO opened again, which is not accepted by image locking because the first open could be exclusive. Signed-off-by: Fam Zheng --- blockdev.c | 5 + 1 file changed, 5

[Qemu-block] [PATCH v4 14/27] qemu-img: Add "-L" option to sub commands

2016-05-09 Thread Fam Zheng
If specified, BDRV_O_NO_LOCK flag will be set when opening the image. Signed-off-by: Fam Zheng --- qemu-img.c | 89 ++ 1 file changed, 72 insertions(+), 17 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index

[Qemu-block] [PATCH v4 11/27] raw-posix: Implement .bdrv_lockf

2016-05-09 Thread Fam Zheng
virtlockd in libvirt locks the first byte, we lock byte 1 to avoid the intervene. Both file and host device protocols are covered. Suggested-by: "Daniel P. Berrange" Signed-off-by: Fam Zheng --- block/raw-posix.c | 22 ++ 1 file

[Qemu-block] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd

2016-05-09 Thread Fam Zheng
They are wrappers of POSIX fcntl file locking, with the additional interception of open/close (through qemu_open and qemu_close) to offer a better semantics that preserves the locks across multiple life cycles of different fds on the same file. The reason to make this semantics change over the

[Qemu-block] [PATCH v4 09/27] osdep: Introduce qemu_dup

2016-05-09 Thread Fam Zheng
This takes care both the CLOEXEC flag and fd-path mapping for image locking. Signed-off-by: Fam Zheng --- include/qemu/osdep.h | 1 + util/osdep.c | 15 +++ 2 files changed, 16 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index

[Qemu-block] [PATCH v4 06/27] block: Make bdrv_reopen_{commit, abort} private functions

2016-05-09 Thread Fam Zheng
As parts of the transactional reopen, they are not necessary outside block.c. Make them static. Signed-off-by: Fam Zheng --- block.c | 6 -- include/block/block.h | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index

[Qemu-block] [PATCH v4 07/27] block: Handle image locking during reopen

2016-05-09 Thread Fam Zheng
Stash the locking state into BDRVReopenState. If it was locked, unlock in prepare, and lock it again when commit or abort. Signed-off-by: Fam Zheng --- block.c | 11 +++ include/block/block.h | 1 + 2 files changed, 12 insertions(+) diff --git a/block.c

[Qemu-block] [PATCH v4 10/27] raw-posix: Use qemu_dup

2016-05-09 Thread Fam Zheng
Signed-off-by: Fam Zheng --- block/raw-posix.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 906d5c9..4e4d0d2 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -644,15 +644,7 @@ static int

[Qemu-block] [PATCH v4 03/27] blockdev: Add and parse "lock-image" option for block devices

2016-05-09 Thread Fam Zheng
Honor the locking switch specified in CLI or QMP, and set the open flags for the image accordingly. Signed-off-by: Fam Zheng --- blockdev.c | 12 1 file changed, 12 insertions(+) diff --git a/blockdev.c b/blockdev.c index f1f520a..200fa56 100644 --- a/blockdev.c

[Qemu-block] [PATCH v4 05/27] block: Add bdrv_image_locked

2016-05-09 Thread Fam Zheng
Signed-off-by: Fam Zheng --- block.c | 5 + include/block/block.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 16c7d58..bb7ebed 100644 --- a/block.c +++ b/block.c @@ -880,6 +880,11 @@ static int

[Qemu-block] [PATCH v4 01/27] block: Add BDRV_O_NO_LOCK

2016-05-09 Thread Fam Zheng
Later the block layer will automatically lock the images to avoid unexpected concurrent accesses to the same image, which will easily corrupt the metadata or user data, unless in some very special cases, like migration. The exceptional cases like shared storage migration and testing should set

[Qemu-block] [PATCH v4 02/27] qapi: Add lock-image in blockdev-add options

2016-05-09 Thread Fam Zheng
To allow overriding the default locking behavior when opening the image. Signed-off-by: Fam Zheng --- qapi/block-core.json | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 1d09079..2913f3e 100644 ---

[Qemu-block] [PATCH v4 00/27] block: Lock images when opening

2016-05-09 Thread Fam Zheng
v4: Don't lock RO image. [Rich] v3: Highlight is handling of image locks during close(3) and bdrv_reopen(). A number of new patches are added consequently. Fam Zheng (27): block: Add BDRV_O_NO_LOCK qapi: Add lock-image in blockdev-add options blockdev: Add and parse "lock-image"

Re: [Qemu-block] [PATCH v5 5/6] qemu-io: Add 'write -f' to test FUA flag

2016-05-09 Thread Max Reitz
On 08.05.2016 05:16, Eric Blake wrote: > Make it easier to test block drivers with BDRV_REQ_FUA in > .supported_write_flags, by adding the '-f' flag to qemu-io to > conditionally pass the flag through to specific writes ('write', > 'write -z', 'writev', 'aio_write', 'aio_write -z'). You'll want >

Re: [Qemu-block] [PATCH v8 3/3] block: enable testing of LUKS driver with block I/O tests

2016-05-09 Thread Daniel P. Berrange
On Fri, May 06, 2016 at 03:32:15PM +0200, Max Reitz wrote: > On 18.04.2016 14:21, Daniel P. Berrange wrote: > > This adds support for testing the LUKS driver with the block > > I/O test framework. > > > >cd tests/qemu-io-tests > >./check -luks > > > > A handful of test cases are modified

Re: [Qemu-block] [PATCH v4 8/8] linux-aio: share one LinuxAioState within an AioContext

2016-05-09 Thread Paolo Bonzini
On 19/04/2016 11:09, Stefan Hajnoczi wrote: >> > This has better performance because it executes fewer system calls >> > and does not use a bottom half per disk. > Each aio_context_t is initialized for 128 in-flight requests in > laio_init(). > > Will it be possible to hit the limit now that

Re: [Qemu-block] [Qemu-devel] [PATCH] qemu-io: Fix memory leak in 'aio_write -z'

2016-05-09 Thread Eric Blake
On 05/09/2016 04:03 AM, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > qemu-io-cmds.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Eric Blake Perhaps it would be easier to convert all the mid-function returns into 'goto cleanup', so that we

Re: [Qemu-block] [Qemu-devel] [PATCH v9 05/11] block: allow block jobs in any arbitrary node

2016-05-09 Thread Alberto Garcia
On Fri 06 May 2016 07:54:36 PM CEST, John Snow wrote: @@ -3694,18 +3696,18 @@ static BlockJob *find_block_job(const char *device, AioContext **aio_context, *aio_context = NULL; -blk = blk_by_name(device); -if (!blk) { +bs =

Re: [Qemu-block] [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-05-09 Thread Paolo Bonzini
On 28/04/2016 17:37, Michael S. Tsirkin wrote: > > All the internally-emulated devices *can* be either translated or > > untranslated. That's just a matter of software. Surely, you currently > > *can't* have translated assigned devices (until someone implements the > > whole VT-d page table

Re: [Qemu-block] [PULL 4/5] aio-posix: Skip external nodes in aio_dispatch

2016-05-09 Thread Paolo Bonzini
On 22/04/2016 17:05, Kevin Wolf wrote: > From: Fam Zheng > > aio_poll doesn't poll the external nodes so this should never be true, > but aio_ctx_dispatch may get notified by the events from GSource. To > make bdrv_drained_begin effective in main loop, we should check the >

[Qemu-block] [PATCH] qemu-io: Fix memory leak in 'aio_write -z'

2016-05-09 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- qemu-io-cmds.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index e34f777..41580b5 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -1699,6 +1699,7 @@ static int aio_write_f(BlockBackend *blk, int argc,

Re: [Qemu-block] [PATCH v13 2/3] quorum: implement bdrv_add_child() and bdrv_del_child()

2016-05-09 Thread Changlong Xie
On 05/06/2016 11:20 PM, Max Reitz wrote: On 13.04.2016 10:33, Changlong Xie wrote: From: Wen Congyang Signed-off-by: Wen Congyang Signed-off-by: zhanghailiang Signed-off-by: Gonglei

Re: [Qemu-block] [PATCH for-2.6 2/2] block/gluster: prevent data loss after i/o error

2016-05-09 Thread Raghavendra Talur
On Mon, Apr 11, 2016 at 9:56 AM, Raghavendra Gowdappa wrote: > > > +Raghavendra G who implemented this option in write-behind, to this > > upstream patch review discussion > > Thanks Pranith. Kritika did inform us about the discussion. We were > working on ways to find out

[Qemu-block] [PATCH v2] rbd:change error_setg() to error_setg_errno()

2016-05-09 Thread Vikhyat Umrao
Ceph RBD block driver does not use error_setg_errno() where it is possible to use. This patch replaces error_setg() from error_setg_errno(). Signed-off-by: Vikhyat Umrao --- block/rbd.c | 38 +++--- 1 file changed, 23 insertions(+), 15

Re: [Qemu-block] [PATCH for-2.6 2/2] block/gluster: prevent data loss after i/o error

2016-05-09 Thread Kevin Wolf
Am 09.05.2016 um 08:38 hat Raghavendra Talur geschrieben: > > > On Mon, Apr 11, 2016 at 9:56 AM, Raghavendra Gowdappa > wrote: > > > > +Raghavendra G who implemented this option in write-behind, to this > > upstream patch review discussion > > Thanks Pranith.

Re: [Qemu-block] [Qemu-devel] [PATCH v9 05/11] block: allow block jobs in any arbitrary node

2016-05-09 Thread Kevin Wolf
Am 06.05.2016 um 19:54 hat John Snow geschrieben: > > > On 05/06/2016 06:00 AM, Alberto Garcia wrote: > > On Fri 29 Apr 2016 05:00:57 PM CEST, Kevin Wolf wrote: > > > >>> - Block jobs can now be identified by the node name of their > >>> BlockDriverState in addition to the device name. Since