[Qemu-block] [PATCH 3/5] vvfat: Replace bdrv_{read, write}() with bdrv_{pread, pwrite}()

2019-04-29 Thread Alberto Garcia
There's only a couple of bdrv_read() and bdrv_write() calls left in the vvfat code, and they can be trivially replaced with the byte-based bdrv_pread() and bdrv_pwrite(). Signed-off-by: Alberto Garcia --- block/vvfat.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff

[Qemu-block] [PATCH v3 2/2] iotests: Check that images are in read-only mode after block-commit

2019-04-29 Thread Alberto Garcia
This tests the fix from the previous patch. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/249 | 115 + tests/qemu-iotests/249.out | 35 ++ tests/qemu-iotests/group | 1 + 3 files changed, 151 insertions(+) create mode

[Qemu-block] [PATCH v3 0/2] commit: Make base read-only if there is an early failure

2019-04-29 Thread Alberto Garcia
stream patch [down] : patch is downstream-only The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively Alberto Garcia (2): commit: Make base read-only if there is an early failure iotests: Check that images are in read-only mode after block-commit block/commit.c

[Qemu-block] [PATCH v3 1/2] commit: Make base read-only if there is an early failure

2019-04-29 Thread Alberto Garcia
You can reproduce this by passing an invalid filter-node-name (like "1234") to block-commit. In this case the base image is put in read-write mode but is never reset back to read-only. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/commit.c | 3 +++ 1 file changed, 3

Re: [Qemu-block] [PATCH for-4.1 v2 0/2] commit: Make base read-only if there is an early failure

2019-04-26 Thread Alberto Garcia
ping On Thu 11 Apr 2019 02:32:26 PM CEST, Alberto Garcia wrote: > Hi, > > this is the same patch I posted yesterday, but with a test case. > > Berto > > Alberto Garcia (2): > commit: Make base read-only if there is an early failure > iotests: Check that images

Re: [Qemu-block] [PATCH for-4.1] block: Use bdrv_unref_child() for all children in bdrv_close()

2019-04-26 Thread Alberto Garcia
ping On Sun 31 Mar 2019 01:17:47 PM CEST, Alberto Garcia wrote: > bdrv_unref_child() does the following things: > > - Updates the child->bs->inherits_from pointer. > - Calls bdrv_detach_child() to remove the BdrvChild from bs->children. > - Calls bdrv_un

Re: [Qemu-block] [PATCH for-4.1] commit: Use bdrv_append() in commit_start()

2019-04-26 Thread Alberto Garcia
ping On Wed 03 Apr 2019 04:37:48 PM CEST, Alberto Garcia wrote: > This function combines bdrv_set_backing_hd() and bdrv_replace_node() > so we can use it to simplify the code a bit in commit_start(). > > Signed-off-by: Alberto Garcia > --- > block/commit.c | 11 +-- &g

Re: [Qemu-block] [PATCH for-4.1] block: Assert that drv->bdrv_child_perm is set in bdrv_child_perm()

2019-04-26 Thread Alberto Garcia
ping On Thu 04 Apr 2019 01:29:53 PM CEST, Alberto Garcia wrote: > There is no need to check for this because all block drivers that have > children implement bdrv_child_perm and all callers already ensure that > bs->drv is set. > > Furthermore, if this check would fail then the

Re: [Qemu-block] [PATCH v5 1/3] block: include base when checking image chain for block allocation

2019-04-25 Thread Alberto Garcia
On Mon 22 Apr 2019 12:18:58 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > * Given an image chain: ... -> [BASE] -> [INTER1] -> [INTER2] -> [TOP] > * > * Return true if (a prefix of) the given range is allocated in any image > - * between BASE and TOP (inclusive). BASE can be NULL to check i

Re: [Qemu-block] [PATCH] iotests: Make 182 do without device_add

2019-04-25 Thread Alberto Garcia
fda0082b00ae963 > Reported-by: Danilo C. L. de Paula > Signed-off-by: Max Reitz Acked-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH for-4.1 0/2] Fix check for default backing files in bdrv_reopen_prepare()

2019-04-13 Thread Alberto Garcia
On Sat 13 Apr 2019 05:48:11 PM CEST, Max Reitz wrote: >> Ok, you can leave out the second patch then. The first one should >> still be correct, right? > > I just think it’s unnecessary because as of my series both > backing_file and auto_backing_file serve the purpose. Ok then! Berto

Re: [Qemu-block] [PATCH for-4.1 0/2] Fix check for default backing files in bdrv_reopen_prepare()

2019-04-13 Thread Alberto Garcia
On Sat 13 Apr 2019 02:56:57 AM CEST, Max Reitz wrote: >> Patch 2 fixes a different (but slightly related) issue that I found >> while preparing the first patch. > > I think the real problem is that bs->backing_file is not a cache for > bs->backing->bs->filename. > > In fact, every user of bs->backi

[Qemu-block] [PATCH for-4.1 1/2] block: Fix check for default backing files in bdrv_reopen_prepare()

