Re: [Qemu-block] about qemu-img info on block dev

2017-11-07 Thread Kevin Wolf
Am 07.11.2017 um 08:18 hat wang.guan...@zte.com.cn geschrieben: > hello > > > if we create a qcow2 file on a block dev. > > > we can,t get the right disk size by qemu-img info。 > > > > > > > [root@host-120-79 qemu]# ./qemu-img create -f qcow2 /dev/zs/lvol0 1G > > Formatting

[Qemu-block] [PATCH v2] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-07 Thread Sergio Lopez
Commit b7a745d added a qemu_bh_cancel call to the completion function as an optimization to prevent it from unnecessarily rescheduling itself. This completion function is scheduled from worker_thread, after setting the state of a ThreadPoolElement to THREAD_DONE. This was considered to be safe,

Re: [Qemu-block] [PATCH v3 6/7] block/curl: fix minor memory leaks

2017-11-07 Thread Eric Blake
On 11/07/2017 04:27 PM, Jeff Cody wrote: > Signed-off-by: Jeff Cody > --- > block/curl.c | 6 ++ > 1 file changed, 6 insertions(+) Reviewed-by: Eric Blake > > diff --git a/block/curl.c b/block/curl.c > index 00a9879..35cf417 100644 > ---

Re: [Qemu-block] [PATCH v2] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-07 Thread Fam Zheng
Hi Sergio, On Tue, 11/07 23:54, Sergio Lopez wrote: > Commit b7a745d added a qemu_bh_cancel call to the completion function > as an optimization to prevent it from unnecessarily rescheduling itself. > > This completion function is scheduled from worker_thread, after setting > the state of a

Re: [Qemu-block] [PATCH v2] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-07 Thread Sergio Lopez Pascual
Hi Fam, On Wed, Nov 8, 2017 at 2:29 AM, Fam Zheng wrote: >>I/O thread | worker thread > > Isn't the left column "workder thread" and the right one "I/O thread"? > Yes, you're right. I'm going to switch them back. Thanks, Sergio.

[Qemu-block] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-07 Thread Sergio Lopez
Commit b7a745d added a qemu_bh_cancel call to the completion function as an optimization to prevent it from unnecessarily rescheduling itself. This completion function is scheduled from worker_thread, after setting the state of a ThreadPoolElement to THREAD_DONE. This was considered to be safe,

Re: [Qemu-block] [Qemu-devel] Clean Block Driver Shutdown

2017-11-07 Thread Markus Armbruster
Stefan Hajnoczi writes: > On Tue, Oct 17, 2017 at 01:46:25PM +0200, Kevin Wolf wrote: >> Am 17.10.2017 um 12:33 hat Peter Lieven geschrieben: >> > I noticed that Qemu quits at several points with an exit() if the >> > supplied parameters in the commandline are incorrect. This

Re: [Qemu-block] [Qemu-devel] question: I found a qemu crash when attach virtio-scsi disk

2017-11-07 Thread Paolo Bonzini
On 07/11/2017 02:59, Fam Zheng wrote: > On Mon, 11/06 17:33, Paolo Bonzini wrote: >> On 06/11/2017 17:11, Kevin Wolf wrote: >>> Am 03.11.2017 um 11:26 hat Stefan Hajnoczi geschrieben: On Wed, Nov 01, 2017 at 06:42:33AM +, lizhengui wrote: > Hi, when I attach virtio-scsi disk to VM,

Re: [Qemu-block] [PATCH v3 3/4] block/parallels: add migration blocker

