render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
7a3408
From 79eaa4a5fde86f6d9c4b059aef5d4db6dfcf3659 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <79eaa4a5fde86f6d9c4b059aef5d4db6dfcf3659@dist-git>
7a3408
From: John Ferlan <jferlan@redhat.com>
7a3408
Date: Wed, 2 Sep 2015 09:55:15 -0400
7a3408
Subject: [PATCH] storage: Handle failure from refreshVol
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1253609
7a3408
7a3408
Commit id '155ca616' added the 'refreshVol' API. In an NFS root-squash
7a3408
environment it was possible that if the just created volume from XML wasn't
7a3408
properly created with the right uid/gid and/or mode, then the followup
7a3408
refreshVol will fail to open the volume in order to get the allocation/
7a3408
capacity values. This would leave the volume still on the server and
7a3408
cause a libvirtd crash because 'voldef' would be in the pool list, but
7a3408
the cleanup code would free it.
7a3408
7a3408
(cherry picked from commit db9277a39bc364806e8d3e08a08fc128d59b7094)
7a3408
Signed-off-by: John Ferlan <jferlan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/storage/storage_driver.c | 6 +++++-
7a3408
 1 file changed, 5 insertions(+), 1 deletion(-)
7a3408
7a3408
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
7a3408
index b67a5d8..038c176 100644
7a3408
--- a/src/storage/storage_driver.c
7a3408
+++ b/src/storage/storage_driver.c
7a3408
@@ -1867,8 +1867,12 @@ storageVolCreateXML(virStoragePoolPtr obj,
7a3408
     }
7a3408
 
7a3408
     if (backend->refreshVol &&
7a3408
-        backend->refreshVol(obj->conn, pool, voldef) < 0)
7a3408
+        backend->refreshVol(obj->conn, pool, voldef) < 0) {
7a3408
+        storageVolDeleteInternal(volobj, backend, pool, voldef,
7a3408
+                                 0, false);
7a3408
+        voldef = NULL;
7a3408
         goto cleanup;
7a3408
+    }
7a3408
 
7a3408
     /* Update pool metadata ignoring the disk backend since
7a3408
      * it updates the pool values.
7a3408
-- 
7a3408
2.5.1
7a3408