mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-30 17:45:23 +00:00
storage: Fix bug of fs pool destroying
Regression introduced by commit258e06c85b
, "ret" could be set to 1 or 0 by virStorageBackendFileSystemIsMounted before goto cleanup. This could mislead the callers (up to the public API virStoragePoolDestroy) to return success even the underlying umount command fails. (cherry picked from commitf4ac06569a
)
This commit is contained in:
parent
2484fb2ef7
commit
8b6567005c
@ -454,6 +454,7 @@ static int
|
|||||||
virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) {
|
virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) {
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
|
if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
|
||||||
if (pool->def->source.nhost != 1) {
|
if (pool->def->source.nhost != 1) {
|
||||||
@ -480,12 +481,8 @@ virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Short-circuit if already unmounted */
|
/* Short-circuit if already unmounted */
|
||||||
if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 1) {
|
if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 1)
|
||||||
if (ret < 0)
|
return rc;
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd = virCommandNewArgList(UMOUNT,
|
cmd = virCommandNewArgList(UMOUNT,
|
||||||
pool->def->target.path,
|
pool->def->target.path,
|
||||||
|
Loading…
Reference in New Issue
Block a user