]> git.proxmox.com Git - pve-qemu.git/commitdiff
update submodule and patches to 7.2.0
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 14 Dec 2022 14:16:32 +0000 (15:16 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 16 Dec 2022 10:47:20 +0000 (11:47 +0100)
User-facing breaking change:

The slirp submodule for user networking got removed. It would be
necessary to add the --enable-slirp option to the build and/or install
the appropriate library to continue building it. Since PVE is not
explicitly supporting it, it would require additionally installing the
libslirp0 package on all installations and there is *very* little
mention on the community forum when searching for "slirp" or
"netdev user", the plan is to only enable it again if there is some
real demand for it.

Notable changes:

* The big change for this release is the rework of job locking, using
  a job mutex and introducing _locked() variants of job API functions
  moving away from call-side AioContext locking. See (in the qemu
  submodule) commit 6f592e5aca ("job.c: enable job lock/unlock and
  remove Aiocontext locks") and previous commits for context.

  Changes required for the backup patches:
  * Use WITH_JOB_LOCK_GUARD() and call the _locked() variant of job
    API functions where appropriate (many are only availalbe as
    a _locked() variant).
  * Remove acquiring/releasing AioContext around functions taking the
    job mutex lock internally.

  The patch introducing sequential transaction support for jobs needs
  to temporarily unlock the job mutex to call job_start() when
  starting the next job in the transaction.

* The zeroinit block driver now marks its child as primary.

  The documentation in include/block/block-common.h states:
  > Filter node has exactly one FILTERED|PRIMARY child, and may have
  > other children which must not have these bits

  Without this, an assert will trigger when copying to a zeroinit target
  with qemu-img convert, because bdrv_child_cb_attach() expects any
  non-PRIMARY child to be not FILTERED:
  > qemu-img convert -n -p -f raw -O raw input.raw zeroinit:output.raw
  > qemu-img: ../block.c:1476: bdrv_child_cb_attach: Assertion
  > `!(child->role & BDRV_CHILD_FILTERED)' failed.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
63 files changed:
debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch
debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch
debian/patches/extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch
debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch [deleted file]
debian/patches/extra/0002-init-daemonize-defuse-PID-file-resolve-error.patch [new file with mode: 0644]
debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch [deleted file]
debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch [deleted file]
debian/patches/extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch [deleted file]
debian/patches/extra/0006-block-block-backend-blk_set_enable_write_cache-is-IO.patch [deleted file]
debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch
debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch
debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch
debian/patches/pve/0005-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch
debian/patches/pve/0007-PVE-Up-qmp-add-get_link_status.patch
debian/patches/pve/0008-PVE-Up-glusterfs-allow-partial-reads.patch
debian/patches/pve/0009-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch
debian/patches/pve/0010-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch
debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-isize-parameter.patch
debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch
debian/patches/pve/0013-PVE-virtio-balloon-improve-query-balloon.patch
debian/patches/pve/0014-PVE-qapi-modify-query-machines.patch
debian/patches/pve/0015-PVE-qapi-modify-spice-query.patch
debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch
debian/patches/pve/0020-PVE-Add-dummy-id-command-line-parameter.patch
debian/patches/pve/0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
debian/patches/pve/0024-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
debian/patches/pve/0025-PVE-Allow-version-code-in-machine-type.patch
debian/patches/pve/0026-block-backup-move-bcs-bitmap-initialization-to-job-c.patch
debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
debian/patches/pve/0028-PVE-Backup-add-backup-dump-block-driver.patch
debian/patches/pve/0029-PVE-Backup-proxmox-backup-patches-for-qemu.patch
debian/patches/pve/0030-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
debian/patches/pve/0031-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch
debian/patches/pve/0032-PVE-various-PBS-fixes.patch
debian/patches/pve/0033-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
debian/patches/pve/0034-PVE-add-query_proxmox_support-QMP-command.patch
debian/patches/pve/0035-PVE-add-query-pbs-bitmap-info-QMP-call.patch
debian/patches/pve/0036-PVE-redirect-stderr-to-journal-when-daemonized.patch
debian/patches/pve/0037-PVE-Add-sequential-job-transaction-support.patch
debian/patches/pve/0038-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch
debian/patches/pve/0039-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch
debian/patches/pve/0040-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
debian/patches/pve/0042-PVE-fall-back-to-open-iscsi-initiatorname.patch
debian/patches/pve/0043-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch
debian/patches/pve/0044-PBS-add-master-key-support.patch
debian/patches/pve/0045-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
debian/patches/pve/0047-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
debian/patches/pve/0048-block-add-alloc-track-driver.patch
debian/patches/pve/0050-PVE-savevm-async-register-yank-before-migration_inco.patch
debian/patches/pve/0051-qemu-img-dd-add-l-option-for-loading-a-snapshot.patch
debian/patches/pve/0053-pbs-namespace-support.patch
debian/patches/pve/0057-PVE-Backup-create-jobs-correctly-cancel-in-error-sce.patch
debian/patches/pve/0058-PVE-Backup-ensure-jobs-in-di_list-are-referenced.patch
debian/patches/pve/0059-PVE-Backup-avoid-segfault-issues-upon-backup-cancel.patch
debian/patches/pve/0062-block-alloc-track-avoid-premature-break.patch
debian/patches/pve/0063-PVE-Backup-allow-passing-max-workers-performance-set.patch
debian/patches/series
qemu

index 8cdca68320cac60d504792e1c98bf9c1b7891cf7..fcc2353b6d19bfef81560e3a90a582ac905fc7dd 100644 (file)
@@ -36,7 +36,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  5 files changed, 145 insertions(+), 29 deletions(-)
 
 diff --git a/block/mirror.c b/block/mirror.c
-index 3c4ab1159d..f2eca983f1 100644
+index 251adc5ae0..8ead5f77a0 100644
 --- a/block/mirror.c
 +++ b/block/mirror.c
 @@ -51,7 +51,7 @@ typedef struct MirrorBlockJob {
@@ -57,7 +57,7 @@ index 3c4ab1159d..f2eca983f1 100644
      BdrvDirtyBitmap *dirty_bitmap;
      BdrvDirtyBitmapIter *dbi;
      uint8_t *buf;
-@@ -696,7 +698,8 @@ static int mirror_exit_common(Job *job)
+@@ -699,7 +701,8 @@ static int mirror_exit_common(Job *job)
      bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing,
                               &error_abort);
      if (!abort && s->backing_mode == MIRROR_SOURCE_BACKING_CHAIN) {
@@ -67,7 +67,7 @@ index 3c4ab1159d..f2eca983f1 100644
          BlockDriverState *unfiltered_target = bdrv_skip_filters(target_bs);
  
          if (bdrv_cow_bs(unfiltered_target) != backing) {
-@@ -794,6 +797,16 @@ static void mirror_abort(Job *job)
+@@ -797,6 +800,16 @@ static void mirror_abort(Job *job)
      assert(ret == 0);
  }
  
@@ -84,7 +84,7 @@ index 3c4ab1159d..f2eca983f1 100644
  static void coroutine_fn mirror_throttle(MirrorBlockJob *s)
  {
      int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
-@@ -973,7 +986,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
+@@ -977,7 +990,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
      mirror_free_init(s);
  
      s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
@@ -94,7 +94,7 @@ index 3c4ab1159d..f2eca983f1 100644
          ret = mirror_dirty_init(s);
          if (ret < 0 || job_is_cancelled(&s->common.job)) {
              goto immediate_exit;
-@@ -1212,6 +1226,7 @@ static const BlockJobDriver mirror_job_driver = {
+@@ -1224,6 +1238,7 @@ static const BlockJobDriver mirror_job_driver = {
          .run                    = mirror_run,
          .prepare                = mirror_prepare,
          .abort                  = mirror_abort,
@@ -102,7 +102,7 @@ index 3c4ab1159d..f2eca983f1 100644
          .pause                  = mirror_pause,
          .complete               = mirror_complete,
          .cancel                 = mirror_cancel,
-@@ -1228,6 +1243,7 @@ static const BlockJobDriver commit_active_job_driver = {
+@@ -1240,6 +1255,7 @@ static const BlockJobDriver commit_active_job_driver = {
          .run                    = mirror_run,
          .prepare                = mirror_prepare,
          .abort                  = mirror_abort,
@@ -110,7 +110,7 @@ index 3c4ab1159d..f2eca983f1 100644
          .pause                  = mirror_pause,
          .complete               = mirror_complete,
          .cancel                 = commit_active_cancel,
-@@ -1593,7 +1609,10 @@ static BlockJob *mirror_start_job(
+@@ -1627,7 +1643,10 @@ static BlockJob *mirror_start_job(
                               BlockCompletionFunc *cb,
                               void *opaque,
                               const BlockJobDriver *driver,
@@ -122,7 +122,7 @@ index 3c4ab1159d..f2eca983f1 100644
                               bool auto_complete, const char *filter_node_name,
                               bool is_mirror, MirrorCopyMode copy_mode,
                               Error **errp)
-@@ -1605,10 +1624,39 @@ static BlockJob *mirror_start_job(
+@@ -1639,10 +1658,39 @@ static BlockJob *mirror_start_job(
      uint64_t target_perms, target_shared_perms;
      int ret;
  
@@ -164,7 +164,7 @@ index 3c4ab1159d..f2eca983f1 100644
      assert(is_power_of_2(granularity));
  
      if (buf_size < 0) {
-@@ -1740,7 +1788,9 @@ static BlockJob *mirror_start_job(
+@@ -1774,7 +1822,9 @@ static BlockJob *mirror_start_job(
      s->replaces = g_strdup(replaces);
      s->on_source_error = on_source_error;
      s->on_target_error = on_target_error;
@@ -175,7 +175,7 @@ index 3c4ab1159d..f2eca983f1 100644
      s->backing_mode = backing_mode;
      s->zero_target = zero_target;
      s->copy_mode = copy_mode;
-@@ -1761,6 +1811,18 @@ static BlockJob *mirror_start_job(
+@@ -1795,6 +1845,18 @@ static BlockJob *mirror_start_job(
          bdrv_disable_dirty_bitmap(s->dirty_bitmap);
      }
  
@@ -194,7 +194,7 @@ index 3c4ab1159d..f2eca983f1 100644
      ret = block_job_add_bdrv(&s->common, "source", bs, 0,
                               BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
                               BLK_PERM_CONSISTENT_READ,
-@@ -1838,6 +1900,9 @@ fail:
+@@ -1872,6 +1934,9 @@ fail:
          if (s->dirty_bitmap) {
              bdrv_release_dirty_bitmap(s->dirty_bitmap);
          }
@@ -204,7 +204,7 @@ index 3c4ab1159d..f2eca983f1 100644
          job_early_fail(&s->common.job);
      }
  
-@@ -1855,31 +1920,25 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
+@@ -1889,31 +1954,25 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
                    BlockDriverState *target, const char *replaces,
                    int creation_flags, int64_t speed,
                    uint32_t granularity, int64_t buf_size,
@@ -241,7 +241,7 @@ index 3c4ab1159d..f2eca983f1 100644
  }
  
  BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
-@@ -1906,7 +1965,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
+@@ -1940,7 +1999,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
                       job_id, bs, creation_flags, base, NULL, speed, 0, 0,
                       MIRROR_LEAVE_BACKING_CHAIN, false,
                       on_error, on_error, true, cb, opaque,
@@ -252,10 +252,10 @@ index 3c4ab1159d..f2eca983f1 100644
                       errp);
      if (!job) {
 diff --git a/blockdev.c b/blockdev.c
-index 9230888e34..9a1a3118ed 100644
+index 3f1dec6242..2ee30323cb 100644
 --- a/blockdev.c
 +++ b/blockdev.c
-@@ -2951,6 +2951,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2946,6 +2946,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
                                     BlockDriverState *target,
                                     bool has_replaces, const char *replaces,
                                     enum MirrorSyncMode sync,
@@ -266,7 +266,7 @@ index 9230888e34..9a1a3118ed 100644
                                     BlockMirrorBackingMode backing_mode,
                                     bool zero_target,
                                     bool has_speed, int64_t speed,
-@@ -2970,6 +2974,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2965,6 +2969,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
  {
      BlockDriverState *unfiltered_bs;
      int job_flags = JOB_DEFAULT;
@@ -274,7 +274,7 @@ index 9230888e34..9a1a3118ed 100644
  
      if (!has_speed) {
          speed = 0;
-@@ -3024,6 +3029,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3019,6 +3024,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
          sync = MIRROR_SYNC_MODE_FULL;
      }
  
@@ -304,7 +304,7 @@ index 9230888e34..9a1a3118ed 100644
      if (!has_replaces) {
          /* We want to mirror from @bs, but keep implicit filters on top */
          unfiltered_bs = bdrv_skip_implicit_filters(bs);
-@@ -3070,8 +3098,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3065,8 +3093,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
       * and will allow to check whether the node still exist at mirror completion
       */
      mirror_start(job_id, bs, target,
@@ -315,7 +315,7 @@ index 9230888e34..9a1a3118ed 100644
                   on_source_error, on_target_error, unmap, filter_node_name,
                   copy_mode, errp);
  }
-@@ -3216,6 +3244,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
+@@ -3211,6 +3239,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
  
      blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
                             arg->has_replaces, arg->replaces, arg->sync,
@@ -324,7 +324,7 @@ index 9230888e34..9a1a3118ed 100644
                             backing_mode, zero_target,
                             arg->has_speed, arg->speed,
                             arg->has_granularity, arg->granularity,
-@@ -3237,6 +3267,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
+@@ -3232,6 +3262,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
                           const char *device, const char *target,
                           bool has_replaces, const char *replaces,
                           MirrorSyncMode sync,
@@ -333,7 +333,7 @@ index 9230888e34..9a1a3118ed 100644
                           bool has_speed, int64_t speed,
                           bool has_granularity, uint32_t granularity,
                           bool has_buf_size, int64_t buf_size,
-@@ -3286,7 +3318,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
+@@ -3281,7 +3313,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
      }
  
      blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs,
@@ -359,7 +359,7 @@ index b49f4eb35b..9d744db618 100644
                    BlockdevOnError on_source_error,
                    BlockdevOnError on_target_error,
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 2173e7734a..e1857e7094 100644
+index 95ac4fa634..7daaf545be 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -2000,10 +2000,19 @@
@@ -426,10 +426,10 @@ index 2173e7734a..e1857e7094 100644
              '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
              '*on-target-error': 'BlockdevOnError',
 diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
-index 8b55eccc89..f4650be8e5 100644
+index 8ca5adec5e..dae80e5a5f 100644
 --- a/tests/unit/test-block-iothread.c
 +++ b/tests/unit/test-block-iothread.c
-@@ -753,8 +753,8 @@ static void test_propagate_mirror(void)
+@@ -755,8 +755,8 @@ static void test_propagate_mirror(void)
  
      /* Start a mirror job */
      mirror_start("job0", src, target, NULL, JOB_DEFAULT, 0, 0, 0,
@@ -439,4 +439,4 @@ index 8b55eccc89..f4650be8e5 100644
 +                 false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
                   false, "filter_node", MIRROR_COPY_MODE_BACKGROUND,
                   &error_abort);
-     job = job_get("job0");
+     WITH_JOB_LOCK_GUARD() {
index 8c01d80d5df1c2c98af59e5c0c9140f4f0e8501d..d8041ca770bf791c20c18cf3356400053ba124c7 100644 (file)
@@ -24,10 +24,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 18 insertions(+), 6 deletions(-)
 
 diff --git a/block/mirror.c b/block/mirror.c
-index f2eca983f1..b6475d50ad 100644
+index 8ead5f77a0..35c1b8f25d 100644
 --- a/block/mirror.c
 +++ b/block/mirror.c
-@@ -673,8 +673,6 @@ static int mirror_exit_common(Job *job)
+@@ -676,8 +676,6 @@ static int mirror_exit_common(Job *job)
          bdrv_unfreeze_backing_chain(mirror_top_bs, target_bs);
      }
  
@@ -36,7 +36,7 @@ index f2eca983f1..b6475d50ad 100644
      /* Make sure that the source BDS doesn't go away during bdrv_replace_node,
       * before we can call bdrv_drained_end */
      bdrv_ref(src);
-@@ -775,6 +773,18 @@ static int mirror_exit_common(Job *job)
+@@ -778,6 +776,18 @@ static int mirror_exit_common(Job *job)
      block_job_remove_all_bdrv(bjob);
      bdrv_replace_node(mirror_top_bs, mirror_top_bs->backing->bs, &error_abort);
  
@@ -55,7 +55,7 @@ index f2eca983f1..b6475d50ad 100644
      bs_opaque->job = NULL;
  
      bdrv_drained_end(src);
-@@ -1634,10 +1644,6 @@ static BlockJob *mirror_start_job(
+@@ -1668,10 +1678,6 @@ static BlockJob *mirror_start_job(
                         " sync mode",
                         MirrorSyncMode_str(sync_mode));
              return NULL;
@@ -66,7 +66,7 @@ index f2eca983f1..b6475d50ad 100644
          }
      } else if (bitmap) {
          error_setg(errp,
-@@ -1654,6 +1660,12 @@ static BlockJob *mirror_start_job(
+@@ -1688,6 +1694,12 @@ static BlockJob *mirror_start_job(
              return NULL;
          }
          granularity = bdrv_dirty_bitmap_granularity(bitmap);
index 2fac2cafa1239c52511ed815cf303398339361d1..c6a07103818f0e52b6913438896fc1efec8d4508 100644 (file)
@@ -16,10 +16,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 3 insertions(+)
 
 diff --git a/blockdev.c b/blockdev.c
-index 9a1a3118ed..a57b0af2e7 100644
+index 2ee30323cb..dd1c2cdef7 100644
 --- a/blockdev.c
 +++ b/blockdev.c
-@@ -3050,6 +3050,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3045,6 +3045,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
          if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
              return;
          }
index 4d5f62ab20b51dbe80da9f7ad66eea3a5ad45e7e..11f4dc3c187e2f01f511038ea422c837234a1fe5 100644 (file)
@@ -16,10 +16,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 4 insertions(+), 7 deletions(-)
 
 diff --git a/block/mirror.c b/block/mirror.c
-index b6475d50ad..8b3342f9ec 100644
+index 35c1b8f25d..4969c6833c 100644
 --- a/block/mirror.c
 +++ b/block/mirror.c
-@@ -779,8 +779,8 @@ static int mirror_exit_common(Job *job)
+@@ -782,8 +782,8 @@ static int mirror_exit_common(Job *job)
               job->ret == 0 && ret == 0)) {
              /* Success; synchronize copy back to sync. */
              bdrv_clear_dirty_bitmap(s->sync_bitmap, NULL);
@@ -30,7 +30,7 @@ index b6475d50ad..8b3342f9ec 100644
          }
      }
      bdrv_release_dirty_bitmap(s->dirty_bitmap);
-@@ -1828,11 +1828,8 @@ static BlockJob *mirror_start_job(
+@@ -1862,11 +1862,8 @@ static BlockJob *mirror_start_job(
      }
  
      if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
index 336efbe90afd9cef8578e1407bb8730fa9809657..4771a2d937a17a83e2fcbd6ca82178b46f5165e2 100644 (file)
@@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  3 files changed, 70 insertions(+), 59 deletions(-)
 
 diff --git a/block/mirror.c b/block/mirror.c
-index 8b3342f9ec..1d4ff0efad 100644
+index 4969c6833c..cf85ae1074 100644
 --- a/block/mirror.c
 +++ b/block/mirror.c
-@@ -1634,31 +1634,13 @@ static BlockJob *mirror_start_job(
+@@ -1668,31 +1668,13 @@ static BlockJob *mirror_start_job(
      uint64_t target_perms, target_shared_perms;
      int ret;
  
@@ -60,10 +60,10 @@ index 8b3342f9ec..1d4ff0efad 100644
  
          if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) {
 diff --git a/blockdev.c b/blockdev.c
-index a57b0af2e7..ce62a9b439 100644
+index dd1c2cdef7..756e980889 100644
 --- a/blockdev.c
 +++ b/blockdev.c
-@@ -3029,7 +3029,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3024,7 +3024,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
          sync = MIRROR_SYNC_MODE_FULL;
      }
  
index cd72a8e6d0d848c8fca97659b279c404b064c9cd..4796631e66243c89c9de95e8308e8c882977d6ff 100644 (file)
@@ -48,7 +48,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  6 files changed, 59 insertions(+), 5 deletions(-)
 
 diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
-index a4b40e8391..d64ae8f34e 100644
+index 737e750670..38804b8595 100644
 --- a/include/monitor/monitor.h
 +++ b/include/monitor/monitor.h
 @@ -16,6 +16,7 @@ extern QemuOptsList qemu_mon_opts;
@@ -60,7 +60,7 @@ index a4b40e8391..d64ae8f34e 100644
  void monitor_init_globals(void);
  void monitor_init_globals_core(void);
 diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
-index caa2e90ef2..e1596f79ab 100644
+index a2cdbbf646..b531bd50e7 100644
 --- a/monitor/monitor-internal.h
 +++ b/monitor/monitor-internal.h
 @@ -152,6 +152,13 @@ typedef struct {
diff --git a/debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch b/debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch
deleted file mode 100644 (file)
index 06d4b00..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Sam Li <faithilikerun@gmail.com>
-Date: Sat, 24 Sep 2022 22:48:15 +0800
-Subject: [PATCH] block/io_uring: revert "Use io_uring_register_ring_fd() to
- skip fd operations"
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1193
-
-The commit "Use io_uring_register_ring_fd() to skip fd operations" broke
-when booting a guest with iothread and io_uring. That is because the
-io_uring_register_ring_fd() call is made from the main thread instead of
-IOThread where io_uring_submit() is called. It can not be guaranteed
-to register the ring fd in the correct thread or unregister the same ring
-fd if the IOThread is disabled. This optimization is not critical so we
-will revert previous commit.
-
-This reverts commit e2848bc574fe2715c694bf8fe9a1ba7f78a1125a
-and 77e3f038af1764983087e3551a0fde9951952c4d.
-
-Signed-off-by: Sam Li <faithilikerun@gmail.com>
----
- block/io_uring.c | 13 +------------
- meson.build      |  1 -
- 2 files changed, 1 insertion(+), 13 deletions(-)
-
-diff --git a/block/io_uring.c b/block/io_uring.c
-index a1760152e0..973e15d876 100644
---- a/block/io_uring.c
-+++ b/block/io_uring.c
-@@ -11,7 +11,6 @@
- #include "qemu/osdep.h"
- #include <liburing.h>
- #include "block/aio.h"
--#include "qemu/error-report.h"
- #include "qemu/queue.h"
- #include "block/block.h"
- #include "block/raw-aio.h"
-@@ -19,7 +18,6 @@
- #include "qapi/error.h"
- #include "trace.h"
--
- /* io_uring ring size */
- #define MAX_ENTRIES 128
-@@ -432,17 +430,8 @@ LuringState *luring_init(Error **errp)
-     }
-     ioq_init(&s->io_q);
--#ifdef CONFIG_LIBURING_REGISTER_RING_FD
--    if (io_uring_register_ring_fd(&s->ring) < 0) {
--        /*
--         * Only warn about this error: we will fallback to the non-optimized
--         * io_uring operations.
--         */
--        warn_report("failed to register linux io_uring ring file descriptor");
--    }
--#endif
--
-     return s;
-+
- }
- void luring_cleanup(LuringState *s)
-diff --git a/meson.build b/meson.build
-index 20fddbd707..d5230eadd6 100644
---- a/meson.build
-+++ b/meson.build
-@@ -1793,7 +1793,6 @@ config_host_data.set('CONFIG_LIBNFS', libnfs.found())
- config_host_data.set('CONFIG_LIBSSH', libssh.found())
- config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
- config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
--config_host_data.set('CONFIG_LIBURING_REGISTER_RING_FD', cc.has_function('io_uring_register_ring_fd', prefix: '#include <liburing.h>', dependencies:linux_io_uring))
- config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
- config_host_data.set('CONFIG_NUMA', numa.found())
- config_host_data.set('CONFIG_OPENGL', opengl.found())
diff --git a/debian/patches/extra/0002-init-daemonize-defuse-PID-file-resolve-error.patch b/debian/patches/extra/0002-init-daemonize-defuse-PID-file-resolve-error.patch
new file mode 100644 (file)
index 0000000..155d065
--- /dev/null
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Fiona Ebner <f.ebner@proxmox.com>
+Date: Fri, 28 Oct 2022 10:09:46 +0200
+Subject: [PATCH] init: daemonize: defuse PID file resolve error
+
+When proxmox-file-restore invokes QEMU, the PID file is a (temporary)
+file that's already unlinked, so resolving the absolute path here
+failed.
+
+It should not be a critical error when the PID file unlink handler
+can't be registered, because the path can't be resolved for whatever
+reason. If the file is already gone from QEMU's perspective (i.e.
+errno is ENOENT), silently ignore the error. Otherwise, print a
+warning.
+
+Reported-by: Dominik Csapak <d.csapak@proxmox.com>
+Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
+---
+ softmmu/vl.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/softmmu/vl.c b/softmmu/vl.c
+index 5115221efe..5f7f6ca981 100644
+--- a/softmmu/vl.c
++++ b/softmmu/vl.c
+@@ -2460,10 +2460,11 @@ static void qemu_maybe_daemonize(const char *pid_file)
+         pid_file_realpath = g_malloc0(PATH_MAX);
+         if (!realpath(pid_file, pid_file_realpath)) {
+-            error_report("cannot resolve PID file path: %s: %s",
+-                         pid_file, strerror(errno));
+-            unlink(pid_file);
+-            exit(1);
++            if (errno != ENOENT) {
++                warn_report("not removing PID file on exit: cannot resolve PID "
++                            "file path: %s: %s", pid_file, strerror(errno));
++            }
++            return;
+         }
+         qemu_unlink_pidfile_notifier = (struct UnlinkPidfileNotifier) {
diff --git a/debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch b/debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch
deleted file mode 100644 (file)
index 87c73d7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Yusuke Okada <okada.yusuke@jp.fujitsu.com>
-Date: Thu, 18 Aug 2022 14:46:19 -0400
-Subject: [PATCH] virtiofsd: use g_date_time_get_microsecond to get subsecond
-
-The "%f" specifier in g_date_time_format() is only available in glib
-2.65.2 or later. If combined with older glib, the function returns null
-and the timestamp displayed as "(null)".
-
-For backward compatibility, g_date_time_get_microsecond should be used
-to retrieve subsecond.
-
-In this patch the g_date_time_format() leaves subsecond field as "%06d"
-and let next snprintf to format with g_date_time_get_microsecond.
-
-Signed-off-by: Yusuke Okada <okada.yusuke@jp.fujitsu.com>
-Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Message-id: 20220818184618.2205172-1-yokada.996@gmail.com
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry-picked from commit f16d15c9276bd8f501f861c39cbd4adc812d0c1d)
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
----
- tools/virtiofsd/passthrough_ll.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
-index 371a7bead6..20f0f41f99 100644
---- a/tools/virtiofsd/passthrough_ll.c
-+++ b/tools/virtiofsd/passthrough_ll.c
-@@ -4185,6 +4185,7 @@ static void setup_nofile_rlimit(unsigned long rlimit_nofile)
- static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
- {
-     g_autofree char *localfmt = NULL;
-+    char buf[64];
-     if (current_log_level < level) {
-         return;
-@@ -4197,9 +4198,11 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
-                                        fmt);
-         } else {
-             g_autoptr(GDateTime) now = g_date_time_new_now_utc();
--            g_autofree char *nowstr = g_date_time_format(now, "%Y-%m-%d %H:%M:%S.%f%z");
-+            g_autofree char *nowstr = g_date_time_format(now,
-+                                       "%Y-%m-%d %H:%M:%S.%%06d%z");
-+            snprintf(buf, 64, nowstr, g_date_time_get_microsecond(now));
-             localfmt = g_strdup_printf("[%s] [ID: %08ld] %s",
--                                       nowstr, syscall(__NR_gettid), fmt);
-+                                       buf, syscall(__NR_gettid), fmt);
-         }
-         fmt = localfmt;
-     }
diff --git a/debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch b/debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch
deleted file mode 100644 (file)
index a2cb635..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Maksim Davydov <davydov-max@yandex-team.ru>
-Date: Thu, 25 Aug 2022 19:52:47 +0300
-Subject: [PATCH] chardev: fix segfault in finalize
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-If finalize chardev-msmouse or chardev-wctable is called immediately after
-init it cases QEMU to crash with segfault. This happens because of
-QTAILQ_REMOVE in qemu_input_handler_unregister tries to dereference
-NULL pointer.
-For instance, this error can be reproduced via `qom-list-properties`
-command.
-
-Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Message-Id: <20220825165247.33704-1-davydov-max@yandex-team.ru>
-(trivial backport from fc0c128531ed55f058bfbad4f1348ebd9a0187f2)
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
----
- chardev/msmouse.c  | 4 +++-
- chardev/wctablet.c | 4 +++-
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/chardev/msmouse.c b/chardev/msmouse.c
-index eb9231dcdb..2cc1b16561 100644
---- a/chardev/msmouse.c
-+++ b/chardev/msmouse.c
-@@ -146,7 +146,9 @@ static void char_msmouse_finalize(Object *obj)
- {
-     MouseChardev *mouse = MOUSE_CHARDEV(obj);
--    qemu_input_handler_unregister(mouse->hs);
-+    if (mouse->hs) {
-+        qemu_input_handler_unregister(mouse->hs);
-+    }
- }
- static QemuInputHandler msmouse_handler = {
-diff --git a/chardev/wctablet.c b/chardev/wctablet.c
-index e8b292c43c..43bdf6b608 100644
---- a/chardev/wctablet.c
-+++ b/chardev/wctablet.c
-@@ -319,7 +319,9 @@ static void wctablet_chr_finalize(Object *obj)
- {
-     TabletChardev *tablet = WCTABLET_CHARDEV(obj);
--    qemu_input_handler_unregister(tablet->hs);
-+    if (tablet->hs) {
-+        qemu_input_handler_unregister(tablet->hs);
-+    }
- }
- static void wctablet_chr_open(Chardev *chr,
diff --git a/debian/patches/extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch b/debian/patches/extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch
deleted file mode 100644 (file)
index 49890a2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Fiona Ebner <f.ebner@proxmox.com>
-Date: Fri, 28 Oct 2022 10:09:46 +0200
-Subject: [PATCH] init: daemonize: defuse PID file resolve error
-
-When proxmox-file-restore invokes QEMU, the PID file is a (temporary)
-file that's already unlinked, so resolving the absolute path here
-failed.
-
-It should not be a critical error when the PID file unlink handler
-can't be registered, because the path can't be resolved for whatever
-reason. If the file is already gone from QEMU's perspective (i.e.
-errno is ENOENT), silently ignore the error. Otherwise, print a
-warning.
-
-Reported-by: Dominik Csapak <d.csapak@proxmox.com>
-Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
----
- softmmu/vl.c | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 706bd7cff7..3381c56af7 100644
---- a/softmmu/vl.c
-+++ b/softmmu/vl.c
-@@ -2438,10 +2438,11 @@ static void qemu_maybe_daemonize(const char *pid_file)
-         pid_file_realpath = g_malloc0(PATH_MAX);
-         if (!realpath(pid_file, pid_file_realpath)) {
--            error_report("cannot resolve PID file path: %s: %s",
--                         pid_file, strerror(errno));
--            unlink(pid_file);
--            exit(1);
-+            if (errno != ENOENT) {
-+                warn_report("not removing PID file on exit: cannot resolve PID "
-+                            "file path: %s: %s", pid_file, strerror(errno));
-+            }
-+            return;
-         }
-         qemu_unlink_pidfile_notifier = (struct UnlinkPidfileNotifier) {
diff --git a/debian/patches/extra/0006-block-block-backend-blk_set_enable_write_cache-is-IO.patch b/debian/patches/extra/0006-block-block-backend-blk_set_enable_write_cache-is-IO.patch
deleted file mode 100644 (file)
index c1d8184..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
-Date: Thu, 27 Oct 2022 03:27:26 -0400
-Subject: [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE
-
-blk_set_enable_write_cache() is defined as GLOBAL_STATE_CODE
-but can be invoked from iothreads when handling scsi requests.
-This triggers an assertion failure:
-
- 0x00007fd6c3515ce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
- 0x00007fd6c34ff537 in abort () from /lib/x86_64-linux-gnu/libc.so.6
- 0x00007fd6c34ff40f in ?? () from /lib/x86_64-linux-gnu/libc.so.6
- 0x00007fd6c350e662 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
- 0x000056149e2cea03 in blk_set_enable_write_cache (wce=true, blk=0x5614a01c27f0)
-   at ../src/block/block-backend.c:1949
- 0x000056149e2d0a67 in blk_set_enable_write_cache (blk=0x5614a01c27f0,
-   wce=<optimized out>) at ../src/block/block-backend.c:1951
- 0x000056149dfe9c59 in scsi_disk_apply_mode_select (p=0x7fd6b400c00e "\004",
-   page=<optimized out>, s=<optimized out>) at ../src/hw/scsi/scsi-disk.c:1520
- mode_select_pages (change=true, len=18, p=0x7fd6b400c00e "\004", r=0x7fd6b4001ff0)
-   at ../src/hw/scsi/scsi-disk.c:1570
- scsi_disk_emulate_mode_select (inbuf=<optimized out>, r=0x7fd6b4001ff0) at
-   ../src/hw/scsi/scsi-disk.c:1640
- scsi_disk_emulate_write_data (req=0x7fd6b4001ff0) at ../src/hw/scsi/scsi-disk.c:1934
- 0x000056149e18ff16 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>,
-   req=<optimized out>, s=0x5614a12f16b0) at ../src/hw/scsi/virtio-scsi.c:719
- virtio_scsi_handle_cmd_vq (vq=0x7fd6bab92140, s=0x5614a12f16b0) at
-   ../src/hw/scsi/virtio-scsi.c:761
- virtio_scsi_handle_cmd (vq=<optimized out>, vdev=<optimized out>) at
-   ../src/hw/scsi/virtio-scsi.c:775
- virtio_scsi_handle_cmd (vdev=0x5614a12f16b0, vq=0x7fd6bab92140) at
-   ../src/hw/scsi/virtio-scsi.c:765
- 0x000056149e1a8aa6 in virtio_queue_notify_vq (vq=0x7fd6bab92140) at
-   ../src/hw/virtio/virtio.c:2365
- 0x000056149e3ccea5 in aio_dispatch_handler (ctx=ctx@entry=0x5614a01babe0,
-   node=<optimized out>) at ../src/util/aio-posix.c:369
- 0x000056149e3cd868 in aio_dispatch_ready_handlers (ready_list=0x7fd6c09b2680,
-   ctx=0x5614a01babe0) at ../src/util/aio-posix.c:399
- aio_poll (ctx=0x5614a01babe0, blocking=blocking@entry=true) at
-   ../src/util/aio-posix.c:713
- 0x000056149e2a7796 in iothread_run (opaque=opaque@entry=0x56149ffde500) at
-   ../src/iothread.c:67
- 0x000056149e3d0859 in qemu_thread_start (args=0x7fd6c09b26f0) at
-   ../src/util/qemu-thread-posix.c:504
- 0x00007fd6c36b9ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
- 0x00007fd6c35d9aef in clone () from /lib/x86_64-linux-gnu/libc.so.6
-
-Changing GLOBAL_STATE_CODE in IO_CODE is allowed, since GSC callers are
-allowed to call IO_CODE.
-
-Resolves: #1272
-
-Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
-Message-Id: <20221027072726.2681500-1-eesposit@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: Hanna Reitz <hreitz@redhat.com>
-Tested-by: Antoine Damhet <antoine.damhet@shadow.tech>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit be8da05b5ed8fb546731b9edb997f303f272bad8)
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
----
- block/block-backend.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/block/block-backend.c b/block/block-backend.c
-index d4a5df2ac2..1b563e628b 100644
---- a/block/block-backend.c
-+++ b/block/block-backend.c
-@@ -1946,7 +1946,7 @@ bool blk_enable_write_cache(BlockBackend *blk)
- void blk_set_enable_write_cache(BlockBackend *blk, bool wce)
- {
--    GLOBAL_STATE_CODE();
-+    IO_CODE();
-     blk->enable_write_cache = wce;
- }
index b21d8a7b2d4151759296a97b8e05f69349bd0d2c..20c6c1888840fed5d4188380314dbb6d9203b0dd 100644 (file)
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/block/file-posix.c b/block/file-posix.c
-index 48cd096624..3d60b80286 100644
+index b9647c5ffc..9a16d86344 100644
 --- a/block/file-posix.c
 +++ b/block/file-posix.c
-@@ -553,7 +553,7 @@ static QemuOptsList raw_runtime_opts = {
+@@ -552,7 +552,7 @@ static QemuOptsList raw_runtime_opts = {
          {
              .name = "locking",
              .type = QEMU_OPT_STRING,
@@ -26,7 +26,7 @@ index 48cd096624..3d60b80286 100644
          },
          {
              .name = "pr-manager",
-@@ -653,7 +653,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
+@@ -652,7 +652,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
          s->use_lock = false;
          break;
      case ON_OFF_AUTO_AUTO:
index 9647ea51da5ba5240187ea728382cb6b77a5b9e1..d43d40aca91fc49913e90f97209a399fb8cc3e9f 100644 (file)
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/include/net/net.h b/include/net/net.h
-index 523136c7ac..c27859b4f6 100644
+index dc20b31e9f..5ae04a8693 100644
 --- a/include/net/net.h
 +++ b/include/net/net.h
-@@ -226,8 +226,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
+@@ -236,8 +236,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
  int net_hub_id_for_client(NetClientState *nc, int *id);
  NetClientState *net_hub_port_find(int hub_id);
  
index 018409708bccb775478bb9243335cdd98bf59093..0871fc789b1276115167e1978e966ccad663af54 100644 (file)
@@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/target/i386/cpu.h b/target/i386/cpu.h
-index 82004b65b9..4868db8f94 100644
+index d4bc19577a..be7da64f38 100644
 --- a/target/i386/cpu.h
 +++ b/target/i386/cpu.h
-@@ -2133,9 +2133,9 @@ uint64_t cpu_get_tsc(CPUX86State *env);
+@@ -2174,9 +2174,9 @@ uint64_t cpu_get_tsc(CPUX86State *env);
  #define CPU_RESOLVING_TYPE TYPE_X86_CPU
  
  #ifdef TARGET_X86_64
index 08903694928aff4375077698534c793342cae05d..6c3e28133b906c6e3c988ee6ce6cea667da8cdb9 100644 (file)
@@ -9,7 +9,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 11 insertions(+), 4 deletions(-)
 
 diff --git a/block/gluster.c b/block/gluster.c
-index b60213ab80..93da76bc31 100644
+index 7c90f7ba4b..2e03102f00 100644
 --- a/block/gluster.c
 +++ b/block/gluster.c
 @@ -42,7 +42,7 @@
index cd90b46af733d6f66a0b6afdbd2dec27cf014a27..1e2ac12971c0bc2612051647893d3e257cbc4219 100644 (file)
@@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  3 files changed, 43 insertions(+)
 
 diff --git a/net/net.c b/net/net.c
-index 2db160e063..8329347891 100644
+index 840ad9dca5..28e97c5d85 100644
 --- a/net/net.c
 +++ b/net/net.c
-@@ -1343,6 +1343,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
+@@ -1372,6 +1372,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
      }
  }
  
@@ -49,10 +49,10 @@ index 2db160e063..8329347891 100644
  {
      NetClientState *nc;
 diff --git a/qapi/net.json b/qapi/net.json
-index 75ba2cb989..a3c93ab88f 100644
+index 522ac582ed..327d7c5a37 100644
 --- a/qapi/net.json
 +++ b/qapi/net.json
-@@ -35,6 +35,21 @@
+@@ -36,6 +36,21 @@
  ##
  { 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }
  
index 88becc5988f0e2b669b3595e7c40b5ee0906792a..5c731aa1ab71281808996aaf992d270c195f1878 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 9 insertions(+), 1 deletion(-)
 
 diff --git a/block/gluster.c b/block/gluster.c
-index 93da76bc31..1079b6186b 100644
+index 2e03102f00..7886c5fe8c 100644
 --- a/block/gluster.c
 +++ b/block/gluster.c
 @@ -57,6 +57,7 @@ typedef struct GlusterAIOCB {
@@ -59,7 +59,7 @@ index 93da76bc31..1079b6186b 100644
          ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0,
                                  gluster_finish_aiocb, &acb);
      }
-@@ -1269,6 +1275,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
+@@ -1268,6 +1274,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
      acb.ret = 0;
      acb.coroutine = qemu_coroutine_self();
      acb.aio_context = bdrv_get_aio_context(bs);
@@ -67,7 +67,7 @@ index 93da76bc31..1079b6186b 100644
  
      ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
      if (ret < 0) {
-@@ -1317,6 +1324,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
+@@ -1316,6 +1323,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
      acb.ret = 0;
      acb.coroutine = qemu_coroutine_self();
      acb.aio_context = bdrv_get_aio_context(bs);
index b2a27d8b2525b0a78e1ba5c75da79204d6f1f460..7c2e8bacb9f5ac14d473bc78a8cabb7a300f8973 100644 (file)
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/qemu-img.c b/qemu-img.c
-index 7d4b33b3da..bb36f42dd2 100644
+index a9b3a8103c..0bc9f1af59 100644
 --- a/qemu-img.c
 +++ b/qemu-img.c
-@@ -3010,7 +3010,8 @@ static int img_info(int argc, char **argv)
+@@ -3013,7 +3013,8 @@ static int img_info(int argc, char **argv)
      list = collect_image_info_list(image_opts, filename, fmt, chain,
                                     force_share);
      if (!list) {
index bed5c250b189de9f8088c3925601299c37f852b6..fb6581b4aacddcb15f692c4c062047af0a3de06c 100644 (file)
@@ -54,10 +54,10 @@ index 1b1dab5b17..d1616c045a 100644
  
  DEF("info", img_info,
 diff --git a/qemu-img.c b/qemu-img.c
-index bb36f42dd2..74afcb79ef 100644
+index 0bc9f1af59..221b9d6a16 100644
 --- a/qemu-img.c
 +++ b/qemu-img.c
-@@ -4826,10 +4826,12 @@ static int img_bitmap(int argc, char **argv)
+@@ -4829,10 +4829,12 @@ static int img_bitmap(int argc, char **argv)
  #define C_IF      04
  #define C_OF      010
  #define C_SKIP    020
@@ -70,7 +70,7 @@ index bb36f42dd2..74afcb79ef 100644
  };
  
  struct DdIo {
-@@ -4905,6 +4907,19 @@ static int img_dd_skip(const char *arg,
+@@ -4908,6 +4910,19 @@ static int img_dd_skip(const char *arg,
      return 0;
  }
  
@@ -90,7 +90,7 @@ index bb36f42dd2..74afcb79ef 100644
  static int img_dd(int argc, char **argv)
  {
      int ret = 0;
-@@ -4945,6 +4960,7 @@ static int img_dd(int argc, char **argv)
+@@ -4948,6 +4963,7 @@ static int img_dd(int argc, char **argv)
          { "if", img_dd_if, C_IF },
          { "of", img_dd_of, C_OF },
          { "skip", img_dd_skip, C_SKIP },
@@ -98,7 +98,7 @@ index bb36f42dd2..74afcb79ef 100644
          { NULL, NULL, 0 }
      };
      const struct option long_options[] = {
-@@ -5020,91 +5036,112 @@ static int img_dd(int argc, char **argv)
+@@ -5023,91 +5039,112 @@ static int img_dd(int argc, char **argv)
          arg = NULL;
      }
  
@@ -275,10 +275,10 @@ index bb36f42dd2..74afcb79ef 100644
      }
  
      if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
-@@ -5121,20 +5158,43 @@ static int img_dd(int argc, char **argv)
+@@ -5124,20 +5161,43 @@ static int img_dd(int argc, char **argv)
      in.buf = g_new(uint8_t, in.bsz);
  
-     for (out_pos = 0; in_pos < size; block_count++) {
+     for (out_pos = 0; in_pos < size; ) {
 +        int in_ret, out_ret;
          int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
 -
index f367a537d7b72ee213535360af6d9b76dcdd7445..217b83b1ae97caa74297baa157e6ddb16d2abc9c 100644 (file)
@@ -16,10 +16,10 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
  1 file changed, 25 insertions(+), 3 deletions(-)
 
 diff --git a/qemu-img.c b/qemu-img.c
-index 74afcb79ef..14594d44b6 100644
+index 221b9d6a16..c1306385a8 100644
 --- a/qemu-img.c
 +++ b/qemu-img.c
-@@ -4827,11 +4827,13 @@ static int img_bitmap(int argc, char **argv)
+@@ -4830,11 +4830,13 @@ static int img_bitmap(int argc, char **argv)
  #define C_OF      010
  #define C_SKIP    020
  #define C_OSIZE   040
@@ -33,7 +33,7 @@ index 74afcb79ef..14594d44b6 100644
  };
  
  struct DdIo {
-@@ -4920,6 +4922,19 @@ static int img_dd_osize(const char *arg,
+@@ -4923,6 +4925,19 @@ static int img_dd_osize(const char *arg,
      return 0;
  }
  
@@ -53,13 +53,13 @@ index 74afcb79ef..14594d44b6 100644
  static int img_dd(int argc, char **argv)
  {
      int ret = 0;
-@@ -4934,12 +4949,14 @@ static int img_dd(int argc, char **argv)
+@@ -4937,12 +4952,14 @@ static int img_dd(int argc, char **argv)
      int c, i;
      const char *out_fmt = "raw";
      const char *fmt = NULL;
 -    int64_t size = 0;
 +    int64_t size = 0, readsize = 0;
-     int64_t block_count = 0, out_pos, in_pos;
+     int64_t out_pos, in_pos;
      bool force_share = false;
      struct DdInfo dd = {
          .flags = 0,
@@ -69,7 +69,7 @@ index 74afcb79ef..14594d44b6 100644
      };
      struct DdIo in = {
          .bsz = 512, /* Block size is by default 512 bytes */
-@@ -4961,6 +4978,7 @@ static int img_dd(int argc, char **argv)
+@@ -4964,6 +4981,7 @@ static int img_dd(int argc, char **argv)
          { "of", img_dd_of, C_OF },
          { "skip", img_dd_skip, C_SKIP },
          { "osize", img_dd_osize, C_OSIZE },
@@ -77,20 +77,20 @@ index 74afcb79ef..14594d44b6 100644
          { NULL, NULL, 0 }
      };
      const struct option long_options[] = {
-@@ -5157,9 +5175,10 @@ static int img_dd(int argc, char **argv)
+@@ -5160,9 +5178,10 @@ static int img_dd(int argc, char **argv)
  
      in.buf = g_new(uint8_t, in.bsz);
  
--    for (out_pos = 0; in_pos < size; block_count++) {
+-    for (out_pos = 0; in_pos < size; ) {
 +    readsize = (dd.isize > 0) ? dd.isize : size;
-+    for (out_pos = 0; in_pos < readsize; block_count++) {
++    for (out_pos = 0; in_pos < readsize; ) {
          int in_ret, out_ret;
 -        int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
 +        int bytes = (in_pos + in.bsz > readsize) ? readsize - in_pos : in.bsz;
          if (blk1) {
              in_ret = blk_pread(blk1, in_pos, bytes, in.buf, 0);
              if (in_ret == 0) {
-@@ -5168,6 +5187,9 @@ static int img_dd(int argc, char **argv)
+@@ -5171,6 +5190,9 @@ static int img_dd(int argc, char **argv)
          } else {
              in_ret = read(STDIN_FILENO, in.buf, bytes);
              if (in_ret == 0) {
index f24932d16e12d961533dafbf454d28a87ea77f9b..db8a5c59bb61de09733e439e5a20e597c43cc0f5 100644 (file)
@@ -5,7 +5,7 @@ Subject: [PATCH] PVE: [Up] qemu-img dd: add -n skip_create
 
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 [FE: fix getopt-string + add documentation]
-Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 ---
  docs/tools/qemu-img.rst | 11 ++++++++++-
  qemu-img-cmds.hx        |  4 ++--
@@ -13,7 +13,7 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
  3 files changed, 26 insertions(+), 12 deletions(-)
 
 diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
-index 85a6e05b35..699229eef6 100644
+index 15aeddc6d8..5e713e231d 100644
 --- a/docs/tools/qemu-img.rst
 +++ b/docs/tools/qemu-img.rst
 @@ -208,6 +208,10 @@ Parameters to convert subcommand:
@@ -65,19 +65,19 @@ index d1616c045a..b5b0bb4467 100644
  
  DEF("info", img_info,
 diff --git a/qemu-img.c b/qemu-img.c
-index 14594d44b6..c6b4a5567d 100644
+index c1306385a8..59c403373b 100644
 --- a/qemu-img.c
 +++ b/qemu-img.c
-@@ -4951,7 +4951,7 @@ static int img_dd(int argc, char **argv)
+@@ -4954,7 +4954,7 @@ static int img_dd(int argc, char **argv)
      const char *fmt = NULL;
      int64_t size = 0, readsize = 0;
-     int64_t block_count = 0, out_pos, in_pos;
+     int64_t out_pos, in_pos;
 -    bool force_share = false;
 +    bool force_share = false, skip_create = false;
      struct DdInfo dd = {
          .flags = 0,
          .count = 0,
-@@ -4989,7 +4989,7 @@ static int img_dd(int argc, char **argv)
+@@ -4992,7 +4992,7 @@ static int img_dd(int argc, char **argv)
          { 0, 0, 0, 0 }
      };
  
@@ -86,7 +86,7 @@ index 14594d44b6..c6b4a5567d 100644
          if (c == EOF) {
              break;
          }
-@@ -5009,6 +5009,9 @@ static int img_dd(int argc, char **argv)
+@@ -5012,6 +5012,9 @@ static int img_dd(int argc, char **argv)
          case 'h':
              help();
              break;
@@ -96,7 +96,7 @@ index 14594d44b6..c6b4a5567d 100644
          case 'U':
              force_share = true;
              break;
-@@ -5139,13 +5142,15 @@ static int img_dd(int argc, char **argv)
+@@ -5142,13 +5145,15 @@ static int img_dd(int argc, char **argv)
                                  size - in.bsz * in.offset, &error_abort);
          }
  
index 12beef5adfa3736bf6c251514897702c691dfba6..35819c4517303b5051c106ce71320963b82563a1 100644 (file)
@@ -58,10 +58,10 @@ index 73ac5eb675..bbfe7eca62 100644
  
  static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index c6cd6f91dd..15572befb1 100644
+index 01b789a79e..480b798963 100644
 --- a/monitor/hmp-cmds.c
 +++ b/monitor/hmp-cmds.c
-@@ -715,7 +715,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
+@@ -696,7 +696,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
          return;
      }
  
@@ -99,7 +99,7 @@ index c6cd6f91dd..15572befb1 100644
      qapi_free_BalloonInfo(info);
  }
 diff --git a/qapi/machine.json b/qapi/machine.json
-index 6afd1936b0..8b4be9b718 100644
+index b9228a5e46..10e77a9af3 100644
 --- a/qapi/machine.json
 +++ b/qapi/machine.json
 @@ -1054,9 +1054,29 @@
index cc3c92ea0c7984c1a2fe64d8cf2986b7d9583640..0b7c4cf008b1750bab457dcec5528651132922ef 100644 (file)
@@ -30,7 +30,7 @@ index 4f4ab30f8c..76fff60a6b 100644
              info->default_cpu_type = g_strdup(mc->default_cpu_type);
              info->has_default_cpu_type = true;
 diff --git a/qapi/machine.json b/qapi/machine.json
-index 8b4be9b718..555458f785 100644
+index 10e77a9af3..9156103c8f 100644
 --- a/qapi/machine.json
 +++ b/qapi/machine.json
 @@ -138,6 +138,8 @@
index c3f3fc33a0c768cea038cfa4077928b36e2edba9..5e15d9e6fe478b5301552c5e232d86f410ff84df 100644 (file)
@@ -12,7 +12,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  2 files changed, 8 insertions(+)
 
 diff --git a/qapi/ui.json b/qapi/ui.json
-index cf58ab4283..0be2388941 100644
+index 0abba3e930..bf8f441227 100644
 --- a/qapi/ui.json
 +++ b/qapi/ui.json
 @@ -310,11 +310,14 @@
index 833298d25d294099f437cdebf72a14a8fad726a7..4b8cf7b701deb39d12b51467101b13362a447ed8 100644 (file)
@@ -42,10 +42,10 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
  create mode 100644 migration/savevm-async.c
 
 diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index 188d9ece3b..97b88eaaad 100644
+index 754b1e8408..489c524e9e 100644
 --- a/hmp-commands-info.hx
 +++ b/hmp-commands-info.hx
-@@ -538,6 +538,19 @@ SRST
+@@ -540,6 +540,19 @@ SRST
      Show current migration parameters.
  ERST
  
@@ -66,13 +66,13 @@ index 188d9ece3b..97b88eaaad 100644
          .name       = "balloon",
          .args_type  = "",
 diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 182e639d14..bbcc73e942 100644
+index 673e39a697..039be0033d 100644
 --- a/hmp-commands.hx
 +++ b/hmp-commands.hx
-@@ -1800,3 +1800,36 @@ ERST
-                       "\n\t\t\t\t\t limit on a specified virtual cpu",
-         .cmd        = hmp_cancel_vcpu_dirty_limit,
-     },
+@@ -1815,3 +1815,36 @@ SRST
+   Dump the FDT in dtb format to *filename*.
+ ERST
+ #endif
 +
 +    {
 +        .name       = "savevm-start",
@@ -118,10 +118,10 @@ index e72083b117..c846d37806 100644
 +
  #endif
 diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index a618eb1e4e..55067beff1 100644
+index dfbc0c9a2f..440f86aba8 100644
 --- a/include/monitor/hmp.h
 +++ b/include/monitor/hmp.h
-@@ -26,6 +26,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
+@@ -27,6 +27,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
  void hmp_info_uuid(Monitor *mon, const QDict *qdict);
  void hmp_info_chardev(Monitor *mon, const QDict *qdict);
  void hmp_info_mice(Monitor *mon, const QDict *qdict);
@@ -129,7 +129,7 @@ index a618eb1e4e..55067beff1 100644
  void hmp_info_migrate(Monitor *mon, const QDict *qdict);
  void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
  void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
-@@ -80,6 +81,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
+@@ -81,6 +82,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
  void hmp_netdev_del(Monitor *mon, const QDict *qdict);
  void hmp_getfd(Monitor *mon, const QDict *qdict);
  void hmp_closefd(Monitor *mon, const QDict *qdict);
@@ -138,7 +138,7 @@ index a618eb1e4e..55067beff1 100644
 +void hmp_delete_drive_snapshot(Monitor *mon, const QDict *qdict);
 +void hmp_savevm_end(Monitor *mon, const QDict *qdict);
  void hmp_sendkey(Monitor *mon, const QDict *qdict);
- void hmp_screendump(Monitor *mon, const QDict *qdict);
+ void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict);
  void hmp_chardev_add(Monitor *mon, const QDict *qdict);
 diff --git a/migration/meson.build b/migration/meson.build
 index 8cac83c06c..0842d00cd2 100644
@@ -690,10 +690,10 @@ index 0000000000..05d394c0e2
 +    return ret;
 +}
 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 15572befb1..1507180990 100644
+index 480b798963..cfebfd1db5 100644
 --- a/monitor/hmp-cmds.c
 +++ b/monitor/hmp-cmds.c
-@@ -1925,6 +1925,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
+@@ -1906,6 +1906,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
      hmp_handle_error(mon, err);
  }
  
@@ -758,7 +758,7 @@ index 15572befb1..1507180990 100644
  {
      IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
 diff --git a/qapi/migration.json b/qapi/migration.json
-index 81185d4311..3129f71fa8 100644
+index 88ecf86ac8..4435866379 100644
 --- a/qapi/migration.json
 +++ b/qapi/migration.json
 @@ -261,6 +261,40 @@
@@ -846,10 +846,10 @@ index 27ef5a2b20..b3ce75dcae 100644
  # @CommandLineParameterType:
  #
 diff --git a/qemu-options.hx b/qemu-options.hx
-index 31c04f7eea..c2ca6e91b5 100644
+index 7f99d15b23..54efb127c4 100644
 --- a/qemu-options.hx
 +++ b/qemu-options.hx
-@@ -4341,6 +4341,18 @@ SRST
+@@ -4391,6 +4391,18 @@ SRST
      Start right away with a saved state (``loadvm`` in monitor)
  ERST
  
@@ -869,10 +869,10 @@ index 31c04f7eea..c2ca6e91b5 100644
  DEF("daemonize", 0, QEMU_OPTION_daemonize, \
      "-daemonize      daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
 diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 706bd7cff7..b8637c4262 100644
+index 5f7f6ca981..21f067d115 100644
 --- a/softmmu/vl.c
 +++ b/softmmu/vl.c
-@@ -165,6 +165,7 @@ static const char *accelerators;
+@@ -164,6 +164,7 @@ static const char *accelerators;
  static bool have_custom_ram_size;
  static const char *ram_memdev_id;
  static QDict *machine_opts_dict;
@@ -880,7 +880,7 @@ index 706bd7cff7..b8637c4262 100644
  static QTAILQ_HEAD(, ObjectOption) object_opts = QTAILQ_HEAD_INITIALIZER(object_opts);
  static QTAILQ_HEAD(, DeviceOption) device_opts = QTAILQ_HEAD_INITIALIZER(device_opts);
  static int display_remote;
-@@ -2584,6 +2585,12 @@ void qmp_x_exit_preconfig(Error **errp)
+@@ -2607,6 +2608,12 @@ void qmp_x_exit_preconfig(Error **errp)
  
      if (loadvm) {
          load_snapshot(loadvm, NULL, false, NULL, &error_fatal);
@@ -893,7 +893,7 @@ index 706bd7cff7..b8637c4262 100644
      }
      if (replay_mode != REPLAY_MODE_NONE) {
          replay_vmstate_init();
-@@ -3133,6 +3140,9 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -3151,6 +3158,9 @@ void qemu_init(int argc, char **argv)
              case QEMU_OPTION_loadvm:
                  loadvm = optarg;
                  break;
index 71ee72deff8d36c6567f1e08db364b61ae996628..5cf894b0812b32622479c3ad530ee0ea4f836fb6 100644 (file)
@@ -19,7 +19,7 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
  3 files changed, 38 insertions(+), 18 deletions(-)
 
 diff --git a/migration/qemu-file.c b/migration/qemu-file.c
-index 4f400c2e52..21e8998867 100644
+index 2d5f74ffc2..9fd97e6fe1 100644
 --- a/migration/qemu-file.c
 +++ b/migration/qemu-file.c
 @@ -31,8 +31,8 @@
@@ -43,7 +43,7 @@ index 4f400c2e52..21e8998867 100644
  
      DECLARE_BITMAP(may_free, MAX_IOV_SIZE);
      struct iovec iov[MAX_IOV_SIZE];
-@@ -106,7 +107,9 @@ bool qemu_file_mode_is_not_valid(const char *mode)
+@@ -127,7 +128,9 @@ bool qemu_file_mode_is_not_valid(const char *mode)
      return false;
  }
  
@@ -54,7 +54,7 @@ index 4f400c2e52..21e8998867 100644
  {
      QEMUFile *f;
  
-@@ -115,6 +118,8 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable)
+@@ -136,6 +139,8 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable)
      object_ref(ioc);
      f->ioc = ioc;
      f->is_writable = is_writable;
@@ -63,7 +63,7 @@ index 4f400c2e52..21e8998867 100644
  
      return f;
  }
-@@ -125,17 +130,27 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable)
+@@ -146,17 +151,27 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable)
   */
  QEMUFile *qemu_file_get_return_path(QEMUFile *f)
  {
@@ -94,7 +94,7 @@ index 4f400c2e52..21e8998867 100644
  }
  
  void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks)
-@@ -393,7 +408,7 @@ static ssize_t qemu_fill_buffer(QEMUFile *f)
+@@ -414,7 +429,7 @@ static ssize_t qemu_fill_buffer(QEMUFile *f)
      do {
          len = qio_channel_read(f->ioc,
                                 (char *)f->buf + pending,
@@ -103,7 +103,7 @@ index 4f400c2e52..21e8998867 100644
                                 &local_error);
          if (len == QIO_CHANNEL_ERR_BLOCK) {
              if (qemu_in_coroutine()) {
-@@ -443,6 +458,8 @@ int qemu_fclose(QEMUFile *f)
+@@ -464,6 +479,8 @@ int qemu_fclose(QEMUFile *f)
      }
      g_clear_pointer(&f->ioc, object_unref);
  
@@ -112,7 +112,7 @@ index 4f400c2e52..21e8998867 100644
      /* If any error was spotted before closing, we should report it
       * instead of the close() return value.
       */
-@@ -497,7 +514,7 @@ static void add_buf_to_iovec(QEMUFile *f, size_t len)
+@@ -518,7 +535,7 @@ static void add_buf_to_iovec(QEMUFile *f, size_t len)
  {
      if (!add_to_iovec(f, f->buf + f->buf_index, len, false)) {
          f->buf_index += len;
@@ -121,7 +121,7 @@ index 4f400c2e52..21e8998867 100644
              qemu_fflush(f);
          }
      }
-@@ -523,7 +540,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size)
+@@ -544,7 +561,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size)
      }
  
      while (size > 0) {
@@ -130,7 +130,7 @@ index 4f400c2e52..21e8998867 100644
          if (l > size) {
              l = size;
          }
-@@ -570,8 +587,8 @@ size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset)
+@@ -591,8 +608,8 @@ size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset)
      size_t index;
  
      assert(!qemu_file_is_writable(f));
@@ -141,7 +141,7 @@ index 4f400c2e52..21e8998867 100644
  
      /* The 1st byte to read from */
      index = f->buf_index + offset;
-@@ -621,7 +638,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
+@@ -642,7 +659,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
          size_t res;
          uint8_t *src;
  
@@ -150,7 +150,7 @@ index 4f400c2e52..21e8998867 100644
          if (res == 0) {
              return done;
          }
-@@ -655,7 +672,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
+@@ -676,7 +693,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
   */
  size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size)
  {
@@ -159,7 +159,7 @@ index 4f400c2e52..21e8998867 100644
          size_t res;
          uint8_t *src = NULL;
  
-@@ -680,7 +697,7 @@ int qemu_peek_byte(QEMUFile *f, int offset)
+@@ -701,7 +718,7 @@ int qemu_peek_byte(QEMUFile *f, int offset)
      int index = f->buf_index + offset;
  
      assert(!qemu_file_is_writable(f));
@@ -168,7 +168,7 @@ index 4f400c2e52..21e8998867 100644
  
      if (index >= f->buf_size) {
          qemu_fill_buffer(f);
-@@ -832,7 +849,7 @@ static int qemu_compress_data(z_stream *stream, uint8_t *dest, size_t dest_len,
+@@ -853,7 +870,7 @@ static int qemu_compress_data(z_stream *stream, uint8_t *dest, size_t dest_len,
  ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
                                    const uint8_t *p, size_t size)
  {
@@ -192,7 +192,7 @@ index fa13d04d78..914f1a63a8 100644
  int qemu_fclose(QEMUFile *f);
  
 diff --git a/migration/savevm-async.c b/migration/savevm-async.c
-index b3692739a0..e65a5e3482 100644
+index 05d394c0e2..bafe6ae5eb 100644
 --- a/migration/savevm-async.c
 +++ b/migration/savevm-async.c
 @@ -367,7 +367,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
index 8f53db4d10c8c52bde26553347980e576ca04ee7..2ff4d9e1a0f02654e4902265bd4e17727d5316e6 100644 (file)
@@ -8,12 +8,12 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
 ---
  block/meson.build |   1 +
- block/zeroinit.c  | 196 ++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 197 insertions(+)
+ block/zeroinit.c  | 198 ++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 199 insertions(+)
  create mode 100644 block/zeroinit.c
 
 diff --git a/block/meson.build b/block/meson.build
-index 60bc305597..ad40c10b6a 100644
+index b7c68b83a3..020a89ae07 100644
 --- a/block/meson.build
 +++ b/block/meson.build
 @@ -43,6 +43,7 @@ block_ss.add(files(
@@ -26,10 +26,10 @@ index 60bc305597..ad40c10b6a 100644
  softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
 diff --git a/block/zeroinit.c b/block/zeroinit.c
 new file mode 100644
-index 0000000000..20ee611f22
+index 0000000000..b60e1b84dc
 --- /dev/null
 +++ b/block/zeroinit.c
-@@ -0,0 +1,196 @@
+@@ -0,0 +1,198 @@
 +/*
 + * Filter to fake a zero-initialized block device.
 + *
@@ -109,7 +109,9 @@ index 0000000000..20ee611f22
 +
 +    /* Open the raw file */
 +    bs->file = bdrv_open_child(qemu_opt_get(opts, "x-next"), options, "next",
-+                               bs, &child_of_bds, BDRV_CHILD_FILTERED, false, &local_err);
++                               bs, &child_of_bds,
++                               BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
++                               false, &local_err);
 +    if (local_err) {
 +        ret = -EINVAL;
 +        error_propagate(errp, local_err);
index f0b18f52e0b85a98dc261d30d3be36ddbd323b37..a3f3e04389f86e58f6143f86d48b267206a409b0 100644 (file)
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  2 files changed, 11 insertions(+)
 
 diff --git a/qemu-options.hx b/qemu-options.hx
-index c2ca6e91b5..ab4734ef32 100644
+index 54efb127c4..ef456d03ec 100644
 --- a/qemu-options.hx
 +++ b/qemu-options.hx
-@@ -1118,6 +1118,9 @@ backend describes how QEMU handles the data.
+@@ -1147,6 +1147,9 @@ backend describes how QEMU handles the data.
  
  ERST
  
@@ -28,10 +28,10 @@ index c2ca6e91b5..ab4734ef32 100644
      "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
  DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
 diff --git a/softmmu/vl.c b/softmmu/vl.c
-index b8637c4262..39f149924e 100644
+index 21f067d115..9d737e7914 100644
 --- a/softmmu/vl.c
 +++ b/softmmu/vl.c
-@@ -2620,6 +2620,7 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -2643,6 +2643,7 @@ void qemu_init(int argc, char **argv)
      MachineClass *machine_class;
      bool userconfig = true;
      FILE *vmstate_dump_file = NULL;
@@ -39,7 +39,7 @@ index b8637c4262..39f149924e 100644
  
      qemu_add_opts(&qemu_drive_opts);
      qemu_add_drive_opts(&qemu_legacy_drive_opts);
-@@ -3245,6 +3246,13 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -3263,6 +3264,13 @@ void qemu_init(int argc, char **argv)
                  machine_parse_property_opt(qemu_find_opts("smp-opts"),
                                             "smp", optarg);
                  break;
index 96b019321bd07966828996c7d023ff1c19e92a3b..c4760310aa226dae604ee011da3d639be47af741 100644 (file)
@@ -13,10 +13,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  2 files changed, 42 insertions(+), 20 deletions(-)
 
 diff --git a/block/file-posix.c b/block/file-posix.c
-index 3d60b80286..49ee1db5f9 100644
+index 9a16d86344..bd68df57ad 100644
 --- a/block/file-posix.c
 +++ b/block/file-posix.c
-@@ -2475,6 +2475,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2487,6 +2487,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
      int fd;
      uint64_t perm, shared;
      int result = 0;
@@ -24,7 +24,7 @@ index 3d60b80286..49ee1db5f9 100644
  
      /* Validate options and set default values */
      assert(options->driver == BLOCKDEV_DRIVER_FILE);
-@@ -2515,19 +2516,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2527,19 +2528,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
      perm = BLK_PERM_WRITE | BLK_PERM_RESIZE;
      shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
  
@@ -59,7 +59,7 @@ index 3d60b80286..49ee1db5f9 100644
      }
  
      /* Clear the file by truncating it to 0 */
-@@ -2581,13 +2585,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2593,13 +2597,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
      }
  
  out_unlock:
@@ -82,7 +82,7 @@ index 3d60b80286..49ee1db5f9 100644
      }
  
  out_close:
-@@ -2612,6 +2618,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2624,6 +2630,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
      PreallocMode prealloc;
      char *buf = NULL;
      Error *local_err = NULL;
@@ -90,7 +90,7 @@ index 3d60b80286..49ee1db5f9 100644
  
      /* Skip file: protocol prefix */
      strstart(filename, "file:", &filename);
-@@ -2634,6 +2641,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2646,6 +2653,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
          return -EINVAL;
      }
  
@@ -109,7 +109,7 @@ index 3d60b80286..49ee1db5f9 100644
      options = (BlockdevCreateOptions) {
          .driver     = BLOCKDEV_DRIVER_FILE,
          .u.file     = {
-@@ -2645,6 +2664,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2657,6 +2676,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
              .nocow              = nocow,
              .has_extent_size_hint = has_extent_size_hint,
              .extent_size_hint   = extent_size_hint,
@@ -119,10 +119,10 @@ index 3d60b80286..49ee1db5f9 100644
      };
      return raw_co_create(&options, errp);
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index e1857e7094..ddac91e8f6 100644
+index 7daaf545be..9e902b96bb 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
-@@ -4537,7 +4537,8 @@
+@@ -4624,7 +4624,8 @@
              'size':                 'size',
              '*preallocation':       'PreallocMode',
              '*nocow':               'bool',
index 72f29ff30cfdee4ebe53452cd47d2e977476bc2e..c7905be2573e795116fb25c48cd3d739c023bc3d 100644 (file)
@@ -26,10 +26,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/hw/core/machine.c b/hw/core/machine.c
-index a673302cce..fa424440bd 100644
+index 8d34caa31d..2df9037c4e 100644
 --- a/hw/core/machine.c
 +++ b/hw/core/machine.c
-@@ -127,7 +127,8 @@ GlobalProperty hw_compat_4_0[] = {
+@@ -132,7 +132,8 @@ GlobalProperty hw_compat_4_0[] = {
      { "virtio-vga",     "edid", "false" },
      { "virtio-gpu-device", "edid", "false" },
      { "virtio-device", "use-started", "false" },
index 67fd0f6cebac193493594347c874a36d26c62582..2d814dacd8b918508f10d7ee50d816e095e0a1dc 100644 (file)
@@ -36,7 +36,7 @@ index 76fff60a6b..ec9201fb9a 100644
  
          if (mc->default_cpu_type) {
 diff --git a/include/hw/boards.h b/include/hw/boards.h
-index 7b416c9787..8ae15c51aa 100644
+index 90f1dd3aeb..14d60520d9 100644
 --- a/include/hw/boards.h
 +++ b/include/hw/boards.h
 @@ -230,6 +230,8 @@ struct MachineClass {
@@ -46,10 +46,10 @@ index 7b416c9787..8ae15c51aa 100644
 +    const char *pve_version;
 +
      void (*init)(MachineState *state);
-     void (*reset)(MachineState *state);
+     void (*reset)(MachineState *state, ShutdownCause reason);
      void (*wakeup)(MachineState *state);
 diff --git a/qapi/machine.json b/qapi/machine.json
-index 555458f785..d868e4d31d 100644
+index 9156103c8f..f4fb1b2c9c 100644
 --- a/qapi/machine.json
 +++ b/qapi/machine.json
 @@ -157,6 +157,8 @@
@@ -71,10 +71,10 @@ index 555458f785..d868e4d31d 100644
  ##
  # @query-machines:
 diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 39f149924e..0d233d55f3 100644
+index 9d737e7914..a64eee2fad 100644
 --- a/softmmu/vl.c
 +++ b/softmmu/vl.c
-@@ -1580,6 +1580,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
+@@ -1578,6 +1578,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
  static MachineClass *select_machine(QDict *qdict, Error **errp)
  {
      const char *optarg = qdict_get_try_str(qdict, "type");
@@ -82,7 +82,7 @@ index 39f149924e..0d233d55f3 100644
      GSList *machines = object_class_get_list(TYPE_MACHINE, false);
      MachineClass *machine_class;
      Error *local_err = NULL;
-@@ -1597,6 +1598,11 @@ static MachineClass *select_machine(QDict *qdict, Error **errp)
+@@ -1595,6 +1596,11 @@ static MachineClass *select_machine(QDict *qdict, Error **errp)
          }
      }
  
@@ -94,7 +94,7 @@ index 39f149924e..0d233d55f3 100644
      g_slist_free(machines);
      if (local_err) {
          error_append_hint(&local_err, "Use -machine help to list supported machines\n");
-@@ -3187,12 +3193,31 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -3205,12 +3211,31 @@ void qemu_init(int argc, char **argv)
              case QEMU_OPTION_machine:
                  {
                      bool help;
index a1ce276b98586ef5602dab0c31a6ca8a8de4a101..5f2638db0b70109d9a84fbbcfa5f21b9663d22ce 100644 (file)
@@ -25,7 +25,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/block/backup.c b/block/backup.c
-index b2b649e305..b6fa9e8a69 100644
+index 6a9ad97a53..9b0151c5be 100644
 --- a/block/backup.c
 +++ b/block/backup.c
 @@ -237,8 +237,8 @@ static void backup_init_bcs_bitmap(BackupBlockJob *job)
index cf6793754d80be41394a3f1a6ce2696bbe32be60..7735ab9959cee8ce79a9ca5424cb3a37244ab973 100644 (file)
@@ -20,7 +20,7 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
  create mode 100644 vma.h
 
 diff --git a/block/meson.build b/block/meson.build
-index ad40c10b6a..3a0b84bc11 100644
+index 020a89ae07..4feae20e37 100644
 --- a/block/meson.build
 +++ b/block/meson.build
 @@ -46,6 +46,8 @@ block_ss.add(files(
@@ -30,13 +30,13 @@ index ad40c10b6a..3a0b84bc11 100644
 +block_ss.add(files('../vma-writer.c'), libuuid)
 +
  softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
+ softmmu_ss.add(files('block-ram-registrar.c'))
  
- if get_option('qcow1').allowed()
 diff --git a/meson.build b/meson.build
-index d5230eadd6..ffff66c0cc 100644
+index 5c6b5a1c75..e8cf7e3d78 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -1462,6 +1462,8 @@ keyutils = dependency('libkeyutils', required: false,
+@@ -1525,6 +1525,8 @@ keyutils = dependency('libkeyutils', required: false,
  
  has_gettid = cc.has_function('gettid')
  
@@ -45,7 +45,7 @@ index d5230eadd6..ffff66c0cc 100644
  # libselinux
  selinux = dependency('libselinux',
                       required: get_option('selinux'),
-@@ -3607,6 +3609,9 @@ if have_tools
+@@ -3596,6 +3598,9 @@ if have_tools
                 dependencies: [blockdev, qemuutil, gnutls, selinux],
                 install: true)
  
index 548ce20bd3dd3afaecdbce00f47c912ed8db5384..0d7931fea36b703a851a6dbf773bd8304b8a7584 100644 (file)
@@ -192,7 +192,7 @@ index 0000000000..04718a94e2
 +    return bs;
 +}
 diff --git a/block/backup.c b/block/backup.c
-index b6fa9e8a69..789f8b7799 100644
+index 9b0151c5be..6e8f6e67b3 100644
 --- a/block/backup.c
 +++ b/block/backup.c
 @@ -29,28 +29,6 @@
@@ -240,7 +240,7 @@ index b6fa9e8a69..789f8b7799 100644
      if (perf->max_chunk && perf->max_chunk < cluster_size) {
          error_setg(errp, "Required max-chunk (%" PRIi64 ") is less than backup "
 diff --git a/block/meson.build b/block/meson.build
-index 3a0b84bc11..7f22e7f177 100644
+index 4feae20e37..0d7023fc82 100644
 --- a/block/meson.build
 +++ b/block/meson.build
 @@ -4,6 +4,7 @@ block_ss.add(files(
@@ -252,7 +252,7 @@ index 3a0b84bc11..7f22e7f177 100644
    'blkdebug.c',
    'blklogwrites.c',
 diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
-index 8947abab76..f272d0d8dc 100644
+index 31ae91e56e..37b64bcd93 100644
 --- a/include/block/block_int-common.h
 +++ b/include/block/block_int-common.h
 @@ -26,6 +26,7 @@
@@ -305,16 +305,16 @@ index 8947abab76..f272d0d8dc 100644
      BDRV_TRACKED_READ,
      BDRV_TRACKED_WRITE,
 diff --git a/job.c b/job.c
-index 075c6f3a20..e5699ad200 100644
+index 72d57f0934..93e22d180b 100644
 --- a/job.c
 +++ b/job.c
-@@ -276,7 +276,8 @@ static bool job_started(Job *job)
-     return job->co;
+@@ -330,7 +330,8 @@ static bool job_started_locked(Job *job)
  }
  
--static bool job_should_pause(Job *job)
-+bool job_should_pause(Job *job);
-+bool job_should_pause(Job *job)
+ /* Called with job_mutex held. */
+-static bool job_should_pause_locked(Job *job)
++bool job_should_pause_locked(Job *job);
++bool job_should_pause_locked(Job *job)
  {
      return job->pause_count > 0;
  }
index 58bc045c6b44d2077cdd800379904cf334216c40..40a56bedce13a47ed3777ce865950b07c9abbbf8 100644 (file)
@@ -7,8 +7,9 @@ Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
 [PVE-Backup: avoid coroutines to fix AIO freeze, cleanups]
 Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-[add new force parameter to job_cancel_sync calls]
-Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
+[FE: add new force parameter to job_cancel_sync calls
+     adapt for new job lock mechanism replacing AioContext locks]
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 ---
  block/meson.build              |   5 +
  block/monitor/block-hmp-cmds.c |  33 ++
@@ -20,17 +21,17 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
  monitor/hmp-cmds.c             |  44 ++
  proxmox-backup-client.c        | 176 ++++++
  proxmox-backup-client.h        |  59 ++
- pve-backup.c                   | 959 +++++++++++++++++++++++++++++++++
+ pve-backup.c                   | 956 +++++++++++++++++++++++++++++++++
  qapi/block-core.json           | 109 ++++
  qapi/common.json               |  13 +
  qapi/machine.json              |  15 +-
- 14 files changed, 1448 insertions(+), 13 deletions(-)
+ 14 files changed, 1445 insertions(+), 13 deletions(-)
  create mode 100644 proxmox-backup-client.c
  create mode 100644 proxmox-backup-client.h
  create mode 100644 pve-backup.c
 
 diff --git a/block/meson.build b/block/meson.build
-index 7f22e7f177..2783b77e9c 100644
+index 0d7023fc82..e995ae72b9 100644
 --- a/block/meson.build
 +++ b/block/meson.build
 @@ -48,6 +48,11 @@ block_ss.add(files(
@@ -44,9 +45,9 @@ index 7f22e7f177..2783b77e9c 100644
 +
  
  softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
+ softmmu_ss.add(files('block-ram-registrar.c'))
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index bfb3c043a0..89ca64444d 100644
+index b6135e9bfe..477044c54a 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
 @@ -1015,3 +1015,36 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
@@ -87,7 +88,7 @@ index bfb3c043a0..89ca64444d 100644
 +    hmp_handle_error(mon, error);
 +}
 diff --git a/blockdev.c b/blockdev.c
-index ce62a9b439..1600b24eab 100644
+index 756e980889..bc8d67b290 100644
 --- a/blockdev.c
 +++ b/blockdev.c
 @@ -36,6 +36,7 @@
@@ -99,10 +100,10 @@ index ce62a9b439..1600b24eab 100644
  #include "monitor/monitor.h"
  #include "qemu/error-report.h"
 diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index 97b88eaaad..92a8867afb 100644
+index 489c524e9e..bc1d46d845 100644
 --- a/hmp-commands-info.hx
 +++ b/hmp-commands-info.hx
-@@ -484,6 +484,20 @@ SRST
+@@ -486,6 +486,20 @@ SRST
      Show the current VM UUID.
  ERST
  
@@ -124,7 +125,7 @@ index 97b88eaaad..92a8867afb 100644
      {
          .name       = "usernet",
 diff --git a/hmp-commands.hx b/hmp-commands.hx
-index bbcc73e942..97f24942b3 100644
+index 039be0033d..fcf9461295 100644
 --- a/hmp-commands.hx
 +++ b/hmp-commands.hx
 @@ -101,6 +101,35 @@ ERST
@@ -164,10 +165,10 @@ index bbcc73e942..97f24942b3 100644
  
      {
 diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index 55067beff1..5a98d2d927 100644
+index 440f86aba8..350527e599 100644
 --- a/include/monitor/hmp.h
 +++ b/include/monitor/hmp.h
-@@ -30,6 +30,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict);
+@@ -31,6 +31,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict);
  void hmp_info_migrate(Monitor *mon, const QDict *qdict);
  void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
  void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
@@ -175,7 +176,7 @@ index 55067beff1..5a98d2d927 100644
  void hmp_info_cpus(Monitor *mon, const QDict *qdict);
  void hmp_info_vnc(Monitor *mon, const QDict *qdict);
  void hmp_info_spice(Monitor *mon, const QDict *qdict);
-@@ -73,6 +74,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
+@@ -74,6 +75,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
  void hmp_set_password(Monitor *mon, const QDict *qdict);
  void hmp_expire_password(Monitor *mon, const QDict *qdict);
  void hmp_change(Monitor *mon, const QDict *qdict);
@@ -185,10 +186,10 @@ index 55067beff1..5a98d2d927 100644
  void hmp_device_add(Monitor *mon, const QDict *qdict);
  void hmp_device_del(Monitor *mon, const QDict *qdict);
 diff --git a/meson.build b/meson.build
-index ffff66c0cc..0bc2fb5b10 100644
+index e8cf7e3d78..782756162c 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -1463,6 +1463,7 @@ keyutils = dependency('libkeyutils', required: false,
+@@ -1526,6 +1526,7 @@ keyutils = dependency('libkeyutils', required: false,
  has_gettid = cc.has_function('gettid')
  
  libuuid = cc.find_library('uuid', required: true)
@@ -197,10 +198,10 @@ index ffff66c0cc..0bc2fb5b10 100644
  # libselinux
  selinux = dependency('libselinux',
 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 1507180990..1168773da7 100644
+index cfebfd1db5..a40b25e906 100644
 --- a/monitor/hmp-cmds.c
 +++ b/monitor/hmp-cmds.c
-@@ -197,6 +197,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
+@@ -199,6 +199,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
      qapi_free_MouseInfoList(mice_list);
  }
  
@@ -248,9 +249,9 @@ index 1507180990..1168773da7 100644
 +    qapi_free_BackupStatus(info);
 +}
 +
static char *SocketAddress_to_str(SocketAddress *addr)
void hmp_info_migrate(Monitor *mon, const QDict *qdict)
  {
-     switch (addr->type) {
+     MigrationInfo *info;
 diff --git a/proxmox-backup-client.c b/proxmox-backup-client.c
 new file mode 100644
 index 0000000000..a8f6653a81
@@ -500,10 +501,10 @@ index 0000000000..1dda8b7d8f
 +#endif /* PROXMOX_BACKUP_CLIENT_H */
 diff --git a/pve-backup.c b/pve-backup.c
 new file mode 100644
-index 0000000000..88f5ee133f
+index 0000000000..3d28975eaa
 --- /dev/null
 +++ b/pve-backup.c
-@@ -0,0 +1,959 @@
+@@ -0,0 +1,956 @@
 +#include "proxmox-backup-client.h"
 +#include "vma.h"
 +
@@ -581,14 +582,16 @@ index 0000000000..88f5ee133f
 +lookup_active_block_job(PVEBackupDevInfo *di)
 +{
 +    if (!di->completed && di->bs) {
-+        for (BlockJob *job = block_job_next(NULL); job; job = block_job_next(job)) {
-+            if (job->job.driver->job_type != JOB_TYPE_BACKUP) {
-+                continue;
-+            }
++        WITH_JOB_LOCK_GUARD() {
++            for (BlockJob *job = block_job_next_locked(NULL); job; job = block_job_next_locked(job)) {
++                if (job->job.driver->job_type != JOB_TYPE_BACKUP) {
++                    continue;
++                }
 +
-+            BackupBlockJob *bjob = container_of(job, BackupBlockJob, common);
-+            if (bjob && bjob->source_bs == di->bs) {
-+                return job;
++                BackupBlockJob *bjob = container_of(job, BackupBlockJob, common);
++                if (bjob && bjob->source_bs == di->bs) {
++                    return job;
++                }
 +            }
 +        }
 +    }
@@ -858,10 +861,7 @@ index 0000000000..88f5ee133f
 +        qemu_mutex_unlock(&backup_state.backup_mutex);
 +
 +        if (next_job) {
-+            AioContext *aio_context = next_job->job.aio_context;
-+            aio_context_acquire(aio_context);
 +            job_cancel_sync(&next_job->job, true);
-+            aio_context_release(aio_context);
 +        } else {
 +            break;
 +        }
@@ -923,7 +923,7 @@ index 0000000000..88f5ee133f
 +    goto out;
 +}
 +
-+bool job_should_pause(Job *job);
++bool job_should_pause_locked(Job *job);
 +
 +static void pvebackup_run_next_job(void)
 +{
@@ -941,18 +941,16 @@ index 0000000000..88f5ee133f
 +        if (job) {
 +            qemu_mutex_unlock(&backup_state.backup_mutex);
 +
-+            AioContext *aio_context = job->job.aio_context;
-+            aio_context_acquire(aio_context);
-+
-+            if (job_should_pause(&job->job)) {
-+                bool error_or_canceled = pvebackup_error_or_canceled();
-+                if (error_or_canceled) {
-+                    job_cancel_sync(&job->job, true);
-+                } else {
-+                    job_resume(&job->job);
++            WITH_JOB_LOCK_GUARD() {
++                if (job_should_pause_locked(&job->job)) {
++                    bool error_or_canceled = pvebackup_error_or_canceled();
++                    if (error_or_canceled) {
++                        job_cancel_sync_locked(&job->job, true);
++                    } else {
++                        job_resume_locked(&job->job);
++                    }
 +                }
 +            }
-+            aio_context_release(aio_context);
 +            return;
 +        }
 +    }
@@ -1464,7 +1462,7 @@ index 0000000000..88f5ee133f
 +    return info;
 +}
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index ddac91e8f6..90ad07b7ee 100644
+index 9e902b96bb..c3b6b93472 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -740,6 +740,115 @@
@@ -1605,7 +1603,7 @@ index 356db3f670..aae8a3b682 100644
 +##
 +{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
 diff --git a/qapi/machine.json b/qapi/machine.json
-index d868e4d31d..a63d9a078d 100644
+index f4fb1b2c9c..0d6ee836ed 100644
 --- a/qapi/machine.json
 +++ b/qapi/machine.json
 @@ -4,6 +4,8 @@
index 6c61992de163d924f77c95f47efc44eb96b2c417..422f84032b219953d0d9c019483458a1222a1c77 100644 (file)
@@ -12,10 +12,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  create mode 100644 pbs-restore.c
 
 diff --git a/meson.build b/meson.build
-index 0bc2fb5b10..f48d2e0457 100644
+index 782756162c..63ea813a9a 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -3613,6 +3613,10 @@ if have_tools
+@@ -3602,6 +3602,10 @@ if have_tools
    vma = executable('vma', files('vma.c', 'vma-reader.c') + genh,
                     dependencies: [authz, block, crypto, io, qom], install: true)
  
index 8d37565cfed530086016bc8eeae7f218a07513ba..6d225bac5cb1cadbc7654c3c7add7d1ece90950a 100644 (file)
@@ -29,7 +29,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  6 files changed, 142 insertions(+), 23 deletions(-)
 
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 89ca64444d..45da74d7a0 100644
+index 477044c54a..556af25861 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
 @@ -1042,6 +1042,7 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
@@ -41,10 +41,10 @@ index 89ca64444d..45da74d7a0 100644
          false, NULL, false, NULL, !!devlist,
          devlist, qdict_haskey(qdict, "speed"), speed, &error);
 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 1168773da7..4c1671e289 100644
+index a40b25e906..670f783515 100644
 --- a/monitor/hmp-cmds.c
 +++ b/monitor/hmp-cmds.c
-@@ -223,19 +223,42 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
+@@ -225,19 +225,42 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
              monitor_printf(mon, "End time: %s", ctime(&info->end_time));
          }
  
@@ -132,7 +132,7 @@ index 1dda8b7d8f..8cbf645b2c 100644
  
  
 diff --git a/pve-backup.c b/pve-backup.c
-index 88f5ee133f..1c49cd178d 100644
+index 3d28975eaa..abd7062afe 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
 @@ -28,6 +28,8 @@
@@ -162,7 +162,7 @@ index 88f5ee133f..1c49cd178d 100644
      BlockDriverState *target;
  } PVEBackupDevInfo;
  
-@@ -105,11 +110,12 @@ static bool pvebackup_error_or_canceled(void)
+@@ -107,11 +112,12 @@ static bool pvebackup_error_or_canceled(void)
      return error_or_canceled;
  }
  
@@ -176,7 +176,7 @@ index 88f5ee133f..1c49cd178d 100644
      qemu_mutex_unlock(&backup_state.stat.lock);
  }
  
-@@ -148,7 +154,8 @@ pvebackup_co_dump_pbs_cb(
+@@ -150,7 +156,8 @@ pvebackup_co_dump_pbs_cb(
          pvebackup_propagate_error(local_err);
          return pbs_res;
      } else {
@@ -186,7 +186,7 @@ index 88f5ee133f..1c49cd178d 100644
      }
  
      return size;
-@@ -208,11 +215,11 @@ pvebackup_co_dump_vma_cb(
+@@ -210,11 +217,11 @@ pvebackup_co_dump_vma_cb(
          } else {
              if (remaining >= VMA_CLUSTER_SIZE) {
                  assert(ret == VMA_CLUSTER_SIZE);
@@ -200,7 +200,7 @@ index 88f5ee133f..1c49cd178d 100644
                  remaining = 0;
              }
          }
-@@ -248,6 +255,18 @@ static void coroutine_fn pvebackup_co_cleanup(void *unused)
+@@ -250,6 +257,18 @@ static void coroutine_fn pvebackup_co_cleanup(void *unused)
              if (local_err != NULL) {
                  pvebackup_propagate_error(local_err);
              }
@@ -219,7 +219,7 @@ index 88f5ee133f..1c49cd178d 100644
          }
  
          proxmox_backup_disconnect(backup_state.pbs);
-@@ -303,6 +322,12 @@ static void pvebackup_complete_cb(void *opaque, int ret)
+@@ -305,6 +324,12 @@ static void pvebackup_complete_cb(void *opaque, int ret)
      // remove self from job queue
      backup_state.di_list = g_list_remove(backup_state.di_list, di);
  
@@ -232,7 +232,7 @@ index 88f5ee133f..1c49cd178d 100644
      g_free(di);
  
      qemu_mutex_unlock(&backup_state.backup_mutex);
-@@ -472,12 +497,18 @@ static bool create_backup_jobs(void) {
+@@ -469,12 +494,18 @@ static bool create_backup_jobs(void) {
  
          assert(di->target != NULL);
  
@@ -253,7 +253,7 @@ index 88f5ee133f..1c49cd178d 100644
              JOB_DEFAULT, pvebackup_complete_cb, di, NULL, &local_err);
  
          aio_context_release(aio_context);
-@@ -528,6 +559,8 @@ typedef struct QmpBackupTask {
+@@ -525,6 +556,8 @@ typedef struct QmpBackupTask {
      const char *fingerprint;
      bool has_fingerprint;
      int64_t backup_time;
@@ -262,7 +262,7 @@ index 88f5ee133f..1c49cd178d 100644
      bool has_format;
      BackupFormat format;
      bool has_config_file;
-@@ -619,6 +652,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -616,6 +649,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      }
  
      size_t total = 0;
@@ -270,7 +270,7 @@ index 88f5ee133f..1c49cd178d 100644
  
      l = di_list;
      while (l) {
-@@ -656,6 +690,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -653,6 +687,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
          int dump_cb_block_size = PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE; // Hardcoded (4M)
          firewall_name = "fw.conf";
  
@@ -279,7 +279,7 @@ index 88f5ee133f..1c49cd178d 100644
          char *pbs_err = NULL;
          pbs = proxmox_backup_new(
              task->backup_file,
-@@ -675,7 +711,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -672,7 +708,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              goto err;
          }
  
@@ -289,7 +289,7 @@ index 88f5ee133f..1c49cd178d 100644
              goto err;
  
          /* register all devices */
-@@ -686,9 +723,40 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -683,9 +720,40 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
  
              const char *devname = bdrv_get_device_name(di->bs);
  
@@ -332,7 +332,7 @@ index 88f5ee133f..1c49cd178d 100644
  
              if (!(di->target = bdrv_backup_dump_create(dump_cb_block_size, di->size, pvebackup_co_dump_pbs_cb, di, task->errp))) {
                  goto err;
-@@ -697,6 +765,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -694,6 +762,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              di->dev_id = dev_id;
          }
      } else if (format == BACKUP_FORMAT_VMA) {
@@ -341,7 +341,7 @@ index 88f5ee133f..1c49cd178d 100644
          vmaw = vma_writer_create(task->backup_file, uuid, &local_err);
          if (!vmaw) {
              if (local_err) {
-@@ -724,6 +794,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -721,6 +791,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              }
          }
      } else if (format == BACKUP_FORMAT_DIR) {
@@ -350,7 +350,7 @@ index 88f5ee133f..1c49cd178d 100644
          if (mkdir(task->backup_file, 0640) != 0) {
              error_setg_errno(task->errp, errno, "can't create directory '%s'\n",
                               task->backup_file);
-@@ -796,8 +868,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -793,8 +865,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      char *uuid_str = g_strdup(backup_state.stat.uuid_str);
  
      backup_state.stat.total = total;
@@ -361,7 +361,7 @@ index 88f5ee133f..1c49cd178d 100644
  
      qemu_mutex_unlock(&backup_state.stat.lock);
  
-@@ -821,6 +895,10 @@ err:
+@@ -818,6 +892,10 @@ err:
          PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
          l = g_list_next(l);
  
@@ -372,7 +372,7 @@ index 88f5ee133f..1c49cd178d 100644
          if (di->target) {
              bdrv_unref(di->target);
          }
-@@ -862,6 +940,7 @@ UuidInfo *qmp_backup(
+@@ -859,6 +937,7 @@ UuidInfo *qmp_backup(
      bool has_fingerprint, const char *fingerprint,
      bool has_backup_id, const char *backup_id,
      bool has_backup_time, int64_t backup_time,
@@ -380,7 +380,7 @@ index 88f5ee133f..1c49cd178d 100644
      bool has_format, BackupFormat format,
      bool has_config_file, const char *config_file,
      bool has_firewall_file, const char *firewall_file,
-@@ -880,6 +959,8 @@ UuidInfo *qmp_backup(
+@@ -877,6 +956,8 @@ UuidInfo *qmp_backup(
          .backup_id = backup_id,
          .has_backup_time = has_backup_time,
          .backup_time = backup_time,
@@ -389,7 +389,7 @@ index 88f5ee133f..1c49cd178d 100644
          .has_format = has_format,
          .format = format,
          .has_config_file = has_config_file,
-@@ -948,10 +1029,14 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -945,10 +1026,14 @@ BackupStatus *qmp_query_backup(Error **errp)
  
      info->has_total = true;
      info->total = backup_state.stat.total;
@@ -405,7 +405,7 @@ index 88f5ee133f..1c49cd178d 100644
      qemu_mutex_unlock(&backup_state.stat.lock);
  
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 90ad07b7ee..3ad9eb5d1a 100644
+index c3b6b93472..992e6c1e3f 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -753,8 +753,13 @@
index 3bd8426b02b849c35a01bb8bbb70563ed694aed4..104e42d21a418d0a7c38a6002e9ec602c70e7770 100644 (file)
@@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  3 files changed, 54 insertions(+), 13 deletions(-)
 
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 45da74d7a0..ea7b665aa2 100644
+index 556af25861..a09f722fea 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
 @@ -1042,7 +1042,9 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
@@ -34,7 +34,7 @@ index 45da74d7a0..ea7b665aa2 100644
          false, NULL, false, NULL, !!devlist,
          devlist, qdict_haskey(qdict, "speed"), speed, &error);
 diff --git a/pve-backup.c b/pve-backup.c
-index 1c49cd178d..c15abefdda 100644
+index abd7062afe..e113ab61b9 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
 @@ -8,6 +8,7 @@
@@ -53,7 +53,7 @@ index 1c49cd178d..c15abefdda 100644
      uint8_t dev_id;
      bool completed;
      char targetfile[PATH_MAX];
-@@ -135,10 +137,13 @@ pvebackup_co_dump_pbs_cb(
+@@ -137,10 +139,13 @@ pvebackup_co_dump_pbs_cb(
      PVEBackupDevInfo *di = opaque;
  
      assert(backup_state.pbs);
@@ -67,7 +67,7 @@ index 1c49cd178d..c15abefdda 100644
      qemu_co_mutex_lock(&backup_state.dump_callback_mutex);
  
      // avoid deadlock if job is cancelled
-@@ -147,17 +152,29 @@ pvebackup_co_dump_pbs_cb(
+@@ -149,17 +154,29 @@ pvebackup_co_dump_pbs_cb(
          return -1;
      }
  
@@ -105,7 +105,7 @@ index 1c49cd178d..c15abefdda 100644
      return size;
  }
  
-@@ -178,6 +195,7 @@ pvebackup_co_dump_vma_cb(
+@@ -180,6 +197,7 @@ pvebackup_co_dump_vma_cb(
      int ret = -1;
  
      assert(backup_state.vmaw);
@@ -113,7 +113,7 @@ index 1c49cd178d..c15abefdda 100644
  
      uint64_t remaining = size;
  
-@@ -204,9 +222,7 @@ pvebackup_co_dump_vma_cb(
+@@ -206,9 +224,7 @@ pvebackup_co_dump_vma_cb(
          qemu_co_mutex_unlock(&backup_state.dump_callback_mutex);
  
          ++cluster_num;
@@ -124,7 +124,7 @@ index 1c49cd178d..c15abefdda 100644
          if (ret < 0) {
              Error *local_err = NULL;
              vma_writer_error_propagate(backup_state.vmaw, &local_err);
-@@ -569,6 +585,10 @@ typedef struct QmpBackupTask {
+@@ -566,6 +582,10 @@ typedef struct QmpBackupTask {
      const char *firewall_file;
      bool has_devlist;
      const char *devlist;
@@ -135,7 +135,7 @@ index 1c49cd178d..c15abefdda 100644
      bool has_speed;
      int64_t speed;
      Error **errp;
-@@ -692,6 +712,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -689,6 +709,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
  
          bool use_dirty_bitmap = task->has_use_dirty_bitmap && task->use_dirty_bitmap;
  
@@ -143,7 +143,7 @@ index 1c49cd178d..c15abefdda 100644
          char *pbs_err = NULL;
          pbs = proxmox_backup_new(
              task->backup_file,
-@@ -701,8 +722,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -698,8 +719,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              task->has_password ? task->password : NULL,
              task->has_keyfile ? task->keyfile : NULL,
              task->has_key_password ? task->key_password : NULL,
@@ -155,7 +155,7 @@ index 1c49cd178d..c15abefdda 100644
  
          if (!pbs) {
              error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
-@@ -721,6 +744,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -718,6 +741,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
              l = g_list_next(l);
  
@@ -164,7 +164,7 @@ index 1c49cd178d..c15abefdda 100644
              const char *devname = bdrv_get_device_name(di->bs);
  
              BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
-@@ -941,6 +966,8 @@ UuidInfo *qmp_backup(
+@@ -938,6 +963,8 @@ UuidInfo *qmp_backup(
      bool has_backup_id, const char *backup_id,
      bool has_backup_time, int64_t backup_time,
      bool has_use_dirty_bitmap, bool use_dirty_bitmap,
@@ -173,7 +173,7 @@ index 1c49cd178d..c15abefdda 100644
      bool has_format, BackupFormat format,
      bool has_config_file, const char *config_file,
      bool has_firewall_file, const char *firewall_file,
-@@ -951,6 +978,8 @@ UuidInfo *qmp_backup(
+@@ -948,6 +975,8 @@ UuidInfo *qmp_backup(
          .backup_file = backup_file,
          .has_password = has_password,
          .password = password,
@@ -182,7 +182,7 @@ index 1c49cd178d..c15abefdda 100644
          .has_key_password = has_key_password,
          .key_password = key_password,
          .has_fingerprint = has_fingerprint,
-@@ -961,6 +990,10 @@ UuidInfo *qmp_backup(
+@@ -958,6 +987,10 @@ UuidInfo *qmp_backup(
          .backup_time = backup_time,
          .has_use_dirty_bitmap = has_use_dirty_bitmap,
          .use_dirty_bitmap = use_dirty_bitmap,
@@ -194,7 +194,7 @@ index 1c49cd178d..c15abefdda 100644
          .format = format,
          .has_config_file = has_config_file,
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 3ad9eb5d1a..4120052690 100644
+index 992e6c1e3f..5ac6276dc1 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -818,6 +818,10 @@
index 86e85d25d22089e6a39bcafb3ad25ca892b3c569..1f695894d9110a913504f970038e9ab4865b3dd0 100644 (file)
@@ -20,7 +20,7 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
  create mode 100644 block/pbs.c
 
 diff --git a/block/meson.build b/block/meson.build
-index 2783b77e9c..a26a69434e 100644
+index e995ae72b9..7ef2fa72d5 100644
 --- a/block/meson.build
 +++ b/block/meson.build
 @@ -53,6 +53,9 @@ block_ss.add(files(
@@ -32,7 +32,7 @@ index 2783b77e9c..a26a69434e 100644
 +
  
  softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
+ softmmu_ss.add(files('block-ram-registrar.c'))
 diff --git a/block/pbs.c b/block/pbs.c
 new file mode 100644
 index 0000000000..9d1f1f39d4
@@ -316,18 +316,18 @@ index 0000000000..9d1f1f39d4
 +
 +block_init(bdrv_pbs_init);
 diff --git a/configure b/configure
-index 72ab03f11a..7203c270ec 100755
+index 26c7bc5154..c587e986c7 100755
 --- a/configure
 +++ b/configure
-@@ -309,6 +309,7 @@ linux_user=""
+@@ -285,6 +285,7 @@ linux_user=""
  bsd_user=""
  pie=""
  coroutine=""
 +pbs_bdrv="yes"
  plugins="$default_feature"
  meson=""
meson_args=""
-@@ -902,6 +903,10 @@ for opt do
ninja=""
+@@ -864,6 +865,10 @@ for opt do
    --enable-uuid|--disable-uuid)
        echo "$0: $opt is obsolete, UUID support is always built" >&2
    ;;
@@ -338,7 +338,7 @@ index 72ab03f11a..7203c270ec 100755
    --with-git=*) git="$optarg"
    ;;
    --with-git-submodules=*)
-@@ -1087,6 +1092,7 @@ cat << EOF
+@@ -1049,6 +1054,7 @@ cat << EOF
    debug-info      debugging information
    safe-stack      SafeStack Stack Smash Protection. Depends on
                    clang/llvm >= 3.7 and requires coroutine backend ucontext.
@@ -346,7 +346,7 @@ index 72ab03f11a..7203c270ec 100755
  
  NOTE: The object files are built at the place where configure is launched
  EOF
-@@ -2463,6 +2469,9 @@ echo "TARGET_DIRS=$target_list" >> $config_host_mak
+@@ -2372,6 +2378,9 @@ echo "TARGET_DIRS=$target_list" >> $config_host_mak
  if test "$modules" = "yes"; then
    echo "CONFIG_MODULES=y" >> $config_host_mak
  fi
@@ -357,10 +357,10 @@ index 72ab03f11a..7203c270ec 100755
  # XXX: suppress that
  if [ "$bsd" = "yes" ] ; then
 diff --git a/meson.build b/meson.build
-index f48d2e0457..be4785e2f6 100644
+index 63ea813a9a..f7f5b3f253 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -3986,7 +3986,7 @@ summary_info += {'bzip2 support':     libbzip2}
+@@ -3978,7 +3978,7 @@ summary_info += {'bzip2 support':     libbzip2}
  summary_info += {'lzfse support':     liblzfse}
  summary_info += {'zstd support':      zstd}
  summary_info += {'NUMA host support': numa}
@@ -370,18 +370,18 @@ index f48d2e0457..be4785e2f6 100644
  summary_info += {'libdaxctl support': libdaxctl}
  summary_info += {'libudev':           libudev}
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 4120052690..96bc696aaa 100644
+index 5ac6276dc1..45b63dfe26 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
-@@ -3099,6 +3099,7 @@
-             'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
-             'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
+@@ -3103,6 +3103,7 @@
+             'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum',
+             'raw', 'rbd',
              { 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
 +            'pbs',
-             'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
- ##
-@@ -3171,6 +3172,17 @@
+             'ssh', 'throttle', 'vdi', 'vhdx',
+             { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
+             { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
+@@ -3179,6 +3180,17 @@
  { 'struct': 'BlockdevOptionsNull',
    'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
  
@@ -399,11 +399,11 @@ index 4120052690..96bc696aaa 100644
  ##
  # @BlockdevOptionsNVMe:
  #
-@@ -4455,6 +4467,7 @@
+@@ -4531,6 +4543,7 @@
        'nfs':        'BlockdevOptionsNfs',
        'null-aio':   'BlockdevOptionsNull',
        'null-co':    'BlockdevOptionsNull',
 +      'pbs':        'BlockdevOptionsPbs',
        'nvme':       'BlockdevOptionsNVMe',
-       'parallels':  'BlockdevOptionsGenericFormat',
-       'preallocate':'BlockdevOptionsPreallocate',
+       'nvme-io_uring': { 'type': 'BlockdevOptionsNvmeIoUring',
+                          'if': 'CONFIG_BLKIO' },
index dbcef2946836d217b0e70bd2b34c4696fe33d60b..22ff9a68fbfe92afee915090323966e4cd80f854 100644 (file)
@@ -16,10 +16,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
  2 files changed, 38 insertions(+)
 
 diff --git a/pve-backup.c b/pve-backup.c
-index c15abefdda..4684789813 100644
+index e113ab61b9..9318ca4f0c 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
-@@ -1075,3 +1075,12 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1072,3 +1072,12 @@ BackupStatus *qmp_query_backup(Error **errp)
  
      return info;
  }
@@ -33,7 +33,7 @@ index c15abefdda..4684789813 100644
 +    return ret;
 +}
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 96bc696aaa..0b453c61d4 100644
+index 45b63dfe26..8b0e0d92de 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -863,6 +863,35 @@
index 29a96d19eef2aaece19ef2dac78f2a6e49abae68..92a19c5095241f61dc6835e809e40e2be4b84b44 100644 (file)
@@ -15,10 +15,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  3 files changed, 159 insertions(+), 42 deletions(-)
 
 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 4c1671e289..c1152f55a7 100644
+index 670f783515..d819e5fc36 100644
 --- a/monitor/hmp-cmds.c
 +++ b/monitor/hmp-cmds.c
-@@ -200,6 +200,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
+@@ -202,6 +202,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
  void hmp_info_backup(Monitor *mon, const QDict *qdict)
  {
      BackupStatus *info;
@@ -26,7 +26,7 @@ index 4c1671e289..c1152f55a7 100644
  
      info = qmp_query_backup(NULL);
  
-@@ -230,26 +231,29 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
+@@ -232,26 +233,29 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
              // this should not happen normally
              monitor_printf(mon, "Total size: %d\n", 0);
          } else {
@@ -69,7 +69,7 @@ index 4c1671e289..c1152f55a7 100644
                             info->zero_bytes, zero_per);
  
 diff --git a/pve-backup.c b/pve-backup.c
-index 4684789813..f90abaa50a 100644
+index 9318ca4f0c..c85b2ecd83 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
 @@ -46,6 +46,7 @@ static struct PVEBackupState {
@@ -80,7 +80,7 @@ index 4684789813..f90abaa50a 100644
      } stat;
      int64_t speed;
      VmaWriter *vmaw;
-@@ -672,7 +673,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -669,7 +670,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      }
  
      size_t total = 0;
@@ -88,7 +88,7 @@ index 4684789813..f90abaa50a 100644
  
      l = di_list;
      while (l) {
-@@ -693,18 +693,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -690,18 +690,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
  
      uuid_generate(uuid);
  
@@ -125,7 +125,7 @@ index 4684789813..f90abaa50a 100644
          }
  
          int dump_cb_block_size = PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE; // Hardcoded (4M)
-@@ -731,12 +746,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -728,12 +743,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
                        "proxmox_backup_new failed: %s", pbs_err);
              proxmox_backup_free_error(pbs_err);
@@ -140,7 +140,7 @@ index 4684789813..f90abaa50a 100644
  
          /* register all devices */
          l = di_list;
-@@ -747,6 +762,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -744,6 +759,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              di->block_size = dump_cb_block_size;
  
              const char *devname = bdrv_get_device_name(di->bs);
@@ -149,7 +149,7 @@ index 4684789813..f90abaa50a 100644
  
              BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
              bool expect_only_dirty = false;
-@@ -755,49 +772,59 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -752,49 +769,59 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
                  if (bitmap == NULL) {
                      bitmap = bdrv_create_dirty_bitmap(di->bs, dump_cb_block_size, PBS_BITMAP_NAME, task->errp);
                      if (!bitmap) {
@@ -219,7 +219,7 @@ index 4684789813..f90abaa50a 100644
          }
  
          /* register all devices for vma writer */
-@@ -807,7 +834,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -804,7 +831,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              l = g_list_next(l);
  
              if (!(di->target = bdrv_backup_dump_create(VMA_CLUSTER_SIZE, di->size, pvebackup_co_dump_vma_cb, di, task->errp))) {
@@ -228,7 +228,7 @@ index 4684789813..f90abaa50a 100644
              }
  
              const char *devname = bdrv_get_device_name(di->bs);
-@@ -815,16 +842,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -812,16 +839,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              if (di->dev_id <= 0) {
                  error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
                            "register_stream failed");
@@ -247,7 +247,7 @@ index 4684789813..f90abaa50a 100644
          }
          backup_dir = task->backup_file;
  
-@@ -841,18 +866,18 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -838,18 +863,18 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
                              di->size, flags, false, &local_err);
              if (local_err) {
                  error_propagate(task->errp, local_err);
@@ -269,7 +269,7 @@ index 4684789813..f90abaa50a 100644
      }
  
  
-@@ -860,7 +885,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -857,7 +882,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      if (task->has_config_file) {
          if (pvebackup_co_add_config(task->config_file, config_name, format, backup_dir,
                                      vmaw, pbs, task->errp) != 0) {
@@ -278,7 +278,7 @@ index 4684789813..f90abaa50a 100644
          }
      }
  
-@@ -868,12 +893,11 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -865,12 +890,11 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      if (task->has_firewall_file) {
          if (pvebackup_co_add_config(task->firewall_file, firewall_name, format, backup_dir,
                                      vmaw, pbs, task->errp) != 0) {
@@ -293,7 +293,7 @@ index 4684789813..f90abaa50a 100644
  
      if (backup_state.stat.error) {
          error_free(backup_state.stat.error);
-@@ -893,10 +917,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -890,10 +914,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      char *uuid_str = g_strdup(backup_state.stat.uuid_str);
  
      backup_state.stat.total = total;
@@ -305,7 +305,7 @@ index 4684789813..f90abaa50a 100644
  
      qemu_mutex_unlock(&backup_state.stat.lock);
  
-@@ -913,6 +936,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -910,6 +933,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      task->result = uuid_info;
      return;
  
@@ -315,7 +315,7 @@ index 4684789813..f90abaa50a 100644
  err:
  
      l = di_list;
-@@ -1076,11 +1102,42 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1073,11 +1099,42 @@ BackupStatus *qmp_query_backup(Error **errp)
      return info;
  }
  
@@ -359,7 +359,7 @@ index 4684789813..f90abaa50a 100644
      return ret;
  }
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 0b453c61d4..16e184dd28 100644
+index 8b0e0d92de..7fde927621 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -871,6 +871,8 @@
index c5be26b68bb68f9d9557c3befcdb99a2ff359df1..4a00163ddf466e22663883f2191955ef2c90c83d 100644 (file)
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  2 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/meson.build b/meson.build
-index be4785e2f6..3fc7c8d435 100644
+index f7f5b3f253..283b0e356e 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -1463,6 +1463,7 @@ keyutils = dependency('libkeyutils', required: false,
+@@ -1526,6 +1526,7 @@ keyutils = dependency('libkeyutils', required: false,
  has_gettid = cc.has_function('gettid')
  
  libuuid = cc.find_library('uuid', required: true)
@@ -25,7 +25,7 @@ index be4785e2f6..3fc7c8d435 100644
  libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
  
  # libselinux
-@@ -3105,6 +3106,7 @@ if have_block
+@@ -3096,6 +3097,7 @@ if have_block
    # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
    # os-win32.c does not
    blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
@@ -34,7 +34,7 @@ index be4785e2f6..3fc7c8d435 100644
  endif
  
 diff --git a/os-posix.c b/os-posix.c
-index 321fc4bd13..b1870d2690 100644
+index 4858650c3e..c5cb12226a 100644
 --- a/os-posix.c
 +++ b/os-posix.c
 @@ -28,6 +28,8 @@
@@ -46,7 +46,7 @@ index 321fc4bd13..b1870d2690 100644
  
  /* Needed early for CONFIG_BSD etc. */
  #include "net/slirp.h"
-@@ -281,9 +283,10 @@ void os_setup_post(void)
+@@ -287,9 +289,10 @@ void os_setup_post(void)
  
          dup2(fd, 0);
          dup2(fd, 1);
index b85b914e983467c124ba1b0b12ab37250a0fe899..fbf610e5107d549ef0ad1e7cfd528ab0a75a1444 100644 (file)
@@ -7,14 +7,14 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
 ---
  include/qemu/job.h | 12 ++++++++++++
- job.c              | 3+++++++++++++++++++++++++++++++
- 2 files changed, 43 insertions(+)
+ job.c              | 34 ++++++++++++++++++++++++++++++++++
+ 2 files changed, 46 insertions(+)
 
 diff --git a/include/qemu/job.h b/include/qemu/job.h
-index c105b31076..5096679571 100644
+index e502787dd8..963cf2bef5 100644
 --- a/include/qemu/job.h
 +++ b/include/qemu/job.h
-@@ -316,6 +316,18 @@ typedef enum JobCreateFlags {
+@@ -381,6 +381,18 @@ void job_unlock(void);
   */
  JobTxn *job_txn_new(void);
  
@@ -34,10 +34,10 @@ index c105b31076..5096679571 100644
   * Release a reference that was previously acquired with job_txn_add_job or
   * job_txn_new. If it's the last reference to the object, it will be freed.
 diff --git a/job.c b/job.c
-index e5699ad200..34c9758349 100644
+index 93e22d180b..2b31f1e14f 100644
 --- a/job.c
 +++ b/job.c
-@@ -72,6 +72,8 @@ struct JobTxn {
+@@ -93,6 +93,8 @@ struct JobTxn {
  
      /* Reference count */
      int refcnt;
@@ -45,8 +45,8 @@ index e5699ad200..34c9758349 100644
 +    bool sequential;
  };
  
- /* Right now, this mutex is only needed to synchronize accesses to job->busy
-@@ -102,6 +104,25 @@ JobTxn *job_txn_new(void)
+ void job_lock(void)
+@@ -118,6 +120,25 @@ JobTxn *job_txn_new(void)
      return txn;
  }
  
@@ -69,20 +69,23 @@ index e5699ad200..34c9758349 100644
 +    job_start(first);
 +}
 +
- static void job_txn_ref(JobTxn *txn)
+ /* Called with job_mutex held. */
+ static void job_txn_ref_locked(JobTxn *txn)
  {
-     txn->refcnt++;
-@@ -897,6 +918,9 @@ static void job_completed_txn_success(Job *job)
+@@ -1057,6 +1078,12 @@ static void job_completed_txn_success_locked(Job *job)
       */
      QLIST_FOREACH(other_job, &txn->jobs, txn_list) {
-         if (!job_is_completed(other_job)) {
+         if (!job_is_completed_locked(other_job)) {
 +            if (txn->sequential) {
++                job_unlock();
++                /* Needs to be called without holding the job lock */
 +                job_start(other_job);
++                job_lock();
 +            }
              return;
          }
          assert(other_job->ret == 0);
-@@ -1093,6 +1117,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
+@@ -1268,6 +1295,13 @@ int job_finish_sync_locked(Job *job,
          return -EBUSY;
      }
  
@@ -90,9 +93,9 @@ index e5699ad200..34c9758349 100644
 +     * of cancelling, these have not begun work so job_enter won't do anything,
 +     * let's ensure they are marked as ABORTING if required */
 +    if (job->status == JOB_STATUS_CREATED && job->txn->sequential) {
-+        job_update_rc(job);
++        job_update_rc_locked(job);
 +    }
 +
-     AIO_WAIT_WHILE(job->aio_context,
-                    (job_enter(job), !job_is_completed(job)));
+     job_unlock();
+     AIO_WAIT_WHILE_UNLOCKED(job->aio_context,
+                             (job_enter(job), !job_is_completed(job)));
index 1a08f4bb00632e73a3b7f5d32a91bb514d84a6ea..abda21bbf7b8a60d8539b5680c00fb2600da0002 100644 (file)
@@ -12,14 +12,15 @@ transaction, so drives will still be backed up one after the other.
 
 Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-[add new force parameter to job_cancel_sync calls]
-Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
+[FE: add new force parameter to job_cancel_sync calls
+     adapt for new job lock mechanism replacing AioContext locks]
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 ---
- pve-backup.c | 167 +++++++++++++++------------------------------------
- 1 file changed, 49 insertions(+), 118 deletions(-)
+ pve-backup.c | 163 ++++++++++++++++-----------------------------------
+ 1 file changed, 50 insertions(+), 113 deletions(-)
 
 diff --git a/pve-backup.c b/pve-backup.c
-index f90abaa50a..63c686463f 100644
+index c85b2ecd83..b5fb844434 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
 @@ -52,6 +52,7 @@ static struct PVEBackupState {
@@ -30,7 +31,7 @@ index f90abaa50a..63c686463f 100644
      QemuMutex backup_mutex;
      CoMutex dump_callback_mutex;
  } backup_state;
-@@ -71,32 +72,12 @@ typedef struct PVEBackupDevInfo {
+@@ -71,34 +72,12 @@ typedef struct PVEBackupDevInfo {
      size_t size;
      uint64_t block_size;
      uint8_t dev_id;
@@ -47,14 +48,16 @@ index f90abaa50a..63c686463f 100644
 -lookup_active_block_job(PVEBackupDevInfo *di)
 -{
 -    if (!di->completed && di->bs) {
--        for (BlockJob *job = block_job_next(NULL); job; job = block_job_next(job)) {
--            if (job->job.driver->job_type != JOB_TYPE_BACKUP) {
--                continue;
--            }
+-        WITH_JOB_LOCK_GUARD() {
+-            for (BlockJob *job = block_job_next_locked(NULL); job; job = block_job_next_locked(job)) {
+-                if (job->job.driver->job_type != JOB_TYPE_BACKUP) {
+-                    continue;
+-                }
 -
--            BackupBlockJob *bjob = container_of(job, BackupBlockJob, common);
--            if (bjob && bjob->source_bs == di->bs) {
--                return job;
+-                BackupBlockJob *bjob = container_of(job, BackupBlockJob, common);
+-                if (bjob && bjob->source_bs == di->bs) {
+-                    return job;
+-                }
 -            }
 -        }
 -    }
@@ -64,7 +67,7 @@ index f90abaa50a..63c686463f 100644
  static void pvebackup_propagate_error(Error *err)
  {
      qemu_mutex_lock(&backup_state.stat.lock);
-@@ -272,18 +253,6 @@ static void coroutine_fn pvebackup_co_cleanup(void *unused)
+@@ -274,18 +253,6 @@ static void coroutine_fn pvebackup_co_cleanup(void *unused)
              if (local_err != NULL) {
                  pvebackup_propagate_error(local_err);
              }
@@ -83,7 +86,7 @@ index f90abaa50a..63c686463f 100644
          }
  
          proxmox_backup_disconnect(backup_state.pbs);
-@@ -322,8 +291,6 @@ static void pvebackup_complete_cb(void *opaque, int ret)
+@@ -324,8 +291,6 @@ static void pvebackup_complete_cb(void *opaque, int ret)
  
      qemu_mutex_lock(&backup_state.backup_mutex);
  
@@ -92,7 +95,7 @@ index f90abaa50a..63c686463f 100644
      if (ret < 0) {
          Error *local_err = NULL;
          error_setg(&local_err, "job failed with err %d - %s", ret, strerror(-ret));
-@@ -336,20 +303,17 @@ static void pvebackup_complete_cb(void *opaque, int ret)
+@@ -338,20 +303,17 @@ static void pvebackup_complete_cb(void *opaque, int ret)
  
      block_on_coroutine_fn(pvebackup_complete_stream, di);
  
@@ -119,7 +122,7 @@ index f90abaa50a..63c686463f 100644
  }
  
  static void pvebackup_cancel(void)
-@@ -371,36 +335,28 @@ static void pvebackup_cancel(void)
+@@ -373,32 +335,28 @@ static void pvebackup_cancel(void)
          proxmox_backup_abort(backup_state.pbs, "backup canceled");
      }
  
@@ -128,13 +131,6 @@ index f90abaa50a..63c686463f 100644
 -    for(;;) {
 -
 -        BlockJob *next_job = NULL;
--
--        qemu_mutex_lock(&backup_state.backup_mutex);
--
--        GList *l = backup_state.di_list;
--        while (l) {
--            PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
--            l = g_list_next(l);
 +    /* it's enough to cancel one job in the transaction, the rest will follow
 +     * automatically */
 +    GList *bdi = g_list_first(backup_state.di_list);
@@ -142,15 +138,23 @@ index f90abaa50a..63c686463f 100644
 +        ((PVEBackupDevInfo *)bdi->data)->job :
 +        NULL;
  
+-        qemu_mutex_lock(&backup_state.backup_mutex);
+-
+-        GList *l = backup_state.di_list;
+-        while (l) {
+-            PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
+-            l = g_list_next(l);
+-
 -            BlockJob *job = lookup_active_block_job(di);
 -            if (job != NULL) {
 -                next_job = job;
 -                break;
 -            }
--        }
 +    /* ref the job before releasing the mutex, just to be safe */
 +    if (cancel_job) {
-+        job_ref(&cancel_job->job);
++        WITH_JOB_LOCK_GUARD() {
++            job_ref_locked(&cancel_job->job);
+         }
 +    }
  
 -        qemu_mutex_unlock(&backup_state.backup_mutex);
@@ -159,27 +163,21 @@ index f90abaa50a..63c686463f 100644
 +    qemu_mutex_unlock(&backup_state.backup_mutex);
  
 -        if (next_job) {
--            AioContext *aio_context = next_job->job.aio_context;
--            aio_context_acquire(aio_context);
 -            job_cancel_sync(&next_job->job, true);
--            aio_context_release(aio_context);
 -        } else {
 -            break;
--        }
 +    if (cancel_job) {
-+        AioContext *aio_context = cancel_job->job.aio_context;
-+        aio_context_acquire(aio_context);
-+        job_cancel_sync(&cancel_job->job, true);
-+        job_unref(&cancel_job->job);
-+        aio_context_release(aio_context);
++        WITH_JOB_LOCK_GUARD() {
++            job_cancel_sync_locked(&cancel_job->job, true);
++            job_unref_locked(&cancel_job->job);
+         }
      }
  }
-@@ -459,51 +415,19 @@ static int coroutine_fn pvebackup_co_add_config(
+@@ -458,49 +416,19 @@ static int coroutine_fn pvebackup_co_add_config(
      goto out;
  }
  
--bool job_should_pause(Job *job);
+-bool job_should_pause_locked(Job *job);
 -
 -static void pvebackup_run_next_job(void)
 -{
@@ -197,18 +195,16 @@ index f90abaa50a..63c686463f 100644
 -        if (job) {
 -            qemu_mutex_unlock(&backup_state.backup_mutex);
 -
--            AioContext *aio_context = job->job.aio_context;
--            aio_context_acquire(aio_context);
--
--            if (job_should_pause(&job->job)) {
--                bool error_or_canceled = pvebackup_error_or_canceled();
--                if (error_or_canceled) {
--                    job_cancel_sync(&job->job, true);
--                } else {
--                    job_resume(&job->job);
+-            WITH_JOB_LOCK_GUARD() {
+-                if (job_should_pause_locked(&job->job)) {
+-                    bool error_or_canceled = pvebackup_error_or_canceled();
+-                    if (error_or_canceled) {
+-                        job_cancel_sync_locked(&job->job, true);
+-                    } else {
+-                        job_resume_locked(&job->job);
+-                    }
 -                }
 -            }
--            aio_context_release(aio_context);
 -            return;
 -        }
 -    }
@@ -234,7 +230,7 @@ index f90abaa50a..63c686463f 100644
      BackupPerf perf = { .max_workers = 16 };
  
      /* create and start all jobs (paused state) */
-@@ -526,7 +450,7 @@ static bool create_backup_jobs(void) {
+@@ -523,7 +451,7 @@ static bool create_backup_jobs(void) {
          BlockJob *job = backup_job_create(
              NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap,
              bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
@@ -243,7 +239,7 @@ index f90abaa50a..63c686463f 100644
  
          aio_context_release(aio_context);
  
-@@ -538,7 +462,8 @@ static bool create_backup_jobs(void) {
+@@ -535,7 +463,8 @@ static bool create_backup_jobs(void) {
              pvebackup_propagate_error(create_job_err);
              break;
          }
@@ -253,18 +249,20 @@ index f90abaa50a..63c686463f 100644
  
          bdrv_unref(di->target);
          di->target = NULL;
-@@ -556,6 +481,10 @@ static bool create_backup_jobs(void) {
+@@ -553,6 +482,12 @@ static bool create_backup_jobs(void) {
                  bdrv_unref(di->target);
                  di->target = NULL;
              }
 +
 +            if (di->job) {
-+                job_unref(&di->job->job);
++                WITH_JOB_LOCK_GUARD() {
++                    job_unref_locked(&di->job->job);
++                }
 +            }
          }
      }
  
-@@ -946,10 +875,6 @@ err:
+@@ -943,10 +878,6 @@ err:
          PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
          l = g_list_next(l);
  
@@ -275,7 +273,7 @@ index f90abaa50a..63c686463f 100644
          if (di->target) {
              bdrv_unref(di->target);
          }
-@@ -1038,9 +963,15 @@ UuidInfo *qmp_backup(
+@@ -1035,9 +966,15 @@ UuidInfo *qmp_backup(
      block_on_coroutine_fn(pvebackup_co_prepare, &task);
  
      if (*errp == NULL) {
index 44c167b70e44ef324cc202f9eb99096bf4ee07f0..e13b2d2fafe999956eb24943beaa6e52f4029b03 100644 (file)
@@ -49,15 +49,15 @@ before.
 
 Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-[add new force parameter to job_cancel_sync calls]
-Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
+[FE: add new force parameter to job_cancel_sync calls]
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 ---
- pve-backup.c         | 217 ++++++++++++++++++++++++++++---------------
+ pve-backup.c         | 212 +++++++++++++++++++++++++++----------------
  qapi/block-core.json |   5 +-
- 2 files changed, 144 insertions(+), 78 deletions(-)
+ 2 files changed, 138 insertions(+), 79 deletions(-)
 
 diff --git a/pve-backup.c b/pve-backup.c
-index 63c686463f..6f05796fad 100644
+index b5fb844434..88268bb586 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
 @@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap";
@@ -192,7 +192,7 @@ index 63c686463f..6f05796fad 100644
  
      // remove self from job list
      backup_state.di_list = g_list_remove(backup_state.di_list, di);
-@@ -310,21 +321,49 @@ static void pvebackup_complete_cb(void *opaque, int ret)
+@@ -310,21 +321,46 @@ static void pvebackup_complete_cb(void *opaque, int ret)
  
      /* call cleanup if we're the last job */
      if (!g_list_first(backup_state.di_list)) {
@@ -229,10 +229,7 @@ index 63c686463f..6f05796fad 100644
 +static void job_cancel_bh(void *opaque) {
 +    CoCtxData *data = (CoCtxData*)opaque;
 +    Job *job = (Job*)data->data;
-+    AioContext *job_ctx = job->aio_context;
-+    aio_context_acquire(job_ctx);
 +    job_cancel_sync(job, true);
-+    aio_context_release(job_ctx);
 +    aio_co_enter(data->ctx, data->co);
 +}
  
@@ -247,13 +244,15 @@ index 63c686463f..6f05796fad 100644
  
      if (backup_state.vmaw) {
          /* make sure vma writer does not block anymore */
-@@ -342,27 +381,22 @@ static void pvebackup_cancel(void)
+@@ -342,28 +378,22 @@ static void pvebackup_cancel(void)
          ((PVEBackupDevInfo *)bdi->data)->job :
          NULL;
  
 -    /* ref the job before releasing the mutex, just to be safe */
      if (cancel_job) {
--        job_ref(&cancel_job->job);
+-        WITH_JOB_LOCK_GUARD() {
+-            job_ref_locked(&cancel_job->job);
+-        }
 +        CoCtxData data = {
 +            .ctx = qemu_get_current_aio_context(),
 +            .co = qemu_coroutine_self(),
@@ -268,11 +267,10 @@ index 63c686463f..6f05796fad 100644
 -    qemu_mutex_unlock(&backup_state.backup_mutex);
 -
 -    if (cancel_job) {
--        AioContext *aio_context = cancel_job->job.aio_context;
--        aio_context_acquire(aio_context);
--        job_cancel_sync(&cancel_job->job, true);
--        job_unref(&cancel_job->job);
--        aio_context_release(aio_context);
+-        WITH_JOB_LOCK_GUARD() {
+-            job_cancel_sync_locked(&cancel_job->job, true);
+-            job_unref_locked(&cancel_job->job);
+-        }
 -    }
 +    qemu_co_mutex_unlock(&backup_state.backup_mutex);
  }
@@ -284,7 +282,7 @@ index 63c686463f..6f05796fad 100644
  }
  
  // assumes the caller holds backup_mutex
-@@ -415,10 +449,18 @@ static int coroutine_fn pvebackup_co_add_config(
+@@ -416,10 +446,18 @@ static int coroutine_fn pvebackup_co_add_config(
      goto out;
  }
  
@@ -304,7 +302,7 @@ index 63c686463f..6f05796fad 100644
      Error *local_err = NULL;
  
      /* create job transaction to synchronize bitmap commit and cancel all
-@@ -454,24 +496,19 @@ static bool create_backup_jobs(void) {
+@@ -455,24 +493,19 @@ static bool create_backup_jobs(void) {
  
          aio_context_release(aio_context);
  
@@ -334,15 +332,13 @@ index 63c686463f..6f05796fad 100644
          l = backup_state.di_list;
          while (l) {
              PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
-@@ -483,12 +520,17 @@ static bool create_backup_jobs(void) {
-             }
+@@ -485,13 +518,15 @@ static bool create_backup_jobs(void) {
  
              if (di->job) {
-+                AioContext *ctx = di->job->job.aio_context;
-+                aio_context_acquire(ctx);
-+                job_cancel_sync(&di->job->job, true);
-                 job_unref(&di->job->job);
-+                aio_context_release(ctx);
+                 WITH_JOB_LOCK_GUARD() {
++                    job_cancel_sync_locked(&di->job->job, true);
+                     job_unref_locked(&di->job->job);
+                 }
              }
          }
      }
@@ -353,7 +349,7 @@ index 63c686463f..6f05796fad 100644
  }
  
  typedef struct QmpBackupTask {
-@@ -525,11 +567,12 @@ typedef struct QmpBackupTask {
+@@ -528,11 +563,12 @@ typedef struct QmpBackupTask {
      UuidInfo *result;
  } QmpBackupTask;
  
@@ -367,7 +363,7 @@ index 63c686463f..6f05796fad 100644
      QmpBackupTask *task = opaque;
  
      task->result = NULL; // just to be sure
-@@ -550,8 +593,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -553,8 +589,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      const char *firewall_name = "qemu-server.fw";
  
      if (backup_state.di_list) {
@@ -378,7 +374,7 @@ index 63c686463f..6f05796fad 100644
          return;
      }
  
-@@ -618,6 +662,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -621,6 +658,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
          }
          di->size = size;
          total += size;
@@ -387,7 +383,7 @@ index 63c686463f..6f05796fad 100644
      }
  
      uuid_generate(uuid);
-@@ -849,6 +895,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -852,6 +891,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      backup_state.stat.dirty = total - backup_state.stat.reused;
      backup_state.stat.transferred = 0;
      backup_state.stat.zero_bytes = 0;
@@ -396,7 +392,7 @@ index 63c686463f..6f05796fad 100644
  
      qemu_mutex_unlock(&backup_state.stat.lock);
  
-@@ -863,6 +911,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -866,6 +907,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      uuid_info->UUID = uuid_str;
  
      task->result = uuid_info;
@@ -430,7 +426,7 @@ index 63c686463f..6f05796fad 100644
      return;
  
  err_mutex:
-@@ -885,6 +960,7 @@ err:
+@@ -888,6 +956,7 @@ err:
          g_free(di);
      }
      g_list_free(di_list);
@@ -438,7 +434,7 @@ index 63c686463f..6f05796fad 100644
  
      if (devs) {
          g_strfreev(devs);
-@@ -905,6 +981,8 @@ err:
+@@ -908,6 +977,8 @@ err:
      }
  
      task->result = NULL;
@@ -447,7 +443,7 @@ index 63c686463f..6f05796fad 100644
      return;
  }
  
-@@ -958,24 +1036,8 @@ UuidInfo *qmp_backup(
+@@ -961,24 +1032,8 @@ UuidInfo *qmp_backup(
          .errp = errp,
      };
  
@@ -472,7 +468,7 @@ index 63c686463f..6f05796fad 100644
      return task.result;
  }
  
-@@ -1027,6 +1089,7 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1030,6 +1085,7 @@ BackupStatus *qmp_query_backup(Error **errp)
      info->transferred = backup_state.stat.transferred;
      info->has_reused = true;
      info->reused = backup_state.stat.reused;
@@ -481,7 +477,7 @@ index 63c686463f..6f05796fad 100644
      qemu_mutex_unlock(&backup_state.stat.lock);
  
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 16e184dd28..cb17d00fe0 100644
+index 7fde927621..bf559c6d52 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -770,12 +770,15 @@
index e80a716be9b5fe260180400ec7c6c1892c592f40..fd338a529b1d7caab803ebafeee9b76c24c3fb7c 100644 (file)
@@ -51,7 +51,7 @@ index 0842d00cd2..d012f4d8d3 100644
  softmmu_ss.add(files(
    'block-dirty-bitmap.c',
 diff --git a/migration/migration.c b/migration/migration.c
-index bb8bbddfe4..8109e468eb 100644
+index f485eea5fb..89b287180f 100644
 --- a/migration/migration.c
 +++ b/migration/migration.c
 @@ -229,6 +229,7 @@ void migration_object_init(void)
@@ -175,10 +175,10 @@ index 0000000000..29f2b3860d
 +                         NULL);
 +}
 diff --git a/pve-backup.c b/pve-backup.c
-index 6f05796fad..5fa3cc1352 100644
+index 88268bb586..fa9c6c4493 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
-@@ -1132,6 +1132,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+@@ -1128,6 +1128,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
      ret->pbs_library_version = g_strdup(proxmox_backup_qemu_version());
      ret->pbs_dirty_bitmap = true;
      ret->pbs_dirty_bitmap_savevm = true;
@@ -187,7 +187,7 @@ index 6f05796fad..5fa3cc1352 100644
      return ret;
  }
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index cb17d00fe0..bd978ea562 100644
+index bf559c6d52..24f30260c8 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -879,6 +879,11 @@
index bed3e62f18413aebf60b1343d2f35a4eb394520c..afaddcf1f617f7e11cba5179656c1449d5b53e18 100644 (file)
@@ -21,10 +21,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 30 insertions(+)
 
 diff --git a/block/iscsi.c b/block/iscsi.c
-index d707d0b354..da6ed52323 100644
+index a316d46d96..3ed4a50c0d 100644
 --- a/block/iscsi.c
 +++ b/block/iscsi.c
-@@ -1386,12 +1386,42 @@ static char *get_initiator_name(QemuOpts *opts)
+@@ -1387,12 +1387,42 @@ static char *get_initiator_name(QemuOpts *opts)
      const char *name;
      char *iscsi_name;
      UuidInfo *uuid_info;
index c07cdce7411e1aa44c3563396f8866faed301538..58a3556acb91734df00342b0ec7bef96a4d3c6bc 100644 (file)
@@ -32,7 +32,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  5 files changed, 77 insertions(+), 196 deletions(-)
 
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index ea7b665aa2..ef45552e3b 100644
+index a09f722fea..71ed202491 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
 @@ -1016,7 +1016,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
@@ -54,7 +54,7 @@ index ea7b665aa2..ef45552e3b 100644
      Error *error = NULL;
  
 diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 97f24942b3..7a2be816da 100644
+index fcf9461295..5fdb198ca4 100644
 --- a/hmp-commands.hx
 +++ b/hmp-commands.hx
 @@ -111,6 +111,7 @@ ERST
@@ -116,10 +116,10 @@ index 4ce7bc0b5e..0923037dec 100644
  static void proxmox_backup_schedule_wake(void *data) {
      CoCtxData *waker = (CoCtxData *)data;
 diff --git a/pve-backup.c b/pve-backup.c
-index 5fa3cc1352..323014744c 100644
+index fa9c6c4493..109498eaf9 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
-@@ -357,7 +357,7 @@ static void job_cancel_bh(void *opaque) {
+@@ -354,7 +354,7 @@ static void job_cancel_bh(void *opaque) {
      aio_co_enter(data->ctx, data->co);
  }
  
@@ -128,7 +128,7 @@ index 5fa3cc1352..323014744c 100644
  {
      Error *cancel_err = NULL;
      error_setg(&cancel_err, "backup canceled");
-@@ -394,11 +394,6 @@ static void coroutine_fn pvebackup_co_cancel(void *opaque)
+@@ -391,11 +391,6 @@ static void coroutine_fn pvebackup_co_cancel(void *opaque)
      qemu_co_mutex_unlock(&backup_state.backup_mutex);
  }
  
@@ -140,7 +140,7 @@ index 5fa3cc1352..323014744c 100644
  // assumes the caller holds backup_mutex
  static int coroutine_fn pvebackup_co_add_config(
      const char *file,
-@@ -533,50 +528,27 @@ static void create_backup_jobs_bh(void *opaque) {
+@@ -529,50 +524,27 @@ static void create_backup_jobs_bh(void *opaque) {
      aio_co_enter(data->ctx, data->co);
  }
  
@@ -207,7 +207,7 @@ index 5fa3cc1352..323014744c 100644
      BlockBackend *blk;
      BlockDriverState *bs = NULL;
      const char *backup_dir = NULL;
-@@ -593,17 +565,17 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -589,17 +561,17 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      const char *firewall_name = "qemu-server.fw";
  
      if (backup_state.di_list) {
@@ -230,7 +230,7 @@ index 5fa3cc1352..323014744c 100644
  
          gchar **d = devs;
          while (d && *d) {
-@@ -611,14 +583,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -607,14 +579,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              if (blk) {
                  bs = blk_bs(blk);
                  if (!bdrv_is_inserted(bs)) {
@@ -247,7 +247,7 @@ index 5fa3cc1352..323014744c 100644
                            "Device '%s' not found", *d);
                  goto err;
              }
-@@ -641,7 +613,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -637,7 +609,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      }
  
      if (!di_list) {
@@ -256,7 +256,7 @@ index 5fa3cc1352..323014744c 100644
          goto err;
      }
  
-@@ -651,13 +623,13 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -647,13 +619,13 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      while (l) {
          PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
          l = g_list_next(l);
@@ -272,7 +272,7 @@ index 5fa3cc1352..323014744c 100644
              goto err;
          }
          di->size = size;
-@@ -684,47 +656,44 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -680,47 +652,44 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      }
  
      if (format == BACKUP_FORMAT_PBS) {
@@ -337,7 +337,7 @@ index 5fa3cc1352..323014744c 100644
          if (connect_result < 0)
              goto err_mutex;
  
-@@ -743,9 +712,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -739,9 +708,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
              bool expect_only_dirty = false;
  
@@ -349,7 +349,7 @@ index 5fa3cc1352..323014744c 100644
                      if (!bitmap) {
                          goto err_mutex;
                      }
-@@ -775,12 +744,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -771,12 +740,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
                  }
              }
  
@@ -364,7 +364,7 @@ index 5fa3cc1352..323014744c 100644
                  goto err_mutex;
              }
  
-@@ -794,10 +763,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -790,10 +759,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              backup_state.stat.bitmap_list = g_list_append(backup_state.stat.bitmap_list, info);
          }
      } else if (format == BACKUP_FORMAT_VMA) {
@@ -377,7 +377,7 @@ index 5fa3cc1352..323014744c 100644
              }
              goto err_mutex;
          }
-@@ -808,25 +777,25 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -804,25 +773,25 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
              l = g_list_next(l);
  
@@ -409,7 +409,7 @@ index 5fa3cc1352..323014744c 100644
  
          l = di_list;
          while (l) {
-@@ -840,34 +809,34 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -836,34 +805,34 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
              bdrv_img_create(di->targetfile, "raw", NULL, NULL, NULL,
                              di->size, flags, false, &local_err);
              if (local_err) {
@@ -453,7 +453,7 @@ index 5fa3cc1352..323014744c 100644
              goto err_mutex;
          }
      }
-@@ -885,7 +854,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -881,7 +850,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      if (backup_state.stat.backup_file) {
          g_free(backup_state.stat.backup_file);
      }
@@ -462,7 +462,7 @@ index 5fa3cc1352..323014744c 100644
  
      uuid_copy(backup_state.stat.uuid, uuid);
      uuid_unparse_lower(uuid, backup_state.stat.uuid_str);
-@@ -900,7 +869,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -896,7 +865,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
  
      qemu_mutex_unlock(&backup_state.stat.lock);
  
@@ -471,7 +471,7 @@ index 5fa3cc1352..323014744c 100644
  
      backup_state.vmaw = vmaw;
      backup_state.pbs = pbs;
-@@ -910,8 +879,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -906,8 +875,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      uuid_info = g_malloc0(sizeof(*uuid_info));
      uuid_info->UUID = uuid_str;
  
@@ -480,7 +480,7 @@ index 5fa3cc1352..323014744c 100644
      /* Run create_backup_jobs_bh outside of coroutine (in BH) but keep
      * backup_mutex locked. This is fine, a CoMutex can be held across yield
      * points, and we'll release it as soon as the BH reschedules us.
-@@ -925,7 +892,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -921,7 +888,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      qemu_coroutine_yield();
  
      if (local_err) {
@@ -489,7 +489,7 @@ index 5fa3cc1352..323014744c 100644
          goto err;
      }
  
-@@ -938,7 +905,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -934,7 +901,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
      /* start the first job in the transaction */
      job_txn_start_seq(backup_state.txn);
  
@@ -498,7 +498,7 @@ index 5fa3cc1352..323014744c 100644
  
  err_mutex:
      qemu_mutex_unlock(&backup_state.stat.lock);
-@@ -969,7 +936,7 @@ err:
+@@ -965,7 +932,7 @@ err:
      if (vmaw) {
          Error *err = NULL;
          vma_writer_close(vmaw, &err);
@@ -507,7 +507,7 @@ index 5fa3cc1352..323014744c 100644
      }
  
      if (pbs) {
-@@ -980,65 +947,8 @@ err:
+@@ -976,65 +943,8 @@ err:
          rmdir(backup_dir);
      }
  
@@ -575,7 +575,7 @@ index 5fa3cc1352..323014744c 100644
  
  BackupStatus *qmp_query_backup(Error **errp)
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index bd978ea562..ca1966f54b 100644
+index 24f30260c8..4e8c35a3a2 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -842,7 +842,7 @@
index 1716c05cbea2609184ba45414df541a4afcac0c7..7c708d750c0d0fe9ef2bdcdf2a26c9c1d422f4a2 100644 (file)
@@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  3 files changed, 11 insertions(+)
 
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index ef45552e3b..4c799f00d9 100644
+index 71ed202491..c7468e5d3b 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
 @@ -1039,6 +1039,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
@@ -31,10 +31,10 @@ index ef45552e3b..4c799f00d9 100644
          false, NULL, // PBS backup-id
          false, 0, // PBS backup-time
 diff --git a/pve-backup.c b/pve-backup.c
-index 323014744c..9f6c04a512 100644
+index 109498eaf9..4b5134ed27 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
-@@ -533,6 +533,7 @@ UuidInfo coroutine_fn *qmp_backup(
+@@ -529,6 +529,7 @@ UuidInfo coroutine_fn *qmp_backup(
      bool has_password, const char *password,
      bool has_keyfile, const char *keyfile,
      bool has_key_password, const char *key_password,
@@ -42,7 +42,7 @@ index 323014744c..9f6c04a512 100644
      bool has_fingerprint, const char *fingerprint,
      bool has_backup_id, const char *backup_id,
      bool has_backup_time, int64_t backup_time,
-@@ -681,6 +682,7 @@ UuidInfo coroutine_fn *qmp_backup(
+@@ -677,6 +678,7 @@ UuidInfo coroutine_fn *qmp_backup(
              has_password ? password : NULL,
              has_keyfile ? keyfile : NULL,
              has_key_password ? key_password : NULL,
@@ -50,7 +50,7 @@ index 323014744c..9f6c04a512 100644
              has_compress ? compress : true,
              has_encrypt ? encrypt : has_keyfile,
              has_fingerprint ? fingerprint : NULL,
-@@ -1044,5 +1046,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+@@ -1040,5 +1042,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
      ret->pbs_dirty_bitmap_savevm = true;
      ret->pbs_dirty_bitmap_migration = true;
      ret->query_bitmap_info = true;
@@ -58,7 +58,7 @@ index 323014744c..9f6c04a512 100644
      return ret;
  }
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index ca1966f54b..fc8a125451 100644
+index 4e8c35a3a2..d8c7331090 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -813,6 +813,8 @@
index 48e6d67ed72d15716b2c8b3c986f61b5f603b3a4..1df613d49139c9b4e73c4284a9e553f8c7164f04 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 14 insertions(+), 3 deletions(-)
 
 diff --git a/block/pbs.c b/block/pbs.c
-index 0b05ea9080..c5eb4d5bad 100644
+index 9d1f1f39d4..ce9a870885 100644
 --- a/block/pbs.c
 +++ b/block/pbs.c
 @@ -200,7 +200,16 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
index b294d438b2edd82197dd146886dd073a77a41440..269d392a56a3945797737411472b8d4b249ccb6b 100644 (file)
@@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 4 insertions(+)
 
 diff --git a/block/io.c b/block/io.c
-index 0a8cbefe86..531b3b7a2d 100644
+index b9424024f9..01f50d28c8 100644
 --- a/block/io.c
 +++ b/block/io.c
-@@ -1734,6 +1734,10 @@ static int bdrv_pad_request(BlockDriverState *bs,
+@@ -1730,6 +1730,10 @@ static int bdrv_pad_request(BlockDriverState *bs,
  {
      int ret;
  
index d47c84baff04228c4af7249864ac8cf95fdbb756..833b79acbc1a95e0a5adaad901d17b0dcc79d8c8 100644 (file)
@@ -390,7 +390,7 @@ index 0000000000..43d40d11af
 +
 +block_init(bdrv_alloc_track_init);
 diff --git a/block/meson.build b/block/meson.build
-index a26a69434e..74e5f49758 100644
+index 7ef2fa72d5..15352f579f 100644
 --- a/block/meson.build
 +++ b/block/meson.build
 @@ -2,6 +2,7 @@ block_ss.add(genh)
index 68622c27c086c4ae78ea35be2446435dc3bf5578..b25c9fc1aef75043b21ebde2fc3658a507287da5 100644 (file)
@@ -11,7 +11,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  1 file changed, 5 insertions(+)
 
 diff --git a/migration/savevm-async.c b/migration/savevm-async.c
-index e65a5e3482..2ed2536816 100644
+index bafe6ae5eb..da3634048f 100644
 --- a/migration/savevm-async.c
 +++ b/migration/savevm-async.c
 @@ -20,6 +20,7 @@
index e5c467dc52ffd014c875e9da98305858cdf9bd07..ed75a35c94ebedbc56f6aba1c490b6f9abbe66f0 100644 (file)
@@ -12,7 +12,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
  3 files changed, 36 insertions(+), 7 deletions(-)
 
 diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
-index 699229eef6..4189ced8bc 100644
+index 5e713e231d..9390d5e5cf 100644
 --- a/docs/tools/qemu-img.rst
 +++ b/docs/tools/qemu-img.rst
 @@ -492,10 +492,10 @@ Command description:
@@ -46,10 +46,10 @@ index b5b0bb4467..36f97e1f19 100644
  
  DEF("info", img_info,
 diff --git a/qemu-img.c b/qemu-img.c
-index c6b4a5567d..041c203fc3 100644
+index 59c403373b..065a54cc42 100644
 --- a/qemu-img.c
 +++ b/qemu-img.c
-@@ -4943,6 +4943,7 @@ static int img_dd(int argc, char **argv)
+@@ -4946,6 +4946,7 @@ static int img_dd(int argc, char **argv)
      BlockDriver *drv = NULL, *proto_drv = NULL;
      BlockBackend *blk1 = NULL, *blk2 = NULL;
      QemuOpts *opts = NULL;
@@ -57,15 +57,15 @@ index c6b4a5567d..041c203fc3 100644
      QemuOptsList *create_opts = NULL;
      Error *local_err = NULL;
      bool image_opts = false;
-@@ -4952,6 +4953,7 @@ static int img_dd(int argc, char **argv)
+@@ -4955,6 +4956,7 @@ static int img_dd(int argc, char **argv)
      int64_t size = 0, readsize = 0;
-     int64_t block_count = 0, out_pos, in_pos;
+     int64_t out_pos, in_pos;
      bool force_share = false, skip_create = false;
 +    const char *snapshot_name = NULL;
      struct DdInfo dd = {
          .flags = 0,
          .count = 0,
-@@ -4989,7 +4991,7 @@ static int img_dd(int argc, char **argv)
+@@ -4992,7 +4994,7 @@ static int img_dd(int argc, char **argv)
          { 0, 0, 0, 0 }
      };
  
@@ -74,7 +74,7 @@ index c6b4a5567d..041c203fc3 100644
          if (c == EOF) {
              break;
          }
-@@ -5012,6 +5014,19 @@ static int img_dd(int argc, char **argv)
+@@ -5015,6 +5017,19 @@ static int img_dd(int argc, char **argv)
          case 'n':
              skip_create = true;
              break;
@@ -94,7 +94,7 @@ index c6b4a5567d..041c203fc3 100644
          case 'U':
              force_share = true;
              break;
-@@ -5071,11 +5086,24 @@ static int img_dd(int argc, char **argv)
+@@ -5074,11 +5089,24 @@ static int img_dd(int argc, char **argv)
      if (dd.flags & C_IF) {
          blk1 = img_open(image_opts, in.filename, fmt, 0, false, false,
                          force_share);
@@ -120,7 +120,7 @@ index c6b4a5567d..041c203fc3 100644
      }
  
      if (dd.flags & C_OSIZE) {
-@@ -5230,6 +5258,7 @@ static int img_dd(int argc, char **argv)
+@@ -5233,6 +5261,7 @@ static int img_dd(int argc, char **argv)
  out:
      g_free(arg);
      qemu_opts_del(opts);
index dce468d720492aa02f90679611593d54781fab83..2640b95afdc6a7ce245bba1175a4788e7294982e 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
  5 files changed, 47 insertions(+), 9 deletions(-)
 
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 4c799f00d9..0502f42be6 100644
+index c7468e5d3b..57b2457f1e 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
 @@ -1041,6 +1041,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
@@ -25,7 +25,7 @@ index 4c799f00d9..0502f42be6 100644
          false, 0, // PBS backup-time
          false, false, // PBS use-dirty-bitmap
 diff --git a/block/pbs.c b/block/pbs.c
-index c5eb4d5bad..7471e2ef9d 100644
+index ce9a870885..9192f3e41b 100644
 --- a/block/pbs.c
 +++ b/block/pbs.c
 @@ -14,6 +14,7 @@
@@ -170,7 +170,7 @@ index 2f834cf42e..f03d9bab8d 100644
          fprintf(stderr, "restore failed: %s\n", pbs_error);
          return -1;
 diff --git a/pve-backup.c b/pve-backup.c
-index 9f6c04a512..f6a5f8c785 100644
+index 4b5134ed27..262e7d3894 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
 @@ -10,6 +10,8 @@
@@ -182,7 +182,7 @@ index 9f6c04a512..f6a5f8c785 100644
  /* PVE backup state and related function */
  
  /*
-@@ -535,6 +537,7 @@ UuidInfo coroutine_fn *qmp_backup(
+@@ -531,6 +533,7 @@ UuidInfo coroutine_fn *qmp_backup(
      bool has_key_password, const char *key_password,
      bool has_master_keyfile, const char *master_keyfile,
      bool has_fingerprint, const char *fingerprint,
@@ -190,7 +190,7 @@ index 9f6c04a512..f6a5f8c785 100644
      bool has_backup_id, const char *backup_id,
      bool has_backup_time, int64_t backup_time,
      bool has_use_dirty_bitmap, bool use_dirty_bitmap,
-@@ -674,8 +677,9 @@ UuidInfo coroutine_fn *qmp_backup(
+@@ -670,8 +673,9 @@ UuidInfo coroutine_fn *qmp_backup(
          firewall_name = "fw.conf";
  
          char *pbs_err = NULL;
@@ -202,7 +202,7 @@ index 9f6c04a512..f6a5f8c785 100644
              backup_time,
              dump_cb_block_size,
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index fc8a125451..cc2ead0b75 100644
+index d8c7331090..889726fc26 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -817,6 +817,8 @@
@@ -222,7 +222,7 @@ index fc8a125451..cc2ead0b75 100644
                                      '*backup-id': 'str',
                                      '*backup-time': 'int',
                                      '*use-dirty-bitmap': 'bool',
-@@ -3282,7 +3285,7 @@
+@@ -3290,7 +3293,7 @@
  { 'struct': 'BlockdevOptionsPbs',
    'data': { 'repository': 'str', 'snapshot': 'str', 'archive': 'str',
              '*keyfile': 'str', '*password': 'str', '*fingerprint': 'str',
index ed5b013d3a853438fbe63755c24e0896514d8e74..3598205be5c037138700f1aad2c21a26e9e8c052 100644 (file)
@@ -12,17 +12,19 @@ because a subsequent backup_cancel QMP call (as happens in PVE when
 the backup QMP command fails) would try to call proxmox_backup_abort()
 and run into a segfault.
 
-Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+[FE: adapt for new job lock mechanism replacing AioContext locks]
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 ---
  pve-backup.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
 
 diff --git a/pve-backup.c b/pve-backup.c
-index f6a5f8c785..5bed6f4014 100644
+index 262e7d3894..fde3554133 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
-@@ -506,6 +506,11 @@ static void create_backup_jobs_bh(void *opaque) {
+@@ -503,6 +503,11 @@ static void create_backup_jobs_bh(void *opaque) {
      }
  
      if (*errp) {
@@ -34,22 +36,21 @@ index f6a5f8c785..5bed6f4014 100644
          l = backup_state.di_list;
          while (l) {
              PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
-@@ -516,12 +521,12 @@ static void create_backup_jobs_bh(void *opaque) {
+@@ -513,11 +518,11 @@ static void create_backup_jobs_bh(void *opaque) {
                  di->target = NULL;
              }
  
 -            if (di->job) {
 +            if (!canceled && di->job) {
-                 AioContext *ctx = di->job->job.aio_context;
-                 aio_context_acquire(ctx);
-                 job_cancel_sync(&di->job->job, true);
--                job_unref(&di->job->job);
-                 aio_context_release(ctx);
+                 WITH_JOB_LOCK_GUARD() {
+                     job_cancel_sync_locked(&di->job->job, true);
+-                    job_unref_locked(&di->job->job);
+                 }
 +                canceled = true;
              }
          }
      }
-@@ -947,6 +952,7 @@ err:
+@@ -943,6 +948,7 @@ err:
  
      if (pbs) {
          proxmox_backup_disconnect(pbs);
index f3bfb157de08f0b25c3dc264e43f8d9df3efb1ca..1446569f80e5049c1f595a31d48424933950c62e 100644 (file)
@@ -14,62 +14,59 @@ freed. With unlucky timings it seems possible that:
    di_list
 5. qmp_backup_cancel will pick a job that's already been freed
 
-Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+[FE: adapt for new job lock mechanism replacing AioContext locks]
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 ---
- pve-backup.c | 25 ++++++++++++++++++++-----
- 1 file changed, 20 insertions(+), 5 deletions(-)
+ pve-backup.c | 22 +++++++++++++++++++---
+ 1 file changed, 19 insertions(+), 3 deletions(-)
 
 diff --git a/pve-backup.c b/pve-backup.c
-index 5bed6f4014..0c34428713 100644
+index fde3554133..0cf30e1ced 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
-@@ -316,6 +316,14 @@ static void coroutine_fn pvebackup_co_complete_stream(void *opaque)
+@@ -316,6 +316,13 @@ static void coroutine_fn pvebackup_co_complete_stream(void *opaque)
          }
      }
  
 +    if (di->job) {
-+        AioContext *ctx = di->job->job.aio_context;
-+        aio_context_acquire(ctx);
-+        job_unref(&di->job->job);
-+        di->job = NULL;
-+        aio_context_release(ctx);
++        WITH_JOB_LOCK_GUARD() {
++            job_unref_locked(&di->job->job);
++            di->job = NULL;
++        }
 +    }
 +
      // remove self from job list
      backup_state.di_list = g_list_remove(backup_state.di_list, di);
  
-@@ -491,9 +499,12 @@ static void create_backup_jobs_bh(void *opaque) {
-             bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
-             JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, &local_err);
+@@ -491,6 +498,11 @@ static void create_backup_jobs_bh(void *opaque) {
+         aio_context_release(aio_context);
  
--        aio_context_release(aio_context);
--
          di->job = job;
 +        if (job) {
-+            job_ref(&job->job);
++            WITH_JOB_LOCK_GUARD() {
++                job_ref_locked(&job->job);
++            }
 +        }
-+
-+        aio_context_release(aio_context);
  
          if (!job || local_err) {
              error_setg(errp, "backup_job_create failed: %s",
-@@ -521,12 +532,16 @@ static void create_backup_jobs_bh(void *opaque) {
+@@ -518,11 +530,15 @@ static void create_backup_jobs_bh(void *opaque) {
                  di->target = NULL;
              }
  
 -            if (!canceled && di->job) {
 +            if (di->job) {
-                 AioContext *ctx = di->job->job.aio_context;
-                 aio_context_acquire(ctx);
--                job_cancel_sync(&di->job->job, true);
-+                if (!canceled) {
-+                    job_cancel_sync(&di->job->job, true);
-+                    canceled = true;
-+                }
-+                job_unref(&di->job->job);
-+                di->job = NULL;
-                 aio_context_release(ctx);
+                 WITH_JOB_LOCK_GUARD() {
+-                    job_cancel_sync_locked(&di->job->job, true);
++                    if (!canceled) {
++                        job_cancel_sync_locked(&di->job->job, true);
++                        canceled = true;
++                    }
++                    job_unref_locked(&di->job->job);
++                    di->job = NULL;
+                 }
 -                canceled = true;
              }
          }
index 63c449735fcad07813ffb8e06bf04425600939d1..1fbf04af244bf97620ec79846b582dc2d9bd5007 100644 (file)
@@ -30,17 +30,19 @@ checking against JOB_STATUS_CONCLUDED or JOB_STATUS_NULL to decide if
 it's still necessary and possible to cancel, but the approach with
 using the first non-completed job seemed more robust.
 
-Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+[FE: adapt for new job lock mechanism replacing AioContext locks]
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 ---
- pve-backup.c | 61 +++++++++++++++++++++++++++++++++-------------------
- 1 file changed, 39 insertions(+), 22 deletions(-)
+ pve-backup.c | 57 ++++++++++++++++++++++++++++++++++------------------
+ 1 file changed, 38 insertions(+), 19 deletions(-)
 
 diff --git a/pve-backup.c b/pve-backup.c
-index 0c34428713..2e22030eec 100644
+index 0cf30e1ced..4067018dbe 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
-@@ -355,15 +355,42 @@ static void pvebackup_complete_cb(void *opaque, int ret)
+@@ -354,12 +354,41 @@ static void pvebackup_complete_cb(void *opaque, int ret)
  
  /*
   * job_cancel(_sync) does not like to be called from coroutines, so defer to
@@ -51,10 +53,7 @@ index 0c34428713..2e22030eec 100644
  static void job_cancel_bh(void *opaque) {
      CoCtxData *data = (CoCtxData*)opaque;
 -    Job *job = (Job*)data->data;
--    AioContext *job_ctx = job->aio_context;
--    aio_context_acquire(job_ctx);
 -    job_cancel_sync(job, true);
--    aio_context_release(job_ctx);
 +
 +    /*
 +     * Be careful to pick a valid job to cancel:
@@ -70,16 +69,15 @@ index 0c34428713..2e22030eec 100644
 +            BlockJob *bj = ((PVEBackupDevInfo *)bdi->data)->job;
 +            if (bj) {
 +                Job *job = &bj->job;
-+                if (!job_is_completed(job)) {
-+                    AioContext *job_ctx = job->aio_context;
-+                    aio_context_acquire(job_ctx);
-+                    job_cancel_sync(job, true);
-+                    aio_context_release(job_ctx);
-+                    /*
-+                     * It's enough to cancel one job in the transaction, the
-+                     * rest will follow automatically.
-+                     */
-+                    break;
++                WITH_JOB_LOCK_GUARD() {
++                    if (!job_is_completed_locked(job)) {
++                        job_cancel_sync_locked(job, true);
++                        /*
++                         * It's enough to cancel one job in the transaction, the
++                         * rest will follow automatically.
++                         */
++                        break;
++                    }
 +                }
 +            }
 +        }
@@ -89,7 +87,7 @@ index 0c34428713..2e22030eec 100644
      aio_co_enter(data->ctx, data->co);
  }
  
-@@ -384,22 +411,12 @@ void coroutine_fn qmp_backup_cancel(Error **errp)
+@@ -380,22 +409,12 @@ void coroutine_fn qmp_backup_cancel(Error **errp)
          proxmox_backup_abort(backup_state.pbs, "backup canceled");
      }
  
index a3c4909b410dc2f3ea5e2f2743104167cb531c78..435326c5cfe9cc5a50d3d41d421ba07c5e9733a0 100644 (file)
@@ -21,7 +21,7 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/block/alloc-track.c b/block/alloc-track.c
-index 6b50fbe537..c1160af04b 100644
+index 43d40d11af..95c9c67cd8 100644
 --- a/block/alloc-track.c
 +++ b/block/alloc-track.c
 @@ -174,7 +174,8 @@ static int coroutine_fn track_co_preadv(BlockDriverState *bs,
index a20a383cb8c133020e4a147a26af353a73236c5e..c22b38003b5ab58a12ffebc46c8f0abd91d90a00 100644 (file)
@@ -31,7 +31,7 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
  3 files changed, 23 insertions(+), 8 deletions(-)
 
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 0502f42be6..cc231ec3f2 100644
+index 57b2457f1e..ab0c988ae9 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
 @@ -1049,7 +1049,9 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
@@ -46,7 +46,7 @@ index 0502f42be6..cc231ec3f2 100644
      hmp_handle_error(mon, error);
  }
 diff --git a/pve-backup.c b/pve-backup.c
-index 2e22030eec..e9aa7e0f49 100644
+index 4067018dbe..3ca4f74cb8 100644
 --- a/pve-backup.c
 +++ b/pve-backup.c
 @@ -55,6 +55,7 @@ static struct PVEBackupState {
@@ -57,7 +57,7 @@ index 2e22030eec..e9aa7e0f49 100644
      VmaWriter *vmaw;
      ProxmoxBackupHandle *pbs;
      GList *di_list;
-@@ -492,8 +493,6 @@ static void create_backup_jobs_bh(void *opaque) {
+@@ -490,8 +491,6 @@ static void create_backup_jobs_bh(void *opaque) {
      }
      backup_state.txn = job_txn_new_seq();
  
@@ -66,7 +66,7 @@ index 2e22030eec..e9aa7e0f49 100644
      /* create and start all jobs (paused state) */
      GList *l =  backup_state.di_list;
      while (l) {
-@@ -513,8 +512,9 @@ static void create_backup_jobs_bh(void *opaque) {
+@@ -511,8 +510,9 @@ static void create_backup_jobs_bh(void *opaque) {
  
          BlockJob *job = backup_job_create(
              NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap,
@@ -76,9 +76,9 @@ index 2e22030eec..e9aa7e0f49 100644
 +            BLOCKDEV_ON_ERROR_REPORT, JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn,
 +            &local_err);
  
-         di->job = job;
-         if (job) {
-@@ -584,7 +584,9 @@ UuidInfo coroutine_fn *qmp_backup(
+         aio_context_release(aio_context);
+@@ -583,7 +583,9 @@ UuidInfo coroutine_fn *qmp_backup(
      bool has_config_file, const char *config_file,
      bool has_firewall_file, const char *firewall_file,
      bool has_devlist, const char *devlist,
@@ -89,7 +89,7 @@ index 2e22030eec..e9aa7e0f49 100644
  {
      assert(qemu_in_coroutine());
  
-@@ -914,6 +916,11 @@ UuidInfo coroutine_fn *qmp_backup(
+@@ -913,6 +915,11 @@ UuidInfo coroutine_fn *qmp_backup(
  
      backup_state.speed = (has_speed && speed > 0) ? speed : 0;
  
@@ -101,7 +101,7 @@ index 2e22030eec..e9aa7e0f49 100644
      backup_state.vmaw = vmaw;
      backup_state.pbs = pbs;
  
-@@ -1089,5 +1096,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+@@ -1088,5 +1095,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
      ret->pbs_dirty_bitmap_migration = true;
      ret->query_bitmap_info = true;
      ret->pbs_masterkey = true;
@@ -109,7 +109,7 @@ index 2e22030eec..e9aa7e0f49 100644
      return ret;
  }
 diff --git a/qapi/block-core.json b/qapi/block-core.json
-index cc2ead0b75..e3f62faa81 100644
+index 889726fc26..65795b7204 100644
 --- a/qapi/block-core.json
 +++ b/qapi/block-core.json
 @@ -829,6 +829,8 @@
index 441c6d4d5f796e0f6bac92d7207e40f0fc6788dd..191ba29da574822ed65a5420c18f02bec35c433f 100644 (file)
@@ -1,9 +1,5 @@
 extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch
-extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch
-extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch
-extra/0004-chardev-fix-segfault-in-finalize.patch
-extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch
-extra/0006-block-block-backend-blk_set_enable_write_cache-is-IO.patch
+extra/0002-init-daemonize-defuse-PID-file-resolve-error.patch
 bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
 bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
 bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
diff --git a/qemu b/qemu
index 621da7789083b80d6f1ff1c0fb499334007b4f51..b67b00e6b4c7831a3f5bc684bc0df7a9bfd1bd56 160000 (submodule)
--- a/qemu
+++ b/qemu
@@ -1 +1 @@
-Subproject commit 621da7789083b80d6f1ff1c0fb499334007b4f51
+Subproject commit b67b00e6b4c7831a3f5bc684bc0df7a9bfd1bd56