[Qemu-block] [PATCH v2 3/3] block/iscsi: fix ioctl cancel use-after-free

2018-02-02 Thread Stefan Hajnoczi
iscsi_aio_cancel() does not increment the request's reference count, causing a use-after-free when ABORT TASK finishes after the request has already completed. There are some additional issues with iscsi_aio_cancel(): 1. Several ABORT TASKs may be sent for the same task if iscsi_aio_cancel()

[Qemu-block] [PATCH v2 2/3] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events()

2018-02-02 Thread Stefan Hajnoczi
Commit d045c466d9e62b4321fadf586d024d54ddfd8bd4 ("iscsi: do not use aio_context_acquire/release") introduced iscsilun->mutex but appears to have overlooked iscsi_timed_check_events() when introducing the mutex. iscsi_service() and iscsi_set_events() must be called with iscsilun->mutex held.

[Qemu-block] [PATCH v2 1/3] block/iscsi: drop unused IscsiAIOCB->buf field

2018-02-02 Thread Stefan Hajnoczi
The IscsiAIOCB->buf field has not been used since commit e49ab19fcaa617ad6cdfe1ac401327326b6a2552 ("block/iscsi: bump libiscsi requirement to 1.9.0"). It used to be a linear buffer for old libiscsi versions that didn't support scatter-gather. The minimum libiscsi version supports scatter-gather

Re: [Qemu-block] [PATCH 3/3] block/iscsi: fix ioctl cancel use-after-free

2018-02-02 Thread Stefan Hajnoczi
On Fri, Feb 2, 2018 at 10:16 PM, Stefan Hajnoczi wrote: > The ioctl request cancellation code assumes that requests do not > complete once TASK ABORT has been sent to the iSCSI target. The request > completion callback is unconditionally invoked when TASK ABORT finishes. >

Re: [Qemu-block] [Qemu-devel] rate limiting issues

2018-02-02 Thread John Snow
CCing qemu-block and Berto On 02/02/2018 06:10 AM, Wolfgang Bumiller wrote: > Summary: > Rate limit is effectively halved when the size of written chunks adds up to > exceeding the quota of a slice only slightly. This is surprisingly reliable. > > Explanation: > The ratelimiting code in

[Qemu-block] [PATCH 2/3] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events()

2018-02-02 Thread Stefan Hajnoczi
Commit d045c466d9e62b4321fadf586d024d54ddfd8bd4 ("iscsi: do not use aio_context_acquire/release") introduced iscsilun->mutex but appears to have overlooked iscsi_timed_check_events() when introducing the mutex. iscsi_service() and iscsi_set_events() must be called with iscsilun->mutex held.

[Qemu-block] [PATCH 3/3] block/iscsi: fix ioctl cancel use-after-free

2018-02-02 Thread Stefan Hajnoczi
The ioctl request cancellation code assumes that requests do not complete once TASK ABORT has been sent to the iSCSI target. The request completion callback is unconditionally invoked when TASK ABORT finishes. Therefore the request completion callback is invoked twice if the request does happen

[Qemu-block] [PATCH 1/3] block/iscsi: drop unused IscsiAIOCB->buf field

2018-02-02 Thread Stefan Hajnoczi
The IscsiAIOCB->buf field has not been used since commit e49ab19fcaa617ad6cdfe1ac401327326b6a2552 ("block/iscsi: bump libiscsi requirement to 1.9.0"). It used to be a linear buffer for old libiscsi versions that didn't support scatter-gather. The minimum libiscsi version supports scatter-gather

[Qemu-block] [PATCH 0/3] block/iscsi: fix ioctl cancel use-after-free

2018-02-02 Thread Stefan Hajnoczi
Patches 1 & 2 are cleanups. Patch 3 fixes cancellation of ioctls. Felipe showed me a trace where an acb is cancelled and then completes twice. The second time around crashes QEMU. Compile-tested only. Felipe: Please let us know if this fixes the issue you are seeing. Thanks! Stefan Hajnoczi

Re: [Qemu-block] [PULL 0/2] Block patches

2018-02-02 Thread Peter Maydell
On 1 February 2018 at 04:06, Jeff Cody wrote: > The following changes since commit b05631954d6dfe93340d516660397e2c1a2a5dd6: > > Merge remote-tracking branch 'remotes/rth/tags/pull-hppa-20180131' into > staging (2018-01-31 15:50:29 +) > > are available in the git

Re: [Qemu-block] [PATCH v7 for-2.12 21/25] block: Purify .bdrv_refresh_filename()

