[PATCH V3 1/2] block/nbd: extract the common cleanup code

2019-11-28 Thread pannengyuan
From: PanNengyuan The BDRVNBDState cleanup code is common in two places, add nbd_free_bdrvstate_prop() function to do these cleanups (suggested by Stefano Garzarella). Signed-off-by: PanNengyuan --- block/nbd.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-)

[PATCH V3 2/2] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread pannengyuan
From: PanNengyuan In currently implementation there will be a memory leak when nbd_client_connect() returns error status. Here is an easy way to reproduce: 1. run qemu-iotests as follow and check the result with asan: ./check -raw 143 Following is the asan output backtrack: Direct leak of

Re: [PATCH V2] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread pannengyuan
On 2019/11/28 21:36, Stefano Garzarella wrote: > On Thu, Nov 28, 2019 at 08:09:31PM +0800, pannengy...@huawei.com wrote: >> From: PanNengyuan >> >> In currently implementation there will be a memory leak when >> nbd_client_connect() returns error status. Here is an easy way to >> reproduce: >> >>

Re: [PATCH for-5.0 02/31] block: Add BdrvChildRole

2019-11-28 Thread Max Reitz
On 28.11.19 15:12, Kevin Wolf wrote: > Am 27.11.2019 um 14:15 hat Max Reitz geschrieben: >> This enum will supplement BdrvChildClass when it comes to what role (or >> combination of roles) a child takes for its parent. >> >> Because empty enums are not allowed, let us just start with it filled. >>

Re: [PATCH v10 1/3] block: introduce compress filter driver

2019-11-28 Thread Vladimir Sementsov-Ogievskiy
28.11.2019 12:36, Andrey Shinkevich wrote: > Allow writing all the data compressed through the filter driver. > The written data will be aligned by the cluster size. > Based on the QEMU current implementation, that data can be written to > unallocated clusters only. May be used for a backup job. >

Re: [PATCH for-5.0 02/31] block: Add BdrvChildRole

2019-11-28 Thread Max Reitz
On 28.11.19 12:24, Vladimir Sementsov-Ogievskiy wrote: > 28.11.2019 13:52, Max Reitz wrote: >> On 28.11.19 10:31, Vladimir Sementsov-Ogievskiy wrote: >>> 27.11.2019 16:15, Max Reitz wrote: This enum will supplement BdrvChildClass when it comes to what role (or combination of roles) a

Re: [PATCH for-5.0 02/31] block: Add BdrvChildRole

2019-11-28 Thread Kevin Wolf
Am 27.11.2019 um 14:15 hat Max Reitz geschrieben: > This enum will supplement BdrvChildClass when it comes to what role (or > combination of roles) a child takes for its parent. > > Because empty enums are not allowed, let us just start with it filled. > > Signed-off-by: Max Reitz > --- >

Re: [PATCH V2] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread Stefano Garzarella
On Thu, Nov 28, 2019 at 08:09:31PM +0800, pannengy...@huawei.com wrote: > From: PanNengyuan > > In currently implementation there will be a memory leak when > nbd_client_connect() returns error status. Here is an easy way to > reproduce: > > 1. run qemu-iotests as follow and check the result

Re: [RFC v5 000/126] error: auto propagated local_err

2019-11-28 Thread Markus Armbruster
Vladimir Sementsov-Ogievskiy writes: > 28.11.2019 11:54, Markus Armbruster wrote: >> Please accept my sincere apologies for taking so long to reply. A few >> thoughts before I dig deeper. >> >> Vladimir Sementsov-Ogievskiy writes: >> >>> Hi all! >>> >>> At the request of Markus: full version

[PATCH V2] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread pannengyuan
From: PanNengyuan In currently implementation there will be a memory leak when nbd_client_connect() returns error status. Here is an easy way to reproduce: 1. run qemu-iotests as follow and check the result with asan: ./check -raw 143 Following is the asan output backtrack: Direct leak of

