diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 3a6f130cc0357bb63a90350858c231f95c98d672..692c9ff17989541efced0596cd1bfa5403bcf288 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; }