<feed xmlns='http://www.w3.org/2005/Atom'>
<title>bwlp/qemu.git/block/stream.c, branch spice_video_codecs</title>
<subtitle>Experimental fork of QEMU with video encoding patches</subtitle>
<id>https://git.openslx.org/bwlp/qemu.git/atom/block/stream.c?h=spice_video_codecs</id>
<link rel='self' href='https://git.openslx.org/bwlp/qemu.git/atom/block/stream.c?h=spice_video_codecs'/>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/'/>
<updated>2022-03-29T14:30:55+00:00</updated>
<entry>
<title>block/stream: Drain subtree around graph change</title>
<updated>2022-03-29T14:30:55+00:00</updated>
<author>
<name>Hanna Reitz</name>
</author>
<published>2022-03-24T14:09:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=b1e1af394d9dac425eaac7ab6b77cb5225eaf26c'/>
<id>urn:sha1:b1e1af394d9dac425eaac7ab6b77cb5225eaf26c</id>
<content type='text'>
When the stream block job cuts out the nodes between top and base in
stream_prepare(), it does not drain the subtree manually; it fetches the
base node, and tries to insert it as the top node's backing node with
bdrv_set_backing_hd().  bdrv_set_backing_hd() however will drain, and so
the actual base node might change (because the base node is actually not
part of the stream job) before the old base node passed to
bdrv_set_backing_hd() is installed.

This has two implications:

First, the stream job does not keep a strong reference to the base node.
Therefore, if it is deleted in bdrv_set_backing_hd()'s drain (e.g.
because some other block job is drained to finish), we will get a
use-after-free.  We should keep a strong reference to that node.

Second, even with such a strong reference, the problem remains that the
base node might change before bdrv_set_backing_hd() actually runs and as
a result the wrong base node is installed.

Both effects can be seen in 030's TestParallelOps.test_overlapping_5()
case, which has five nodes, and simultaneously streams from the middle
node to the top node, and commits the middle node down to the base node.
As it is, this will sometimes crash, namely when we encounter the
above-described use-after-free.

Taking a strong reference to the base node, we no longer get a crash,
but the resuling block graph is less than ideal: The expected result is
obviously that all middle nodes are cut out and the base node is the
immediate backing child of the top node.  However, if stream_prepare()
takes a strong reference to its base node (the middle node), and then
the commit job finishes in bdrv_set_backing_hd(), supposedly dropping
that middle node, the stream job will just reinstall it again.

Therefore, we need to keep the whole subtree drained in
stream_prepare(), so that the graph modification it performs is
effectively atomic, i.e. that the base node it fetches is still the base
node when bdrv_set_backing_hd() sets it as the top node's backing node.

Verify this by asserting in said 030's test case that the base node is
always the top node's immediate backing child when both jobs are done.

Signed-off-by: Hanna Reitz &lt;hreitz@redhat.com&gt;
Message-Id: &lt;20220324140907.17192-1-hreitz@redhat.com&gt;
Reviewed-by: Eric Blake &lt;eblake@redhat.com&gt;
Acked-by: Vladimir Sementsov-Ogievskiy &lt;v.sementsov-og@mail.ru&gt;
</content>
</entry>
<entry>
<title>assertions for block_int global state API</title>
<updated>2022-03-04T17:18:25+00:00</updated>
<author>
<name>Emanuele Giuseppe Esposito</name>
</author>
<published>2022-03-03T15:15:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=b4ad82aab10ea0cfe981e94414751e26a510c280'/>
<id>urn:sha1:b4ad82aab10ea0cfe981e94414751e26a510c280</id>
<content type='text'>
Signed-off-by: Emanuele Giuseppe Esposito &lt;eesposit@redhat.com&gt;
Message-Id: &lt;20220303151616.325444-13-eesposit@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block/stream: add own blk</title>
<updated>2021-12-28T14:18:54+00:00</updated>
<author>
<name>Vladimir Sementsov-Ogievskiy</name>
</author>
<published>2021-05-06T14:13:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=048954e2f6d4e88383186db2d223f3a42ddb61f7'/>
<id>urn:sha1:048954e2f6d4e88383186db2d223f3a42ddb61f7</id>
<content type='text'>
block-stream is the only block-job, that reasonably use BlockJob.blk.
We are going to drop BlockJob.blk soon. So, let block-stream have own
blk.