2018-02-02 Thread Max Reitz
On 2017-12-04 19:25, Max Reitz wrote: > On 2017-12-04 17:37, Alberto Garcia wrote: >> On Mon 20 Nov 2017 09:10:00 PM CET, Max Reitz wrote: >>> -static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options) >>> +static void blkdebug_refresh_filename(BlockDriverState *bs) >>> { >>>

Re: [Qemu-block] [PATCH v3] block: maintain persistent disabled bitmaps

2018-02-02 Thread Max Reitz
On 2018-02-02 17:18, Eric Blake wrote: > On 02/02/2018 10:07 AM, Vladimir Sementsov-Ogievskiy wrote: >> To maintain load/store disabled bitmap there is new approach: >> >> - deprecate @autoload flag of block-dirty-bitmap-add, make it ignored >> - store enabled bitmaps as "auto" to qcow2 >> -

Re: [Qemu-block] [PATCH 1/2] qcow2: add overlap check for bitmap directory

2018-02-02 Thread Max Reitz
On 2018-02-02 14:48, Vladimir Sementsov-Ogievskiy wrote: > 02.02.2018 16:00, Max Reitz wrote: >> On 2018-02-02 13:07, Vladimir Sementsov-Ogievskiy wrote: >>> 29.01.2018 18:34, Max Reitz wrote: On 2017-11-30 17:47, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir

Re: [Qemu-block] [PATCH v3] block: maintain persistent disabled bitmaps

2018-02-02 Thread Vladimir Sementsov-Ogievskiy
02.02.2018 19:18, Eric Blake wrote: On 02/02/2018 10:07 AM, Vladimir Sementsov-Ogievskiy wrote: To maintain load/store disabled bitmap there is new approach: - deprecate @autoload flag of block-dirty-bitmap-add, make it ignored - store enabled bitmaps as "auto" to qcow2 - store disabled

Re: [Qemu-block] [Qemu-devel] [PATCH v2 3/6] qapi: add block-dirty-bitmap-enable/disable

2018-02-02 Thread Vladimir Sementsov-Ogievskiy
22.01.2018 22:56, John Snow wrote: On 01/22/2018 02:51 PM, Eric Blake wrote: On 01/22/2018 03:09 AM, Vladimir Sementsov-Ogievskiy wrote: I have to admit exposing this interface still makes me nervous, but :) Mechanically correct, and with suggesting phrasing changes: Reviewed-by: John Snow

[Qemu-block] [PATCH v3] block: maintain persistent disabled bitmaps

2018-02-02 Thread Vladimir Sementsov-Ogievskiy
To maintain load/store disabled bitmap there is new approach: - deprecate @autoload flag of block-dirty-bitmap-add, make it ignored - store enabled bitmaps as "auto" to qcow2 - store disabled bitmaps without "auto" flag to qcow2 - on qcow2 open load "auto" bitmaps as enabled and others as

Re: [Qemu-block] [PATCH v3 24/39] qcow2: Update discard_single_l2() to support L2 slices

2018-02-02 Thread Alberto Garcia
On Thu 01 Feb 2018 08:07:15 PM CET, Max Reitz wrote: > On 2018-01-26 15:59, Alberto Garcia wrote: >> discard_single_l2() limits the number of clusters to be discarded to >> the amount that fits inside an L2 table. Since we'll be loading L2 >> slices instead of full tables we

Re: [Qemu-block] [PATCH v3 31/39] qcow2: Update qcow2_truncate() to support L2 slices

