提交 30d99eb5 编写于 作者: P Peter Krempa

storage: Clean up unlocking of storage pool objects

Most of the APIs now don't reach the cleanup section when the pool
object wasn't found and thus don't need to check before unlocking it.
上级 efd89276
......@@ -289,7 +289,6 @@ storagePoolLookupByUUID(virConnectPtr conn,
NULL, NULL);
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -309,7 +308,7 @@ storagePoolLookupByName(virConnectPtr conn,
if (!pool) {
virReportError(VIR_ERR_NO_STORAGE_POOL,
_("no storage pool with matching name '%s'"), name);
goto cleanup;
return NULL;
}
if (virStoragePoolLookupByNameEnsureACL(conn, pool->def) < 0)
......@@ -319,7 +318,6 @@ storagePoolLookupByName(virConnectPtr conn,
NULL, NULL);
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -338,7 +336,7 @@ storagePoolLookupByVolume(virStorageVolPtr vol)
if (!pool) {
virReportError(VIR_ERR_NO_STORAGE_POOL,
_("no storage pool with matching name '%s'"), vol->pool);
goto cleanup;
return NULL;
}
if (virStoragePoolLookupByVolumeEnsureACL(vol->conn, pool->def) < 0)
......@@ -348,7 +346,6 @@ storagePoolLookupByVolume(virStorageVolPtr vol)
NULL, NULL);
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -571,7 +568,6 @@ static int storagePoolIsActive(virStoragePoolPtr pool)
ret = virStoragePoolObjIsActive(obj);
cleanup:
if (obj)
virStoragePoolObjUnlock(obj);
return ret;
}
......@@ -590,7 +586,6 @@ static int storagePoolIsPersistent(virStoragePoolPtr pool)
ret = obj->configFile ? 1 : 0;
cleanup:
if (obj)
virStoragePoolObjUnlock(obj);
return ret;
}
......@@ -805,7 +800,6 @@ storagePoolCreate(virStoragePoolPtr obj,
ret = 0;
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -840,7 +834,6 @@ storagePoolBuild(virStoragePoolPtr obj,
ret = 0;
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -951,7 +944,6 @@ storagePoolDelete(virStoragePoolPtr obj,
ret = 0;
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -1047,7 +1039,6 @@ storagePoolGetInfo(virStoragePoolPtr obj,
ret = 0;
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -1076,7 +1067,6 @@ storagePoolGetXMLDesc(virStoragePoolPtr obj,
ret = virStoragePoolDefFormat(def);
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -1102,7 +1092,6 @@ storagePoolGetAutostart(virStoragePoolPtr obj,
ret = 0;
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -1200,7 +1189,6 @@ storagePoolNumOfVolumes(virStoragePoolPtr obj)
}
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......@@ -1240,7 +1228,6 @@ storagePoolListVolumes(virStoragePoolPtr obj,
return n;
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
for (n = 0; n < maxnames; n++)
VIR_FREE(names[n]);
......@@ -1309,7 +1296,6 @@ storagePoolListAllVolumes(virStoragePoolPtr pool,
VIR_FREE(tmp_vols);
}
if (obj)
virStoragePoolObjUnlock(obj);
return ret;
......@@ -1348,7 +1334,6 @@ storageVolLookupByName(virStoragePoolPtr obj,
NULL, NULL);
cleanup:
if (pool)
virStoragePoolObjUnlock(pool);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册