[RFC patch 00/17] qemu: Unlock VM object while accessing storage (in certain cases)

Peter Krempa via Devel posted 17 patches 23 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1780063451.git.pkrempa@redhat.com
src/libvirt_private.syms              |   3 +-
src/qemu/qemu_domain.c                | 140 ++++++++++++++++++++++---
src/qemu/qemu_domain.h                |  19 +++-
src/qemu/qemu_driver.c                | 143 +++++++-------------------
src/qemu/qemu_migration.c             |   5 +-
src/storage_file/storage_file_probe.c |  20 +++-
src/storage_file/storage_source.c     |  98 +++++++++++++-----
src/storage_file/storage_source.h     |  16 ++-
8 files changed, 279 insertions(+), 165 deletions(-)
[RFC patch 00/17] qemu: Unlock VM object while accessing storage (in certain cases)
Posted by Peter Krempa via Devel 23 hours ago
If a thread is blocked while holding the VM lock, other operations
become impossible. This is due to the fact that both listing domains of
a daemon requires locking the objects (for accessing the name/uuid/id,
but also for filtering). Similarly even if a user has a virDomainPtr
instace already looked up invoking an API results into trying to fetch a
locked VM object instance which will simply block.

This patchset is a path for being able to identify stuff which colud
block and similarly to how monitor is accessed unlocking @vm while doing
such operation.

To show how it's used, we use it when probing disk size data. The
patchset obviously needed to refactor stuff first for this to happen.

Peter Krempa (17):
  storage_source: Don't modify @src in
    'virStorageSourceUpdatePhysicalSize'
  virStorageSourceGetSize: Return also 'allocation' value if needed
  virStorageFileProbeFormatFromBuf: Allow NULL 'path' argument
  virStorageFileProbeGetMetadata: Allow NULL 'meta->path'
  virStorageSourceGetMetadataFromBuf: Refactor cleanup
  virStorageSourceUpdateCapacity: Factor out size probing to
    'virStorageSourceProbeCapacityFromBuf'
  qemu: domain: Introduce 'qemuDomainStorageSourceProbeSize'
  qemuDomainGetBlockInfo: Rewrite to 'qemuDomainStorageSourceProbeSize'
  qemuDomainGetStatsOneBlock: Rewrite to
    'qemuDomainStorageSourceProbeSize'
  qemuMigrationDstPrepareStorage: Rewrite to
    'qemuDomainStorageSourceProbeSize'
  qemuDomainBlockResize: Rewrite to 'qemuDomainStorageSourceProbeSize'
  qemu: domain: Remove 'qemuDomainStorageUpdatePhysical'
  qemuDomainGetStatsOneBlockFallback: Rewrite using
    'qemuDomainStorageSourceProbeSize'
  qemuDomainGetBlockInfo: Rewrite using
    'qemuDomainStorageSourceProbeSize'
  qemu: domain: Fix coding style of domain object locking helpers
  qemu: domain: Introduce APIs for unlocking domain object during
    potentially long running operations
  qemuDomainStorageSourceProbeSize: Yield domain object while accessing
    storage

 src/libvirt_private.syms              |   3 +-
 src/qemu/qemu_domain.c                | 140 ++++++++++++++++++++++---
 src/qemu/qemu_domain.h                |  19 +++-
 src/qemu/qemu_driver.c                | 143 +++++++-------------------
 src/qemu/qemu_migration.c             |   5 +-
 src/storage_file/storage_file_probe.c |  20 +++-
 src/storage_file/storage_source.c     |  98 +++++++++++++-----
 src/storage_file/storage_source.h     |  16 ++-
 8 files changed, 279 insertions(+), 165 deletions(-)

-- 
2.54.0