Signed-off-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
Reviewed-by: Nikita Lapshin &lt;nikita.lapshin@virtuozzo.com&gt;
</content>
</entry>
<entry>
<title>stream: Traverse graph after modification</title>
<updated>2021-11-16T08:43:23+00:00</updated>
<author>
<name>Hanna Reitz</name>
</author>
<published>2021-11-15T14:53:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=8d3dd037d947ce96c42c376ef0bb5e5c6ef96cbe'/>
<id>urn:sha1:8d3dd037d947ce96c42c376ef0bb5e5c6ef96cbe</id>
<content type='text'>
bdrv_cor_filter_drop() modifies the block graph.  That means that other
parties can also modify the block graph before it returns.  Therefore,
we cannot assume that the result of a graph traversal we did before
remains valid afterwards.

We should thus fetch `base` and `unfiltered_base` afterwards instead of
before.

Signed-off-by: Hanna Reitz &lt;hreitz@redhat.com&gt;
Reviewed-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Reviewed-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
Message-Id: &lt;20211111120829.81329-2-hreitz@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Message-Id: &lt;20211115145409.176785-2-kwolf@redhat.com&gt;
Signed-off-by: Hanna Reitz &lt;hreitz@redhat.com&gt;
</content>
</entry>
<entry>
<title>stream: Don't crash when node permission is denied</title>
<updated>2021-03-19T09:15:06+00:00</updated>
<author>
<name>Kevin Wolf</name>
</author>
<published>2021-03-09T17:34:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=1bf26076d677f693dd99a6e8ef2eca69b842d873'/>
<id>urn:sha1:1bf26076d677f693dd99a6e8ef2eca69b842d873</id>
<content type='text'>
The image streaming block job restricts shared permissions of the nodes
it accesses. This can obviously fail when other users already got these
permissions. &amp;error_abort is therefore wrong and can crash. Handle these
errors gracefully and just fail starting the block job.

Reported-by: Nini Gu &lt;ngu@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Message-Id: &lt;20210309173451.45152-1-kwolf@redhat.com&gt;
Reviewed-by: Eric Blake &lt;eblake@redhat.com&gt;
Reviewed-by: Alberto Garcia &lt;berto@igalia.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: apply COR-filter to block-stream jobs</title>
<updated>2021-01-26T13:36:37+00:00</updated>
<author>
<name>Andrey Shinkevich</name>
</author>
<published>2020-12-16T06:17:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=205736f4888e6c2bf1a78712cf0fc84d9f7cbcee'/>
<id>urn:sha1:205736f4888e6c2bf1a78712cf0fc84d9f7cbcee</id>
<content type='text'>
This patch completes the series with the COR-filter applied to
block-stream operations.

Adding the filter makes it possible in future implement discarding
copied regions in backing files during the block-stream job, to reduce
the disk overuse (we need control on permissions).

Also, the filter now is smart enough to do copy-on-read with specified
base, so we have benefit on guest reads even when doing block-stream of
the part of the backing chain.

Several iotests are slightly modified due to filter insertion.

Signed-off-by: Andrey Shinkevich &lt;andrey.shinkevich@virtuozzo.com&gt;
Signed-off-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
Message-Id: &lt;20201216061703.70908-14-vsementsov@virtuozzo.com&gt;
Reviewed-by: Max Reitz &lt;mreitz@redhat.com&gt;
Signed-off-by: Max Reitz &lt;mreitz@redhat.com&gt;
</content>
</entry>
<entry>
<title>block/stream: add s-&gt;target_bs</title>
<updated>2021-01-26T13:36:37+00:00</updated>
<author>
<name>Vladimir Sementsov-Ogievskiy</name>
</author>
<published>2020-12-16T06:17:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=0f6c94988afdf38228abdaf0b5504cc115f63836'/>
<id>urn:sha1:0f6c94988afdf38228abdaf0b5504cc115f63836</id>
<content type='text'>
Add a direct link to target bs for convenience and to simplify
following commit which will insert COR filter above target bs.

This is a part of original commit written by Andrey.