2017-11-07 Thread Stefan Hajnoczi
On Mon, Nov 06, 2017 at 09:31:21PM -0500, Jeff Cody wrote: > @@ -720,6 +722,16 @@ static int parallels_open(BlockDriverState *bs, QDict > *options, int flags, > s->bat_dirty_bmap = > bitmap_new(DIV_ROUND_UP(s->header_size, s->bat_dirty_block)); > > +/* Disable migration until

Re: [Qemu-block] [Qemu-devel] Clean Block Driver Shutdown

2017-11-07 Thread Peter Lieven
Am 07.11.2017 um 11:22 schrieb Markus Armbruster: Stefan Hajnoczi writes: On Tue, Oct 17, 2017 at 01:46:25PM +0200, Kevin Wolf wrote: Am 17.10.2017 um 12:33 hat Peter Lieven geschrieben: I noticed that Qemu quits at several points with an exit() if the supplied

Re: [Qemu-block] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

2017-11-07 Thread Markus Armbruster
Juan Quintela writes: > Alistair Francis wrote: >> Replace all occurs of __FUNCTION__ except for the check in checkpatch >> with the non GCC specific __func__. >> >> One line in hcd-musb.c was manually tweaked to pass checkpatch. >> >>

Re: [Qemu-block] [PATCH] block: Deprecate bdrv_set_read_only() and users

2017-11-07 Thread Eric Blake
On 11/07/2017 11:26 AM, Kevin Wolf wrote: > bdrv_set_read_only() is used by some block drivers to override the > read-only option given by the user. This is not how read-only images > generally work in QEMU: Instead of second guessing what the user really > meant (which currently includes making

[Qemu-block] [PATCH v3 2/7] block/ssh: make compliant with coding guidelines

2017-11-07 Thread Jeff Cody
Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- block/ssh.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/block/ssh.c b/block/ssh.c index de81ec8..39cacc1 100644 --- a/block/ssh.c +++

[Qemu-block] [PATCH v3 6/7] block/curl: fix minor memory leaks

2017-11-07 Thread Jeff Cody
Signed-off-by: Jeff Cody --- block/curl.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/block/curl.c b/block/curl.c index 00a9879..35cf417 100644 --- a/block/curl.c +++ b/block/curl.c @@ -857,6 +857,9 @@ out_noclean: qemu_mutex_destroy(>mutex);

[Qemu-block] [PATCH v3 3/7] block/sheepdog: remove spurious NULL check

2017-11-07 Thread Jeff Cody
'tag' is already checked in the lines immediately preceding this check, and set to non-NULL if NULL. No need to check again, it hasn't changed. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- block/sheepdog.c | 2 +- 1 file changed, 1 insertion(+), 1

[Qemu-block] [PATCH v3 1/7] block/ssh: don't call libssh2_init() in block_init()

2017-11-07 Thread Jeff Cody
We don't need libssh2 failure to be fatal (we could just opt to not register the driver on failure). But, it is probably a good idea to avoid external library calls during the block_init(), and call the libssh2 global init function on the first usage, returning any errors. Signed-off-by: Jeff

[Qemu-block] [PATCH v3 0/7] Code cleanup and minor fixes (for 2.11)

2017-11-07 Thread Jeff Cody
Changes from v2 -> v3: Patch 1: Return -EIO for ssh_state_init() (Thanks Eric) Patch 4: fixed missed line (Thanks Eric) Patch 7: fixed opaque pointer assignment (Thanks Eric) git-backport-diff -r master.. -u 81fb084 001/7:[0007] [FC] 'block/ssh: don't call libssh2_init() in block_init()'

[Qemu-block] [PATCH v3 7/7] block/curl: code cleanup to comply with coding style

2017-11-07 Thread Jeff Cody
This addresses non-functional changes to help curl.c better comply with the coding styles (comments, indentation, brackets, etc.). One minor code change is the combination of two if statements into a single if statement. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake

[Qemu-block] [PATCH v3 4/7] block/sheepdog: code beautification

2017-11-07 Thread Jeff Cody
No functional changes, just whitespace manipulation. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- block/sheepdog.c | 164 +++ 1 file changed, 82 insertions(+), 82 deletions(-) diff --git

[Qemu-block] [PATCH v3 5/7] block/curl: check error return of curl_global_init()

2017-11-07 Thread Jeff Cody
If curl_global_init() fails, per the documentation no other curl functions may be called, so make sure to check the return value. Also, some minor changes to the initialization latch variable 'inited': - Make it static in the file, for clarity - Change the name for clarity - Make it a bool

Re: [Qemu-block] [PATCH v2] throttle: fix a qemu crash problem when calling blk_delete

2017-11-07 Thread Manos Pitsidianakis
On Fri, Nov 03, 2017 at 02:26:33PM +, Stefan Hajnoczi wrote: On Wed, Oct 25, 2017 at 10:40:47AM +0200, Alberto Garcia wrote: On Tue 24 Oct 2017 05:33:51 AM CEST, sochin jiang wrote: > --- a/block/throttle-groups.c > +++ b/block/throttle-groups.c > @@ -576,7 +576,9 @@ void

Re: [Qemu-block] [PATCH 3/8] raw: Reflect read-only protocol layer

2017-11-07 Thread Paolo Bonzini
On 07/11/2017 04:02, Eric Blake wrote: > We forbid operations like a zero-length write zero or a discard > at the protocol layer when it is marked read-only, but those > same operations were succeeding at the format layer because the > raw format was not reflecting the underlying read-only status

Re: [Qemu-block] [Qemu-devel] Clean Block Driver Shutdown

2017-11-07 Thread Peter Lieven
Am 07.11.2017 um 12:02 schrieb Markus Armbruster: Peter Lieven writes: Am 07.11.2017 um 11:22 schrieb Markus Armbruster: Stefan Hajnoczi writes: On Tue, Oct 17, 2017 at 01:46:25PM +0200, Kevin Wolf wrote: Am 17.10.2017 um 12:33 hat Peter Lieven

Re: [Qemu-block] [PATCH v6 16/25] block: Add 'base-directory' BDS option

2017-11-07 Thread Alberto Garcia
On Thu 02 Nov 2017 11:06:28 PM CET, Eric Blake wrote: Using this option, one can directly override what bdrv_dirname() will return. This is useful if one uses e.g. qcow2 on top of quorum (with only protocol BDSs under the quorum BDS) and wants to be able to use relative

[Qemu-block] [PATCH v4 0/4] Don't write headers if BDS is INACTIVE

2017-11-07 Thread Jeff Cody
Changes from v3->v4: Patch 3: Add migrate_del_blocker and error_free (Thanks Stefan) git-backport-diff -r qemu/master.. -u ba11b69 001/4:[] [--] 'block/vhdx.c: Don't blindly update the header' 002/4:[] [--] 'block/parallels: Do not update header or truncate image when INMIGRATE'

[Qemu-block] [PATCH v4 3/4] block/parallels: add migration blocker

2017-11-07 Thread Jeff Cody
Migration does not work for parallels, and has been broken for a while (see patch 'block/parallels: Do not update header or truncate image when INMIGRATE'). The bdrv_invalidate_cache() method needs to be added for migration to be supported. Until this is done, prohibit migration.

Re: [Qemu-block] [PATCH 0/2] Optimize sparse reads over NBD

2017-11-07 Thread Paolo Bonzini
On 07/11/2017 04:09, Eric Blake wrote: > When I first proposed the NBD extension of structured reads, > it was in order to more efficiently read sparse files without > sending lots of zeroes over the wire. These two patches feel > like a feature addition, and missed soft freeze, so I'm >

Re: [Qemu-block] [Qemu-devel] Clean Block Driver Shutdown

2017-11-07 Thread Kevin Wolf
Am 07.11.2017 um 11:48 hat Peter Lieven geschrieben: > Am 07.11.2017 um 11:22 schrieb Markus Armbruster: > > Stefan Hajnoczi writes: > > > > > On Tue, Oct 17, 2017 at 01:46:25PM +0200, Kevin Wolf wrote: > > > > Am 17.10.2017 um 12:33 hat Peter Lieven geschrieben: > > > > > I

[Qemu-block] [PATCH v4 2/4] block/parallels: Do not update header or truncate image when INMIGRATE

2017-11-07 Thread Jeff Cody
If we write or modify the image file while the QEMU run state is INMIGRATE, then the BDRV_O_INACTIVE BDS flag is set. This will cause an assert, since the image is marked inactive. Make sure we obey this flag. Tested-by: Alexey Kardashevskiy Signed-off-by: Jeff Cody

[Qemu-block] [PATCH v4 1/4] block/vhdx.c: Don't blindly update the header

2017-11-07 Thread Jeff Cody
The VHDX specification requires that before user data modification of the vhdx image, the VHDX header file and data GUIDs need to be updated. In vhdx_open(), if the image is set to RDWR, we go ahead and update the header. However, just because the image is set to RDWR does not mean we can go

Re: [Qemu-block] [Qemu-devel] Clean Block Driver Shutdown

2017-11-07 Thread Markus Armbruster
Peter Lieven writes: > Am 07.11.2017 um 11:22 schrieb Markus Armbruster: >> Stefan Hajnoczi writes: >> >>> On Tue, Oct 17, 2017 at 01:46:25PM +0200, Kevin Wolf wrote: Am 17.10.2017 um 12:33 hat Peter Lieven geschrieben: > I noticed that Qemu quits at

[Qemu-block] [PATCH v4 4/4] qemu-iotests: update unsupported image formats in 194

2017-11-07 Thread Jeff Cody
Test 194 checks for 'luks' to exclude as an unsupported format, However, most formats are unsupported, due to migration blockers. Rather than specifying a blacklist of unsupported formats, whitelist supported formats (specifically, qcow2, qed, raw, dmg). Tested-by: Alexey Kardashevskiy

Re: [Qemu-block] Drainage in bdrv_replace_child_noperm()

2017-11-07 Thread Kevin Wolf
Am 06.11.2017 um 19:49 hat Max Reitz geschrieben: > Hi everyone, > > On my quest to fix some flaky iotests, I came to a bit of a halt on 129. > (Details: Its issue is that block jobs now generally ignore throttling > in a BB (because they use their own), so we have to add a throttle node >

[Qemu-block] [PATCH] block: Deprecate bdrv_set_read_only() and users

2017-11-07 Thread Kevin Wolf
bdrv_set_read_only() is used by some block drivers to override the read-only option given by the user. This is not how read-only images generally work in QEMU: Instead of second guessing what the user really meant (which currently includes making an image read-only even if the user didn't only use

Re: [Qemu-block] [PATCH v3 1/7] block/ssh: don't call libssh2_init() in block_init()

2017-11-07 Thread Eric Blake
On 11/07/2017 04:27 PM, Jeff Cody wrote: > We don't need libssh2 failure to be fatal (we could just opt to not > register the driver on failure). But, it is probably a good idea to > avoid external library calls during the block_init(), and call the > libssh2 global init function on the first

Re: [Qemu-block] [Qemu-devel] [PATCH] block: Close a BlockDriverState completely even when bs->drv is NULL

2017-11-07 Thread Eric Blake
On 11/06/2017 08:53 AM, Alberto Garcia wrote: > bdrv_close() skips much of its logic when bs->drv is NULL. This is > fine when we're closing a BlockDriverState that has just been created > (because e.g the initialization process failed), but it's not enough > in other cases. > > For example, when

Re: [Qemu-block] [Qemu-devel] [PATCH v3 6/7] block/curl: fix minor memory leaks

2017-11-07 Thread Philippe Mathieu-Daudé
Hi Jeff, On 11/07/2017 07:27 PM, Jeff Cody wrote: "Missed in 1bff9606429." > Signed-off-by: Jeff Cody Reviewed-by: Philippe Mathieu-Daudé > --- > block/curl.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/block/curl.c b/block/curl.c >

Re: [Qemu-block] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

2017-11-07 Thread Markus Armbruster
Eric Blake writes: > On 11/07/2017 04:12 AM, Markus Armbruster wrote: >> Juan Quintela writes: >> >>> Alistair Francis wrote: Replace all occurs of __FUNCTION__ except for the check in checkpatch with the non GCC

[Qemu-block] [PATCH] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-07 Thread Sergio Lopez
Commit b7a745d added a qemu_bh_cancel call to the completion function as an optimization to prevent it from unnecessarily rescheduling itself. This completion function is scheduled from worker_thread, after setting the state of a ThreadPoolElement to THREAD_DONE. This was considered to be safe,

[Qemu-block] segfault in parallel blockjobs (iotest 30)

2017-11-07 Thread Anton Nefedov
Hi, One more drainage-related thing. We have recently encountered an issue with parallel block jobs and it's not quite clear how to fix it properly, so would appreciate your ideas. The small attached tweak makes iotest 30 (-qcow2 -nocache) fail 10/10 times on my machine. And while most of the

Re: [Qemu-block] [Qemu-devel] [PATCH] block: Deprecate bdrv_set_read_only() and users

2017-11-07 Thread Daniel P. Berrange
On Tue, Nov 07, 2017 at 06:26:38PM +0100, Kevin Wolf wrote: > bdrv_set_read_only() is used by some block drivers to override the > read-only option given by the user. This is not how read-only images > generally work in QEMU: Instead of second guessing what the user really > meant (which currently

Re: [Qemu-block] [PATCH 3/8] raw: Reflect read-only protocol layer

2017-11-07 Thread Kevin Wolf
Am 07.11.2017 um 12:00 hat Paolo Bonzini geschrieben: > On 07/11/2017 04:02, Eric Blake wrote: > > We forbid operations like a zero-length write zero or a discard > > at the protocol layer when it is marked read-only, but those > > same operations were succeeding at the format layer because the >

Re: [Qemu-block] [PATCH] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-07 Thread Paolo Bonzini
On 07/11/2017 16:09, Sergio Lopez wrote: > Commit b7a745d added a qemu_bh_cancel call to the completion function > as an optimization to prevent it from unnecessarily rescheduling itself. > > This completion function is scheduled from worker_thread, after setting > the state of a

Re: [Qemu-block] [PATCH v2 4/7] qcow2: Don't open images with header.refcount_table_clusters == 0

2017-11-07 Thread Kevin Wolf
Am 03.11.2017 um 15:18 hat Alberto Garcia geschrieben: > qcow2_do_open() is checking that header.refcount_table_clusters is not > too large, but it doesn't check that it's greater than zero. Apart > from the fact that an image like that is obviously corrupted, trying > to use it crashes QEMU since

Re: [Qemu-block] [Qemu-devel] [PATCH v3 01/46] Replace all occurances of __FUNCTION__ with __func__

2017-11-07 Thread Eric Blake
On 11/07/2017 04:12 AM, Markus Armbruster wrote: > Juan Quintela writes: > >> Alistair Francis wrote: >>> Replace all occurs of __FUNCTION__ except for the check in checkpatch >>> with the non GCC specific __func__. >>> >>> +++