block: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file.
authorBenoît Canet <benoit.canet@irqsave.net>
Tue, 22 Apr 2014 15:05:27 +0000 (17:05 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 25 Apr 2014 16:05:05 +0000 (18:05 +0200)
commit1ba4b6a553ad9ff4645af7fab8adfc6e810fcc69
tree32c70dc0d83f4d06f4a2aae861557e73fd04ef77
parent411f491e0af173cf8f39347574941bd26fbae381
block: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file.

In 1.7.1 qcow2_create2 reopen the file for flushing without the BDRV_O_NO_BACKING
flags.

As a consequence the code would recursively open the whole backing chain.

These three stack arrays would pile up through the recursion and lead to a coroutine
stack overflow.

Convert these array to malloced buffers in order to streamline the coroutine
footprint.

Symptoms where freezes or segfaults on production machines while taking QMP externals
snapshots. The overflow disturbed coroutine switching.

[Resolved conflicts on qemu.git/master since the patch was against v1.7.1
--Stefan]

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block.c