Re: [PATCH for-5.0 02/31] block: Add BdrvChildRole

2019-11-28 Thread Vladimir Sementsov-Ogievskiy
28.11.2019 13:52, Max Reitz wrote: > On 28.11.19 10:31, Vladimir Sementsov-Ogievskiy wrote: >> 27.11.2019 16:15, Max Reitz wrote: >>> This enum will supplement BdrvChildClass when it comes to what role (or >>> combination of roles) a child takes for its parent. >>> >>> Because empty enums are not

[PATCH v5 4/4] blockdev: honor bdrv_try_set_aio_context() context requirements

2019-11-28 Thread Sergio Lopez
bdrv_try_set_aio_context() requires that the old context is held, and the new context is not held. Fix all the occurrences where it's not done this way. Suggested-by: Max Reitz Signed-off-by: Sergio Lopez --- blockdev.c | 72 ++ 1 file

Re: [PATCH] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread pannengyuan
Thanks for you suggestion, I'd be glad to do it, I will send a new version later. Cheers. On 2019/11/28 18:41, Stefano Garzarella wrote: > On Thu, Nov 28, 2019 at 06:32:49PM +0800, pannengyuan wrote: >> Hi, >> I think it's a better way, you can implement this new function before >> this patch. >

Re: [PATCH for-5.0 02/31] block: Add BdrvChildRole

2019-11-28 Thread Max Reitz
On 28.11.19 10:31, Vladimir Sementsov-Ogievskiy wrote: > 27.11.2019 16:15, Max Reitz wrote: >> This enum will supplement BdrvChildClass when it comes to what role (or >> combination of roles) a child takes for its parent. >> >> Because empty enums are not allowed, let us just start with it filled.

[PATCH v5 2/4] blockdev: unify qmp_drive_backup and drive-backup transaction paths

2019-11-28 Thread Sergio Lopez
Issuing a drive-backup from qmp_drive_backup takes a slightly different path than when it's issued from a transaction. In the code, this is manifested as some redundancy between do_drive_backup() and drive_backup_prepare(). This change unifies both paths, merging do_drive_backup() and

[PATCH v5 1/4] blockdev: fix coding style issues in drive_backup_prepare

2019-11-28 Thread Sergio Lopez
Fix a couple of minor coding style issues in drive_backup_prepare. Signed-off-by: Sergio Lopez Reviewed-by: Max Reitz --- blockdev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 8e029e9c01..553e315972 100644 --- a/blockdev.c +++

[PATCH v5 3/4] blockdev: unify qmp_blockdev_backup and blockdev-backup transaction paths

2019-11-28 Thread Sergio Lopez
Issuing a blockdev-backup from qmp_blockdev_backup takes a slightly different path than when it's issued from a transaction. In the code, this is manifested as some redundancy between do_blockdev_backup() and blockdev_backup_prepare(). This change unifies both paths, merging do_blockdev_backup()

Re: [PATCH] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread Stefano Garzarella
On Thu, Nov 28, 2019 at 06:32:49PM +0800, pannengyuan wrote: > Hi, > I think it's a better way, you can implement this new function before > this patch. If you want to do it, so you can send everything together, for me there's no problem, it was just a suggestion. If you don't have time, I can

[PATCH v5 0/4] blockdev: avoid acquiring AioContext lock twice at do_drive_backup and do_blockdev_backup

2019-11-28 Thread Sergio Lopez
do_drive_backup() acquires the AioContext lock of the corresponding BlockDriverState. This is not a problem when it's called from qmp_drive_backup(), but drive_backup_prepare() also acquires the lock before calling it. The same things happens with do_blockdev_backup() and

Re: [PATCH] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread pannengyuan
Hi, I think it's a better way, you can implement this new function before this patch. Thanks. On 2019/11/28 17:01, Stefano Garzarella wrote: > On Thu, Nov 28, 2019 at 04:40:10PM +0800, pannengy...@huawei.com wrote: > > Hi, > I don't know nbd code very well, the patch LGTM, but just a comment >

