[libvirt] [PATCH 3/5] storage: Check FS pool source during virStorageBackendFileSystemIsMounted
Michal Privoznik
mprivozn at redhat.com
Tue Dec 15 15:54:43 UTC 2015
On 07.12.2015 21:47, John Ferlan wrote:
> 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
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/storage/storage_backend_fs.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index 1dd5727..70e6be6 100644
> --- a/src/storage/storage_backend_fs.c
> +++ b/src/storage/storage_backend_fs.c
> @@ -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;
> }
>
>
ACK
Michal
More information about the libvir-list
mailing list