Am 06.03.2013 um 19:27 hat Peter Lieven geschrieben: > Am 06.03.2013 19:06, schrieb Paolo Bonzini: > > Il 06/03/2013 18:50, Peter Lieven ha scritto: > >>>> Commit 9a665b2b made bdrv_truncate() call bdrv_drain_all(), but this > >>>> breaks > >>>> QCOW images, as well other future image formats (such as VHDX) that may > >>>> call > >>>> bdrv_truncate(bs->file) from within a read/write operation. For > >>>> example, QCOW > >>>> will cause an assert, due to tracked_requests not being empty (since the > >>>> read/write that called bdrv_truncate() is still in progress). > > > > I'm not sure such bdrv_truncate calls are necessary. QCOW2 doesn't have > > them (almost; there is one in qcow2_write_compressed, I'm not even sure > > that one is necessary though), and I think QCOW's breaks using it with a > > block device as a backing file. > > I think we have to check the sense of bs->growable nevertheless. It is set > to 1 for all drivers which can't be right?!
For everything that goes through bdrv_file_open(), which are protocol drivers, not format drivers. It is required for files so that formats can write past EOF; for other drivers that can't actually grow their backing storage it doesn't hurt because they will return an eror anyway when you write to it. "bdrv_truncate() works" and "bs->growable == true" are totally different things, so even though it doesn't look right at the first sight, bs->growable does its job correctly. In your other mail you're talking about setting it for raw, qcow2, VHDX. This would be discussing on the entirely wrong level, this isn't about formats, but about protocols (file, host_device, nbd, iscsi, http, vvfat...), that are below the format drivers. Kevin