2019-04-11 Thread Alberto Garcia
_file. This bug should be detected by iotest 245, but unfortunately the test expectation is wrong so it must be corrected as well. Signed-off-by: Alberto Garcia Reported-by: Max Reitz --- block.c| 3 ++- tests/qemu-iotests/245 | 2 +- 2 files changed, 3 insertions(+), 2 deletion

[Qemu-block] [PATCH for-4.1 0/2] Fix check for default backing files in bdrv_reopen_prepare()

2019-04-11 Thread Alberto Garcia
Hi, Patch 1 is the fix for the bug reported by Max here: https://lists.gnu.org/archive/html/qemu-block/2019-04/msg00293.html Patch 2 fixes a different (but slightly related) issue that I found while preparing the first patch. Regards, Berto Alberto Garcia (2): block: Fix check for

[Qemu-block] [PATCH for-4.1 2/2] block: Clear the backing_file fields on detach

2019-04-11 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block.c b/block.c index e496999e2f..e9c0c9e2ad 100644 --- a/block.c +++ b/block.c @@ -1085,6 +1085,9 @@ static void bdrv_backing_detach(BdrvChild *c) error_free(parent->backing_bloc

Re: [Qemu-block] [PATCH v2 13/13] qemu-iotests: Test the x-blockdev-reopen QMP command

2019-04-11 Thread Alberto Garcia
On Wed 10 Apr 2019 07:03:50 PM CEST, Max Reitz wrote: >> +# hd0 has no backing file: we can omit the 'backing' option >> +self.reopen(opts) > > [...] > >> +# Detach hd2 from hd0. >> +self.reopen(opts, {'backing': None}) >> +self.reopen(opts, {}, "backing is m

Re: [Qemu-block] [PATCH] iotests: Let 245 pass on tmpfs

2019-04-11 Thread Alberto Garcia
wonder if this is something worth having in iotests.py. The patch looks fine anyway. Reviewed-by: Alberto Garcia Berto

[Qemu-block] [PATCH for-4.1 v2 2/2] iotests: Check that images are in read-only mode after block-commit

2019-04-11 Thread Alberto Garcia
This tests the fix from the previous patch. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/249 | 115 + tests/qemu-iotests/249.out | 35 ++ tests/qemu-iotests/group | 1 + 3 files changed, 151 insertions(+) create mode

[Qemu-block] [PATCH for-4.1 v2 0/2] commit: Make base read-only if there is an early failure

2019-04-11 Thread Alberto Garcia
Hi, this is the same patch I posted yesterday, but with a test case. Berto Alberto Garcia (2): commit: Make base read-only if there is an early failure iotests: Check that images are in read-only mode after block-commit block/commit.c | 3 ++ tests/qemu-iotests/249 | 115

[Qemu-block] [PATCH for-4.1 v2 1/2] commit: Make base read-only if there is an early failure

2019-04-11 Thread Alberto Garcia
You can reproduce this by passing an invalid filter-node-name (like "1234") to block-commit. In this case the base image is put in read-write mode but is never reset back to read-only. Signed-off-by: Alberto Garcia --- block/commit.c | 3 +++ 1 file changed, 3 insertions(+) diff --g

Re: [Qemu-block] [Qemu-devel] [PATCH for-4.1] commit: Make base read-only if there is an early failure

2019-04-11 Thread Alberto Garcia
On Wed 10 Apr 2019 05:32:47 PM CEST, Eric Blake wrote: > On 4/10/19 10:24 AM, Alberto Garcia wrote: >> You can reproduce this by passing an invalid filter-node-name (like >> "1234") to block-commit. In this case the base image is put in >> read-write mode but i

[Qemu-block] [PATCH for-4.1] commit: Make base read-only if there is an early failure

2019-04-10 Thread Alberto Garcia
You can reproduce this by passing an invalid filter-node-name (like "1234") to block-commit. In this case the base image is put in read-write mode but is never reset back to read-only. Signed-off-by: Alberto Garcia --- block/commit.c | 3 +++ 1 file changed, 3 insertions(+) diff --g

Re: [Qemu-block] [PATCH v4 1/3] block: include base when checking image chain for block allocation

2019-04-09 Thread Alberto Garcia
king_bs(base) : base; >> >> while (intermediate != stop_at) { >>... >> } >> > > But in this way you return back dependence on base, which we don't > freeze and which may disappear on some iteration. We should not touch > backing_bs(base) in any way. Ok, I see. Reviewed-by: Alberto Garcia (feel free to edit the comment with my suggestion, or leave it as it is if you prefer) Berto

Re: [Qemu-block] [PATCH v4 1/3] block: include base when checking image chain for block allocation

2019-04-09 Thread Alberto Garcia
On Mon 08 Apr 2019 08:22:19 PM CEST, Andrey Shinkevich wrote: > * Return true if (a prefix of) the given range is allocated in any image > - * between BASE and TOP (inclusive). BASE can be NULL to check if the given > + * between BASE and TOP (TOP included). To check the BASE image, set the > +

Re: [Qemu-block] [PATCH v4 3/3] block/stream: introduce a bottom node

2019-04-09 Thread Alberto Garcia
ts backing child, > that's the base, anymore. > > Suggested-by: Vladimir Sementsov-Ogievskiy > Signed-off-by: Andrey Shinkevich Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH v3 3/3] block/stream: introduce a bottom node

2019-04-09 Thread Alberto Garcia
On Mon 08 Apr 2019 08:17:37 PM CEST, Andrey Shinkevich wrote: >>> +for (iter = bs; iter != bottom; iter = backing_bs(iter)) { >>> +block_job_add_bdrv(&s->common, "intermediate node", >>> backing_bs(iter), >>> + 0, basic_flags, &error_abort); >>> } >> >>

Re: [Qemu-block] [PATCH v3 3/3] block/stream: introduce a bottom node

2019-04-08 Thread Alberto Garcia
On Fri 05 Apr 2019 06:56:19 PM CEST, Andrey Shinkevich wrote: > @@ -232,8 +232,13 @@ void stream_start(const char *job_id, BlockDriverState > *bs, > StreamBlockJob *s; > BlockDriverState *iter; > bool bs_read_only; > +BlockDriverState *bottom = NULL; > +int basic_flags = BLK

Re: [Qemu-block] [PATCH v3 1/3] block: include base when checking image chain for block allocation

2019-04-08 Thread Alberto Garcia
On Mon 08 Apr 2019 05:16:22 PM CEST, Andrey Shinkevich wrote: > On 08/04/2019 18:03, Alberto Garcia wrote: >> On Fri 05 Apr 2019 06:56:17 PM CEST, Andrey Shinkevich wrote: >>> +int bdrv_is_allocated_above(BlockDriverState *top, >>> +

Re: [Qemu-block] [PATCH v3 1/3] block: include base when checking image chain for block allocation

2019-04-08 Thread Alberto Garcia
On Fri 05 Apr 2019 06:56:17 PM CEST, Andrey Shinkevich wrote: > +int bdrv_is_allocated_above(BlockDriverState *top, > +BlockDriverState *base, > +int64_t offset, int64_t bytes, int64_t *pnum) > +{ > +return bdrv_do_is_allocated_above(top,

Re: [Qemu-block] [PATCH for-4.0] block: Forward 'discard' to temporary overlay

2019-04-05 Thread Alberto Garcia
gt; overlay enables discard when it was requested for the drive. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto

[Qemu-block] [PATCH for-4.1] block: Assert that drv->bdrv_child_perm is set in bdrv_child_perm()

2019-04-04 Thread Alberto Garcia
ces the check with an assertion. Signed-off-by: Alberto Garcia --- block.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index 3050854528..5f92565692 100644 --- a/block.c +++ b/block.c @@ -1742,11 +1742,10 @@ static void bdrv_child_perm(BlockDriverSt

[Qemu-block] [PATCH for-4.1] commit: Use bdrv_append() in commit_start()

2019-04-03 Thread Alberto Garcia
This function combines bdrv_set_backing_hd() and bdrv_replace_node() so we can use it to simplify the code a bit in commit_start(). Signed-off-by: Alberto Garcia --- block/commit.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/block/commit.c b/block/commit.c

Re: [Qemu-block] [PATCH 3/3] block/stream: introduce a bottom node

2019-04-02 Thread Alberto Garcia
On Tue 02 Apr 2019 10:51:06 AM CEST, Andrey Shinkevich wrote: > @@ -3237,7 +3238,14 @@ void qmp_block_stream(bool has_job_id, const char > *job_id, const char *device, >job_flags |= JOB_MANUAL_DISMISS; >} > > -stream_start(has_job_id ? job_id : N

Re: [Qemu-block] [PATCH v2 2/3] block/stream: refactor stream_run: drop goto

2019-04-02 Thread Alberto Garcia
ode was removed in commit eb23654dbe43b549ea2a9ebff9d8e Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH 3/3] block/stream: introduce a bottom node

2019-04-01 Thread Alberto Garcia
On Fri 29 Mar 2019 05:15:43 PM CET, Vladimir Sementsov-Ogievskiy wrote: >>> @@ -3237,7 +3238,14 @@ void qmp_block_stream(bool has_job_id, const char >>> *job_id, const char *device, >>> job_flags |= JOB_MANUAL_DISMISS; >>> } >>> >>> -stream_start(has_job_id ? job_id : NULL,

[Qemu-block] [PATCH for-4.1] block: Use bdrv_unref_child() for all children in bdrv_close()

2019-03-31 Thread Alberto Garcia
son not to use bdrv_unref_child() in bdrv_close() anymore. After this there's also no need to remove bs->backing and bs->file separately from the rest of the children, so bdrv_close() can be simplified. Signed-off-by: Alberto Garcia --- block.c | 16 +++- 1 file changed, 3 in

Re: [Qemu-block] [PATCH] qemu-img: Saner printing of large file sizes

2019-03-31 Thread Alberto Garcia
nding up to the next sector boundary, but that wouldn't change > the human-readable result). > > Reported-by: Richard W.M. Jones > Signed-off-by: Eric Blake Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH 3/3] block/stream: introduce a bottom node

2019-03-29 Thread Alberto Garcia
On Fri 29 Mar 2019 02:29:14 PM CET, Andrey Shinkevich wrote: > @@ -3237,7 +3238,14 @@ void qmp_block_stream(bool has_job_id, const char > *job_id, const char *device, > job_flags |= JOB_MANUAL_DISMISS; > } > > -stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name, >

Re: [Qemu-block] [PATCH for-4.0 v2 0/3] freeze the backing chain earlier in stream_start()

2019-03-29 Thread Alberto Garcia
On Fri 29 Mar 2019 02:16:16 PM CET, Kevin Wolf wrote: >> this series fixes the bug that I found the other day and described here: >> >>https://lists.gnu.org/archive/html/qemu-block/2019-03/msg00764.html >>https://lists.gnu.org/archive/html/qemu-block/2019-03/msg00791.html >> >> Patch 2 is

[Qemu-block] [PATCH for-4.0 v2 3/3] block: test block-stream with a base node that is used by block-commit

2019-03-28 Thread Alberto Garcia
iotest for this scenario. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/030 | 17 + tests/qemu-iotests/030.out | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 276e06b5ba..c6311d1825 100755

[Qemu-block] [PATCH for-4.0 v2 2/3] block: freeze the backing chain earlier in stream_start()

2019-03-28 Thread Alberto Garcia
hat function another job can jump in and remove the base image. If that happens we have an invalid chain and QEMU crashes. This patch puts the bdrv_freeze_backing_chain() call at the beginning of the function. Signed-off-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy ---

[Qemu-block] [PATCH for-4.0 v2 1/3] block: continue until base is found in bdrv_freeze_backing_chain() et al

2019-03-28 Thread Alberto Garcia
n without errors as if it was NULL. This is wrong: if the caller passed an incorrect parameter that means that there is a bug in the code. Signed-off-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy --- block.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-

[Qemu-block] [PATCH for-4.0 v2 0/3] freeze the backing chain earlier in stream_start()

2019-03-28 Thread Alberto Garcia
nd in bdrv_freeze_backing_chain() et al' 002/3:[] [-C] 'block: freeze the backing chain earlier in stream_start()' 003/3:[0017] [FC] 'block: test block-stream with a base node that is used by block-commit' Alberto Garcia (3): block: continue until base is found in bdrv_freeze_bac

Re: [Qemu-block] [PATCH for-4.0 3/3] block: test block-stream with a base node that is used by block-commit

2019-03-28 Thread Alberto Garcia
On Thu 28 Mar 2019 11:17:48 AM CET, Vladimir Sementsov-Ogievskiy wrote: >> +# Wait for all jobs to be finished. > > what about use just > self.cancel_and_wait() or self.wait_until_completed() here? You're right, wait_until_completed() should be enough, commit on an intermediate node does

Re: [Qemu-block] [PATCH for-4.0 1/3] block: continue until base is found in bdrv_freeze_backing_chain() et al

2019-03-28 Thread Alberto Garcia
of the chain if 'base' is NULL. >>> >>> However if 'base' is not found then the functions return without >>> errors as if it was NULL. >>> >>> This is wrong: if the caller passed an incorrect parameter that means >>> that t

Re: [Qemu-block] [PATCH for-4.0 1/3] block: continue until base is found in bdrv_freeze_backing_chain() et al

2019-03-28 Thread Alberto Garcia
On Thu 28 Mar 2019 10:45:51 AM CET, Vladimir Sementsov-Ogievskiy wrote: >> -for (i = bs; i != base && i->backing; i = backing_bs(i)) { >> -if (i->backing->frozen) { >> +for (i = bs; i != base; i = backing_bs(i)) { >> +if (i->backing && i->backing->frozen) { > > may be a bit

[Qemu-block] [PATCH for-4.0 1/3] block: continue until base is found in bdrv_freeze_backing_chain() et al

2019-03-26 Thread Alberto Garcia
n without errors as if it was NULL. This is wrong: if the caller passed an incorrect parameter that means that there is a bug in the code. Signed-off-by: Alberto Garcia --- block.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/block.c b/block.c index

[Qemu-block] [PATCH for-4.0 3/3] block: test block-stream with a base node that is used by block-commit

2019-03-26 Thread Alberto Garcia
iotest for this scenario. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/030 | 32 tests/qemu-iotests/030.out | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 276e06b5ba

[Qemu-block] [PATCH for-4.0 0/3] freeze the backing chain earlier in stream_start()

2019-03-26 Thread Alberto Garcia
us to detect this kind of errors earlier. Regards, Berto Alberto Garcia (3): block: continue until base is found in bdrv_freeze_backing_chain() et al block: freeze the backing chain earlier in stream_start() block: test block-stream with a base node that is used by block-commit

[Qemu-block] [PATCH for-4.0 2/3] block: freeze the backing chain earlier in stream_start()

2019-03-26 Thread Alberto Garcia
hat function another job can jump in and remove the base image. If that happens we have an invalid chain and QEMU crashes. This patch puts the bdrv_freeze_backing_chain() call at the beginning of the function. Signed-off-by: Alberto Garcia --- block/stream.c | 13 +++-- 1 file changed

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-24 Thread Alberto Garcia
On Fri 22 Mar 2019 04:54:59 PM CET, Alberto Garcia wrote: >E <- D <- C <- B <- A > > 2) commit from C to E, then stream from C to A > >This fails because the commit job inserts a filter between C and B >and the bdrv_freeze_backing_chain(bs, base) cal

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-22 Thread Alberto Garcia
On Thu 21 Mar 2019 03:51:12 PM CET, Alberto Garcia wrote: > I was checking the tests that run commit and stream in parallel in > 030, but they do commit on the upper images and stream on the lower > ones, so that's safe. I'll try to run them the other way around > because w

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-21 Thread Alberto Garcia
On Thu 21 Mar 2019 03:53:41 PM CET, Kevin Wolf wrote: >> >>> I think, the correct way, which will support these correct cases >> >>> (which however don't look like real use cases) is removing base >> >>> from stream view. Stream should operate instead using >> >>> bottom-node. >> >> >> >> What is

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-21 Thread Alberto Garcia
On Thu 21 Mar 2019 12:53:57 PM CET, Vladimir Sementsov-Ogievskiy wrote: >>> Yes, we probably need to rethink this scenario a bit. >> >> But yes, even with a counter, the other problem would still remain >> (that the first job can't remove the filter on completion because the >> second one has froz

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-21 Thread Alberto Garcia
On Thu 21 Mar 2019 09:30:26 AM CET, Vladimir Sementsov-Ogievskiy wrote: > 20.03.2019 20:25, Alberto Garcia wrote: >> On Wed 20 Mar 2019 10:35:27 AM CET, Vladimir Sementsov-Ogievskiy wrote: >>>> Maybe at least this kind of freezing isn't the right tool for block >&

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-20 Thread Alberto Garcia
On Wed 20 Mar 2019 10:35:27 AM CET, Vladimir Sementsov-Ogievskiy wrote: >> Maybe at least this kind of freezing isn't the right tool for block >> jobs, after all. > > I think, the correct way, which will support these correct cases > (which however don't look like real use cases) is removing base f

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-20 Thread Alberto Garcia
On Wed 20 Mar 2019 10:16:10 AM CET, Kevin Wolf wrote: >> Oh, I see. Let's use a shorter chain for simplicity: >> >>A <- B <- C <- D <- E > > Written from right to left, i.e. E being the base and A the top layer? > We usually write things the other write round, I hope this doesn't get > too con

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-19 Thread Alberto Garcia
On Mon 18 Mar 2019 04:25:10 PM CET, Vladimir Sementsov-Ogievskiy wrote: >> So what we have now is: >> >> A <- B <- C <- D <- E <- F <- G <- H <- I >> >> and we can launch four parallel block-stream jobs: >> >> From C (base) to A >> From E (base) to C >> From G (base) to E >>

[Qemu-block] Question about bdrv_child_perm()

2019-03-19 Thread Alberto Garcia
bdrv_child_perm(BlockDriverState *bs, BlockDriverState *child_bs, ...) was introduced in commit ffd1a5a25c7199d3c9c6d84a5a84ae51f8824602 and is only called when bs has children (hence the child_bs parameter). It contains the following code: if (bs->drv && bs->drv->bdrv_child_perm) { b

[Qemu-block] [PATCH] block: Make bdrv_{copy_on_read, crypto_luks, replication} static

2019-03-18 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/copy-on-read.c | 2 +- block/crypto.c | 2 +- block/replication.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 64dcc424b5..d670fec42b 100644 --- a/block/copy-on-read.c +++ b

Re: [Qemu-block] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-18 Thread Alberto Garcia
On Thu 21 Feb 2019 04:26:38 PM CET, Andrey Shinkevich wrote: > The test case TestParallelOps::test_stream_parallel in #030 fails > if a base node is protected by the block-stream running job that > includes the base node into the job node list (block_job_add_bdrv) > without BLK_PERM_GRAPH_MOD share

Re: [Qemu-block] [PATCH 2/2] block-stream: include base into job node list

2019-03-18 Thread Alberto Garcia
On Tue 26 Feb 2019 05:39:41 PM CET, Andrey Shinkevich wrote: > On 26/02/2019 16:33, Alberto Garcia wrote: >> On Mon 25 Feb 2019 05:39:14 PM CET, Vladimir Sementsov-Ogievskiy wrote: >>>> --- a/block/stream.c >>>> +++ b/block/stream.c >>>> @@ -259,6 +2

Re: [Qemu-block] [PATCH v3 02/12] blockdev: Check @replaces in blockdev_mirror_common

2019-03-18 Thread Alberto Garcia
t; > Signed-off-by: Max Reitz > Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH] block: Silence Coverity in bdrv_drop_intermediate()

2019-03-15 Thread Alberto Garcia
using the return value to be more consistent (and in > case of a bug somewhere down the call chain, forgetting to assign errp > is more likely than returning 0 for an error case). > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [Qemu-devel] [PATCH v2 01/13] block: Allow freezing BdrvChild links

2019-03-13 Thread Alberto Garcia
On Wed 13 Mar 2019 03:29:36 PM CET, Kevin Wolf wrote: > Am 13.03.2019 um 15:14 hat Alberto Garcia geschrieben: >> On Tue 12 Mar 2019 05:12:53 PM CET, Vladimir Sementsov-Ogievskiy wrote: >> >> +/* This function changes all links that point to top and makes >> &g

Re: [Qemu-block] [Qemu-devel] [PATCH v2 01/13] block: Allow freezing BdrvChild links

2019-03-13 Thread Alberto Garcia
On Wed 13 Mar 2019 03:32:09 PM CET, Alberto Garcia wrote: >>> > 2. And therefore, why we just don't call bdrv_replace_node(top, >>> > base, errp) from bdrv_drop_intermediate? >>> >>> I think that would not call role->update_filename(). >> &

Re: [Qemu-block] [Qemu-devel] [PATCH v2 01/13] block: Allow freezing BdrvChild links

2019-03-13 Thread Alberto Garcia
On Tue 12 Mar 2019 05:12:53 PM CET, Vladimir Sementsov-Ogievskiy wrote: >> +/* This function changes all links that point to top and makes >> + * them point to base. Check that none of them is frozen. */ >> +QLIST_FOREACH(c, &top->parents, next_parent) { >> +if (c->frozen) { >>

Re: [Qemu-block] [PATCH v3 00/13] Add a 'x-blockdev-reopen' QMP command

2019-03-12 Thread Alberto Garcia
On Tue 12 Mar 2019 05:48:39 PM CET, Alberto Garcia wrote: I forgot to add: > v3: > - Rebase on top of Kevin's block branch (e5a4df8ec3e30b37187954b4368). > - Patch 8: move the permission checks to bdrv_reopen_multiple() after > "block: Make permission changes in reopen

[Qemu-block] [PATCH v3 13/13] qemu-iotests: Test the x-blockdev-reopen QMP command

2019-03-12 Thread Alberto Garcia
This patch adds several tests for the x-blockdev-reopen QMP command. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/245 | 991 + tests/qemu-iotests/245.out | 5 + tests/qemu-iotests/group | 1 + 3 files changed, 997 insertions

[Qemu-block] [PATCH v3 10/13] block: Add bdrv_reset_options_allowed()

2019-03-12 Thread Alberto Garcia
bdrv_reopen_prepare() already takes care of that. Signed-off-by: Alberto Garcia --- block.c | 58 ++ 1 file changed, 58 insertions(+) diff --git a/block.c b/block.c index c6786cd35b..a5e69ad81e 100644 --- a/block.c +++ b/block.c

[Qemu-block] [PATCH v3 06/13] block: Handle child references in bdrv_reopen_queue()

2019-03-12 Thread Alberto Garcia
We don't want to open a new image during reopen, so we require that "backing" is always present. We'll relax this requirement a bit in the next patch. If keep_old_opts is true and "backing" is missing then this behaves like 2a (the c

[Qemu-block] [PATCH v3 08/13] block: Allow changing the backing file on reopen

2019-03-12 Thread Alberto Garcia
a new set of options ({"driver": "qcow2", "file": { ... }}) then it is interpreted that the _existing_ backing file must be reopened with those options. Signed-off-by: Alberto Garcia --- block.c | 166 ++ i

[Qemu-block] [PATCH v3 04/13] block: Freeze the backing chain for the duration of the stream job

2019-03-12 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/stream.c | 21 + 1 file changed, 21 insertions(+) diff --git a/block/stream.c b/block/stream.c index e14579ff80..6253c86fae 100644 --- a/block/stream.c +++ b/block/stream.c @@ -35,6 +35,7 @@ typedef struct StreamBlockJob

[Qemu-block] [PATCH v3 12/13] block: Add an 'x-blockdev-reopen' QMP command

2019-03-12 Thread Alberto Garcia
be possible to add a similar functionality to other block drivers (e.g. Quorum, blkverify). Although the API is unlikely to change, this command is marked experimental for the time being so there's room to see if the semantics need changes. Signed-off-by: Alberto Garcia --- blockdev.c

[Qemu-block] [PATCH v3 09/13] block: Add a 'mutable_opts' field to BlockDriver

2019-03-12 Thread Alberto Garcia
is a list of runtime options that can be modified during reopen. If an option in this list is unspecified on reopen then it must be reset (or return an error). Signed-off-by: Alberto Garcia --- block/file-posix.c| 6 ++ block/qcow2.c | 25 + block

[Qemu-block] [PATCH v3 11/13] block: Remove the AioContext parameter from bdrv_reopen_multiple()

2019-03-12 Thread Alberto Garcia
This parameter has been unused since 1a63a907507fbbcfaee3f622907ec244b Signed-off-by: Alberto Garcia --- block.c | 4 ++-- block/replication.c | 3 +-- include/block/block.h | 2 +- qemu-io-cmds.c| 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a

[Qemu-block] [PATCH v3 02/13] block: Freeze the backing chain for the duration of the commit job

2019-03-12 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/commit.c | 16 1 file changed, 16 insertions(+) diff --git a/block/commit.c b/block/commit.c index 3b46ca7f97..ba60fef58a 100644 --- a/block/commit.c +++ b/block/commit.c @@ -39,6 +39,7 @@ typedef struct CommitBlockJob

[Qemu-block] [PATCH v3 01/13] block: Allow freezing BdrvChild links

2019-03-12 Thread Alberto Garcia
the link from the node it points to, and new API to freeze and unfreeze a backing chain. After this change a few functions can fail, so they need additional checks. Signed-off-by: Alberto Garcia --- block.c | 76 +++ include/block/b

[Qemu-block] [PATCH v3 07/13] block: Allow omitting the 'backing' option in certain cases

2019-03-12 Thread Alberto Garcia
this option if the block device being reopened doesn't have a backing file attached _and_ no default backing file is specified in the image metadata. Signed-off-by: Alberto Garcia --- block.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c ind

[Qemu-block] [PATCH v3 03/13] block: Freeze the backing chain for the duration of the mirror job

2019-03-12 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/mirror.c | 8 1 file changed, 8 insertions(+) diff --git a/block/mirror.c b/block/mirror.c index 726d3c27fb..010fdafd79 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -630,6 +630,10 @@ static int mirror_exit_common(Job *job) } s

[Qemu-block] [PATCH v3 00/13] Add a 'x-blockdev-reopen' QMP command

2019-03-12 Thread Alberto Garcia
1/13:[] [--] 'block: Remove the AioContext parameter from bdrv_reopen_multiple()' 012/13:[] [--] 'block: Add an 'x-blockdev-reopen' QMP command' 013/13:[0004] [FC] 'qemu-iotests: Test the x-blockdev-reopen QMP command' Alberto Garcia (13): block:

[Qemu-block] [PATCH v3 05/13] block: Add 'keep_old_opts' parameter to bdrv_reopen_queue()

2019-03-12 Thread Alberto Garcia
. One of the things that we need is a way to tell bdrv_reopen_queue() whether we want to keep the old set of options or not, and that's what this patch does. All current callers are setting this new parameter to true and x-blockdev-reopen will set it to false. Signed-off-by: Alb

Re: [Qemu-block] [PATCH v2 08/13] block: Allow changing the backing file on reopen

2019-03-12 Thread Alberto Garcia
On Tue 12 Mar 2019 01:20:54 PM CET, Kevin Wolf wrote: >> +reopen_state->replace_backing_bs = true; >> +reopen_state->new_backing_bs = new_backing_bs; > > Do we need to bdrv_ref(new_backing_bs) here in case its only reference > is dropped in the same reopen transaction? I'm not sure

Re: [Qemu-block] [PATCH v2 09/13] block: Add a 'mutable_opts' field to BlockDriver

2019-03-12 Thread Alberto Garcia
On Tue 12 Mar 2019 01:32:00 PM CET, Kevin Wolf wrote: > Am 06.03.2019 um 19:11 hat Alberto Garcia geschrieben: >> If we reopen a BlockDriverState and there is an option that is present >> in bs->options but missing from the new set of options then we have to >> return an er

Re: [Qemu-block] [PATCH 2/8] block: Avoid useless local_err

2019-03-11 Thread Alberto Garcia
On Fri 08 Mar 2019 04:37:51 PM CET, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH 2/2] block-stream: include base into job node list

2019-03-08 Thread Alberto Garcia
On Thu 21 Feb 2019 04:26:39 PM CET, Andrey Shinkevich wrote: > The block-stream job needs to own the base node as the limiter > of the copy-on-read operation. So, the base node is included in > the job node list (block_job_add_bdrv). > Also, the block-stream job would not allow the base node to go

[Qemu-block] [PATCH v2 01/13] block: Allow freezing BdrvChild links

2019-03-06 Thread Alberto Garcia
the link from the node it points to, and new API to freeze and unfreeze a backing chain. After this change a few functions can fail, so they need additional checks. Signed-off-by: Alberto Garcia --- block.c | 76 +++ include/block/b

[Qemu-block] [PATCH v2 02/13] block: Freeze the backing chain for the duration of the commit job

2019-03-06 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/commit.c | 16 1 file changed, 16 insertions(+) diff --git a/block/commit.c b/block/commit.c index 3b46ca7f97..ba60fef58a 100644 --- a/block/commit.c +++ b/block/commit.c @@ -39,6 +39,7 @@ typedef struct CommitBlockJob

[Qemu-block] [PATCH v2 13/13] qemu-iotests: Test the x-blockdev-reopen QMP command

2019-03-06 Thread Alberto Garcia
This patch adds several tests for the x-blockdev-reopen QMP command. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/243 | 991 + tests/qemu-iotests/243.out | 5 + tests/qemu-iotests/group | 1 + 3 files changed, 997 insertions

[Qemu-block] [PATCH v2 03/13] block: Freeze the backing chain for the duration of the mirror job

2019-03-06 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/mirror.c | 8 1 file changed, 8 insertions(+) diff --git a/block/mirror.c b/block/mirror.c index 726d3c27fb..010fdafd79 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -630,6 +630,10 @@ static int mirror_exit_common(Job *job) } s

[Qemu-block] [PATCH v2 07/13] block: Allow omitting the 'backing' option in certain cases

2019-03-06 Thread Alberto Garcia
this option if the block device being reopened doesn't have a backing file attached _and_ no default backing file is specified in the image metadata. Signed-off-by: Alberto Garcia --- block.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c ind

[Qemu-block] [PATCH v2 09/13] block: Add a 'mutable_opts' field to BlockDriver

2019-03-06 Thread Alberto Garcia
is a list of runtime options that can be modified during reopen. If an option in this list is unspecified on reopen then it must be reset (or return an error). Signed-off-by: Alberto Garcia --- block/file-posix.c| 6 ++ block/qcow2.c | 25 + block

[Qemu-block] [PATCH v2 00/13] Add a 'x-blockdev-reopen' QMP command

2019-03-06 Thread Alberto Garcia
ter from bdrv_reopen_multiple()' 012/13:[] [--] 'block: Add an 'x-blockdev-reopen' QMP command' 013/13:[0036] [FC] 'qemu-iotests: Test the x-blockdev-reopen QMP command' Alberto Garcia (13): block: Allow freezing BdrvChild links block: Freeze the bac

[Qemu-block] [PATCH v2 04/13] block: Freeze the backing chain for the duration of the stream job

2019-03-06 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/stream.c | 21 + 1 file changed, 21 insertions(+) diff --git a/block/stream.c b/block/stream.c index e14579ff80..6253c86fae 100644 --- a/block/stream.c +++ b/block/stream.c @@ -35,6 +35,7 @@ typedef struct StreamBlockJob

[Qemu-block] [PATCH v2 10/13] block: Add bdrv_reset_options_allowed()

2019-03-06 Thread Alberto Garcia
bdrv_reopen_prepare() already takes care of that. Signed-off-by: Alberto Garcia --- block.c | 58 ++ 1 file changed, 58 insertions(+) diff --git a/block.c b/block.c index 9c83adab7a..83788457e1 100644 --- a/block.c +++ b/block.c

[Qemu-block] [PATCH v2 12/13] block: Add an 'x-blockdev-reopen' QMP command

2019-03-06 Thread Alberto Garcia
be possible to add a similar functionality to other block drivers (e.g. Quorum, blkverify). Although the API is unlikely to change, this command is marked experimental for the time being so there's room to see if the semantics need changes. Signed-off-by: Alberto Garcia --- blockdev.c

[Qemu-block] [PATCH v2 05/13] block: Add 'keep_old_opts' parameter to bdrv_reopen_queue()

2019-03-06 Thread Alberto Garcia
. One of the things that we need is a way to tell bdrv_reopen_queue() whether we want to keep the old set of options or not, and that's what this patch does. All current callers are setting this new parameter to true and x-blockdev-reopen will set it to false. Signed-off-by: Alb

[Qemu-block] [PATCH v2 06/13] block: Handle child references in bdrv_reopen_queue()

2019-03-06 Thread Alberto Garcia
We don't want to open a new image during reopen, so we require that "backing" is always present. We'll relax this requirement a bit in the next patch. If keep_old_opts is true and "backing" is missing then this behaves like 2a (the c

[Qemu-block] [PATCH v2 08/13] block: Allow changing the backing file on reopen

2019-03-06 Thread Alberto Garcia
a new set of options ({"driver": "qcow2", "file": { ... }}) then it is interpreted that the _existing_ backing file must be reopened with those options. Signed-off-by: Alberto Garcia --- block.c | 162 ++ i

[Qemu-block] [PATCH v2 11/13] block: Remove the AioContext parameter from bdrv_reopen_multiple()

2019-03-06 Thread Alberto Garcia
This parameter has been unused since 1a63a907507fbbcfaee3f622907ec244b Signed-off-by: Alberto Garcia --- block.c | 4 ++-- block/replication.c | 3 +-- include/block/block.h | 2 +- qemu-io-cmds.c| 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a

<    5   6   7   8   9   10   11   12   13   14   >