Signed-off-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
Reviewed-by: Max Reitz &lt;mreitz@redhat.com&gt;
Message-Id: &lt;20201216061703.70908-13-vsementsov@virtuozzo.com&gt;
Signed-off-by: Max Reitz &lt;mreitz@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: block-stream: add "bottom" argument</title>
<updated>2021-01-26T13:36:37+00:00</updated>
<author>
<name>Vladimir Sementsov-Ogievskiy</name>
</author>
<published>2020-12-16T06:17:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=7f4a396d76670bbffd6c3ba9a550a1bb62ae6267'/>
<id>urn:sha1:7f4a396d76670bbffd6c3ba9a550a1bb62ae6267</id>
<content type='text'>
The code already don't freeze base node and we try to make it prepared
for the situation when base node is changed during the operation. In
other words, block-stream doesn't own base node.

Let's introduce a new interface which should replace the current one,
which will in better relations with the code. Specifying bottom node
instead of base, and requiring it to be non-filter gives us the
following benefits:

 - drop difference between above_base and base_overlay, which will be
   renamed to just bottom, when old interface dropped

 - clean way to work with parallel streams/commits on the same backing
   chain, which otherwise become a problem when we introduce a filter
   for stream job

 - cleaner interface. Nobody will surprised the fact that base node may
   disappear during block-stream, when there is no word about "base" in
   the interface.

Signed-off-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
Message-Id: &lt;20201216061703.70908-11-vsementsov@virtuozzo.com&gt;
Reviewed-by: Max Reitz &lt;mreitz@redhat.com&gt;
Signed-off-by: Max Reitz &lt;mreitz@redhat.com&gt;
</content>
</entry>
<entry>
<title>stream: rework backing-file changing</title>
<updated>2021-01-26T13:36:37+00:00</updated>
<author>
<name>Andrey Shinkevich</name>
</author>
<published>2020-12-16T06:16:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=000e5a1cda09e18af91556a39b5a4f1214becb3c'/>
<id>urn:sha1:000e5a1cda09e18af91556a39b5a4f1214becb3c</id>
<content type='text'>
Stream in stream_prepare calls bdrv_change_backing_file() to change
backing-file in the metadata of bs.

It may use either backing-file parameter given by user or just take
filename of base on job start.

Backing file format is determined by base on job finish.

There are some problems with this design, we solve only two by this
patch:

1. Consider scenario with backing-file unset. Current concept of stream
supports changing of the base during the job (we don't freeze link to
the base). So, we should not save base filename at job start,

  - let's determine name of the base on job finish.

2. Using direct base to determine filename and format is not very good:
base node may be a filter, so its filename may be JSON, and format_name
is not good for storing into qcow2 metadata as backing file format.

  - let's use unfiltered_base

Signed-off-by: Andrey Shinkevich &lt;andrey.shinkevich@virtuozzo.com&gt;
Signed-off-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
  [vsementsov: change commit subject, change logic in stream_prepare]
Message-Id: &lt;20201216061703.70908-10-vsementsov@virtuozzo.com&gt;
Reviewed-by: Max Reitz &lt;mreitz@redhat.com&gt;
Signed-off-by: Max Reitz &lt;mreitz@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: add filter-node-name to block-stream</title>
<updated>2021-01-26T10:26:54+00:00</updated>
<author>
<name>Andrey Shinkevich</name>
</author>
<published>2020-12-16T06:16:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=880747a887a3c2ee022b7f610e54e08b84deb1af'/>
<id>urn:sha1:880747a887a3c2ee022b7f610e54e08b84deb1af</id>
<content type='text'>
Provide the possibility to pass the 'filter-node-name' parameter to the
block-stream job as it is done for the commit block job.

Signed-off-by: Andrey Shinkevich &lt;andrey.shinkevich@virtuozzo.com&gt;
Reviewed-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
  [vsementsov: comment indentation, s/Since: 5.2/Since: 6.0/]
Reviewed-by: Max Reitz &lt;mreitz@redhat.com&gt;
Message-Id: &lt;20201216061703.70908-5-vsementsov@virtuozzo.com&gt;
[mreitz: s/commit/stream/]
Signed-off-by: Max Reitz &lt;mreitz@redhat.com&gt;
</content>
</entry>
</feed>
