From: John Ferlan Date: Mon, 24 Aug 2015 16:38:13 +0000 (-0400) Subject: storage: Handle failure from refreshVol X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=605b12068392d29beb44a8ab7d6ec176d6b05237;p=thirdparty%2Flibvirt.git storage: Handle failure from refreshVol Commit id '155ca616' added the 'refreshVol' API. In an NFS root-squash environment it was possible that if the just created volume from XML wasn't properly created with the right uid/gid and/or mode, then the followup refreshVol will fail to open the volume in order to get the allocation/ capacity values. This would leave the volume still on the server and cause a libvirtd crash because 'voldef' would be in the pool list, but the cleanup code would free it. --- diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index b95506faf5..6dfc16c2cf 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1734,8 +1734,12 @@ storageVolCreateXML(virStoragePoolPtr obj, } if (backend->refreshVol && - backend->refreshVol(obj->conn, pool, voldef) < 0) + backend->refreshVol(obj->conn, pool, voldef) < 0) { + storageVolDeleteInternal(volobj, backend, pool, voldef, + 0, false); + voldef = NULL; goto cleanup; + } /* Update pool metadata */ pool->def->allocation += buildvoldef->target.allocation;