提交 dae7007d 编写于 作者: J John Ferlan

storage: Check FS pool source during virStorageBackendFileSystemIsMounted

https://bugzilla.redhat.com/show_bug.cgi?id=1025230

When determining whether a FS pool is mounted, rather than assuming that
the FS pool is mounted just because the target.path is in the mount list,
let's make sure that the FS pool source matches what is mounted
上级 61c29fe5
......@@ -419,6 +419,7 @@ static int
virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
{
int ret = -1;
char *src = NULL;
FILE *mtab;
struct mntent ent;
char buf[1024];
......@@ -431,16 +432,23 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
}
while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) {
if (STREQ(ent.mnt_dir, pool->def->target.path)) {
if (!(src = virStorageBackendFileSystemGetPoolSource(pool)))
goto cleanup;
if (STREQ(ent.mnt_dir, pool->def->target.path) &&
STREQ(ent.mnt_fsname, src)) {
ret = 1;
goto cleanup;
}
VIR_FREE(src);
}
ret = 0;
cleanup:
VIR_FORCE_FCLOSE(mtab);
VIR_FREE(src);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册