Re: [PATCH for-5.0 02/31] block: Add BdrvChildRole

2019-11-28 Thread Vladimir Sementsov-Ogievskiy
27.11.2019 16:15, Max Reitz wrote: > This enum will supplement BdrvChildClass when it comes to what role (or > combination of roles) a child takes for its parent. > > Because empty enums are not allowed, let us just start with it filled. > > Signed-off-by: Max Reitz > --- >

[PATCH v10 2/3] qcow2: Allow writing compressed data of multiple clusters

2019-11-28 Thread Andrey Shinkevich
QEMU currently supports writing compressed data of the size equal to one cluster. This patch allows writing QCOW2 compressed data that exceed one cluster. Now, we split buffered data into separate clusters and write them compressed using the block/aio_task API. Suggested-by: Pavel Butsykin

[PATCH v10 1/3] block: introduce compress filter driver

2019-11-28 Thread Andrey Shinkevich
Allow writing all the data compressed through the filter driver. The written data will be aligned by the cluster size. Based on the QEMU current implementation, that data can be written to unallocated clusters only. May be used for a backup job. Suggested-by: Max Reitz Signed-off-by: Andrey

[PATCH v10 3/3] tests/qemu-iotests: add case to write compressed data of multiple clusters

2019-11-28 Thread Andrey Shinkevich
Add the case to the iotest #214 that checks possibility of writing compressed data of more than one cluster size. The test case involves the compress filter driver showing a sample usage of that. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz

[PATCH v10 0/3] qcow2: advanced compression options

2019-11-28 Thread Andrey Shinkevich
The compression filter driver is introduced as suggested by Max. A sample usage of the filter can be found in the test #214. Now, multiple clusters can be written compressed. It is useful for the backup job. v10: 01: The option 'compress' moved up in the QAPI BlockdevDriver list to fit

Re: [RFC v5 000/126] error: auto propagated local_err

2019-11-28 Thread Vladimir Sementsov-Ogievskiy
28.11.2019 11:54, Markus Armbruster wrote: > Please accept my sincere apologies for taking so long to reply. A few > thoughts before I dig deeper. > > Vladimir Sementsov-Ogievskiy writes: > >> Hi all! >> >> At the request of Markus: full version of errp propagation. Let's look >> at it. Cover

Re: [PATCH] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread Stefano Garzarella
On Thu, Nov 28, 2019 at 04:40:10PM +0800, pannengy...@huawei.com wrote: Hi, I don't know nbd code very well, the patch LGTM, but just a comment below: > From: PanNengyuan > > In currently implementation there will be a memory leak when > nbd_client_connect() returns error status. Here is an

Re: [RFC v5 000/126] error: auto propagated local_err

2019-11-28 Thread Markus Armbruster
Please accept my sincere apologies for taking so long to reply. A few thoughts before I dig deeper. Vladimir Sementsov-Ogievskiy writes: > Hi all! > > At the request of Markus: full version of errp propagation. Let's look > at it. Cover as much as possible, except inserting macro invocation >

[PATCH] block/nbd: fix memory leak in nbd_open()

2019-11-28 Thread pannengyuan
From: PanNengyuan In currently implementation there will be a memory leak when nbd_client_connect() returns error status. Here is an easy way to reproduce: 1. run qemu-iotests as follow and check the result with asan: ./check -raw 143 Following is the asan output backtrack: Direct leak of

Re: [PATCH v6] block/snapshot: rename Error ** parameter to more common errp

2019-11-28 Thread Max Reitz
On 27.11.19 20:25, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir Sementsov-Ogievskiy > Reviewed-by: Eric Blake > --- > > v6: merge corresponding header change here, so, v6 is merge of > [RFC v5 011/126] block/snapshot: rename Error ** parameter to more common > errp > and >