提交 8b656700 编写于 作者: O Osier Yang 提交者: Cole Robinson

storage: Fix bug of fs pool destroying

Regression introduced by commit 258e06c8, "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 commit f4ac0656)
上级 2484fb2e
......@@ -454,6 +454,7 @@ static int
virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) {
virCommandPtr cmd = NULL;
int ret = -1;
int rc;
if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
if (pool->def->source.nhost != 1) {
......@@ -480,12 +481,8 @@ virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) {
}
/* Short-circuit if already unmounted */
if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 1) {
if (ret < 0)
return -1;
else
return 0;
}
if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 1)
return rc;
cmd = virCommandNewArgList(UMOUNT,
pool->def->target.path,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册