2018-02-02 Thread Alberto Garcia
On Thu 01 Feb 2018 08:46:46 PM CET, Max Reitz wrote: >> @@ -3261,8 +3261,9 @@ static int qcow2_truncate(BlockDriverState *bs, >> int64_t offset, >> guest_offset = old_length; >> while (nb_new_data_clusters) { >> int64_t guest_cluster =

Re: [Qemu-block] [PATCH v2] block: maintain persistent disabled bitmaps

2018-02-02 Thread Vladimir Sementsov-Ogievskiy
02.02.2018 18:23, Max Reitz wrote: On 2018-02-02 16:18, Vladimir Sementsov-Ogievskiy wrote: 31.01.2018 22:04, Max Reitz wrote: On 2018-01-29 19:43, Max Reitz wrote: On 2018-01-22 11:41, Vladimir Sementsov-Ogievskiy wrote: To maintain load/store disabled bitmap there is new approach:   -

Re: [Qemu-block] [Qemu-devel] [PATCH v3 17/39] qcow2: Update l2_allocate() to support L2 slices

2018-02-02 Thread Alberto Garcia
On Thu 01 Feb 2018 07:22:16 PM CET, Max Reitz wrote: > On 2018-02-01 16:43, Alberto Garcia wrote: >> On Thu 01 Feb 2018 04:23:09 PM CET, Anton Nefedov wrote: > However, I'm wondering whether this is the best approach. The old > L2 table is probably not going to be used after this

Re: [Qemu-block] [PATCH v3 17/39] qcow2: Update l2_allocate() to support L2 slices

2018-02-02 Thread Alberto Garcia
On Thu 01 Feb 2018 07:15:23 PM CET, Max Reitz wrote: -static int l2_allocate(BlockDriverState *bs, int l1_index, uint64_t **table) +static int l2_allocate(BlockDriverState *bs, int l1_index) { BDRVQcow2State *s = bs->opaque; uint64_t

Re: [Qemu-block] [PATCH v3 21/39] qcow2: Update qcow2_alloc_cluster_link_l2() to support L2 slices

2018-02-02 Thread Alberto Garcia
On Thu 01 Feb 2018 07:44:56 PM CET, Max Reitz wrote: > On 2018-01-26 15:59, Alberto Garcia wrote: >> There's a loop in this function that iterates over the L2 entries in a >> table, so now we need to assert that it remains within the limits of >> an L2 slice. >> >> Apart from

Re: [Qemu-block] [PATCH 1/2] qcow2: add overlap check for bitmap directory

2018-02-02 Thread Max Reitz
On 2018-02-02 13:07, Vladimir Sementsov-Ogievskiy wrote: > 29.01.2018 18:34, Max Reitz wrote: >> On 2017-11-30 17:47, Vladimir Sementsov-Ogievskiy wrote: >>> Signed-off-by: Vladimir Sementsov-Ogievskiy >>> --- >>>   block/qcow2.h  |  7 +-- >>>  

[Qemu-block] [PATCH v3] iotests: Fix CID for VMDK afl image

2018-02-02 Thread Fam Zheng
This reverts commit 76bf133c4 which updated the reference output, and fixed the reference image, because the code path we want to exercise is actually the invalid image size. The descriptor block in the image, which includes the CID to verify, has been invalid since the reference image was added.

Re: [Qemu-block] [PATCH 1/1] nbd: implement bdrv_get_info callback

2018-02-02 Thread Eric Blake
On 02/02/2018 08:06 AM, Edgar Kaziakhmedov wrote: However, it would be nice to remove can_write_zeroes_with_unmap from BlockDriverInfo, and make bdrv_can_write_zeroes_with_unmap just return !!(bs->supported_zero_flags & BDRV_REQ_MAY_UNMAP).  Kevin, what do you think? >>

Re: [Qemu-block] [PATCH 1/1] nbd: implement bdrv_get_info callback

2018-02-02 Thread Edgar Kaziakhmedov
On 02/02/2018 05:15 PM, Eric Blake wrote: On 02/02/2018 08:06 AM, Edgar Kaziakhmedov wrote: However, it would be nice to remove can_write_zeroes_with_unmap from BlockDriverInfo, and make bdrv_can_write_zeroes_with_unmap just return !!(bs->supported_zero_flags & BDRV_REQ_MAY_UNMAP).  Kevin,

Re: [Qemu-block] [PATCH 1/2] qcow2: add overlap check for bitmap directory

2018-02-02 Thread Vladimir Sementsov-Ogievskiy
02.02.2018 16:00, Max Reitz wrote: On 2018-02-02 13:07, Vladimir Sementsov-Ogievskiy wrote: 29.01.2018 18:34, Max Reitz wrote: On 2017-11-30 17:47, Vladimir Sementsov-Ogievskiy wrote: Signed-off-by: Vladimir Sementsov-Ogievskiy ---   block/qcow2.h  |  7

Re: [Qemu-block] [PATCH v3] iotests: Fix CID for VMDK afl image

2018-02-02 Thread Max Reitz
On 2018-02-02 06:23, Fam Zheng wrote: > This reverts commit 76bf133c4 which updated the reference output, and > fixed the reference image, because the code path we want to exercise is > actually the invalid image size. > > The descriptor block in the image, which includes the CID to verify, has

Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/6] qmp dirty bitmap API

2018-02-02 Thread Vladimir Sementsov-Ogievskiy
22.01.2018 20:23, John Snow wrote: On 01/22/2018 07:22 AM, Vladimir Sementsov-Ogievskiy wrote: 22.01.2018 12:20, Vladimir Sementsov-Ogievskiy wrote: 20.01.2018 02:30, John Snow wrote: On 01/16/2018 07:54 AM, Vladimir Sementsov-Ogievskiy wrote: Hi all. There are three qmp commands, needed

Re: [Qemu-block] [PATCH 1/2] qcow2: add overlap check for bitmap directory

2018-02-02 Thread Vladimir Sementsov-Ogievskiy
29.01.2018 18:34, Max Reitz wrote: On 2017-11-30 17:47, Vladimir Sementsov-Ogievskiy wrote: Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/qcow2.h | 7 +-- block/qcow2-refcount.c | 12 block/qcow2.c | 6 ++ 3 files

Re: [Qemu-block] [PATCH 1/1] nbd: implement bdrv_get_info callback

2018-02-02 Thread Edgar Kaziakhmedov
On 01/26/2018 05:28 PM, Eric Blake wrote: On 01/26/2018 06:39 AM, Edgar Kaziakhmedov wrote: PIng So, let me know if I need to make any changes in patch On 1/18/18 1:09 PM, Paolo Bonzini wrote: On 18/01/2018 12:51, Edgar Kaziakhmedov wrote: +static int nbd_get_info(BlockDriverState *bs,