[libvirt] [PATCH] qemu: Stop recursive detection of image chains when an image is missing

Eric Blake eblake at redhat.com
Wed Nov 21 14:14:25 UTC 2012


On 11/21/2012 04:05 AM, Peter Krempa wrote:
> Commit e0c469e58b93f852a72265919703cb6abd3779f8 that fixes the detection
> of image chain wasn't complete. Iteration through the backing image
> chain has to stop at the last existing image if some of the images are
> missing otherwise the backing chain that is cached contains entries with
> paths being set to NULL resulting to:
> 
> error: Unable to allow access for disk path (null): Bad address
> 
> Fortunately stat() is kind enough not to crash when it's presented with
> a NULL argument.

That's only true for stat() on Linux; other OSs are fully entitled to
crash, so this definitely needs fixing :)

> ---
>  src/util/storage_file.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/util/storage_file.c b/src/util/storage_file.c
> index 2249212..e7cbea7 100644
> --- a/src/util/storage_file.c
> +++ b/src/util/storage_file.c
> @@ -729,6 +729,8 @@ virStorageFileGetMetadataFromBuf(int format,
>                  if (meta->backingStore == NULL) {
>                      /* the backing file is (currently) unavailable, treat this
>                       * file as standalone */
> +                    VIR_FREE(meta->backingStoreRaw);
> +                    meta->backingStoreIsFile = false;
>                      backingFormat = VIR_STORAGE_FILE_NONE;

Hmm, I'm wondering if this is the right place to fix it, or if we are
throwing away information too early.  That is, are we sure it is not the
later client of the chain at fault for not recognizing
VIR_STORAGE_FILE_NONE coupled with non-NULL backingStoreRaw as the key
for whether a backing file is missing?  I'm guessing
domain_conf.c:virDomainDiskDefForeachPath would be the real function to
fix here.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121121/50dc7e71/attachment-0001.sig>


More information about the libvir-list mailing list