5
0
mirror of git://git.proxmox.com/git/pve-qemu.git synced 2024-12-22 17:35:52 +03:00

update submodule and patches to 7.2.0

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>
This commit is contained in:
Fiona Ebner 2022-12-14 15:16:32 +01:00 committed by Wolfgang Bumiller
parent 55e33a045e
commit d03e1b3ce3
62 changed files with 526 additions and 797 deletions

View File

@ -36,7 +36,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 files changed, 145 insertions(+), 29 deletions(-) 5 files changed, 145 insertions(+), 29 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c diff --git a/block/mirror.c b/block/mirror.c
index 3c4ab1159d..f2eca983f1 100644 index 251adc5ae0..8ead5f77a0 100644
--- a/block/mirror.c --- a/block/mirror.c
+++ b/block/mirror.c +++ b/block/mirror.c
@@ -51,7 +51,7 @@ typedef struct MirrorBlockJob { @@ -51,7 +51,7 @@ typedef struct MirrorBlockJob {
@ -57,7 +57,7 @@ index 3c4ab1159d..f2eca983f1 100644
BdrvDirtyBitmap *dirty_bitmap; BdrvDirtyBitmap *dirty_bitmap;
BdrvDirtyBitmapIter *dbi; BdrvDirtyBitmapIter *dbi;
uint8_t *buf; 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, bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing,
&error_abort); &error_abort);
if (!abort && s->backing_mode == MIRROR_SOURCE_BACKING_CHAIN) { 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); BlockDriverState *unfiltered_target = bdrv_skip_filters(target_bs);
if (bdrv_cow_bs(unfiltered_target) != backing) { 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); assert(ret == 0);
} }
@ -84,7 +84,7 @@ index 3c4ab1159d..f2eca983f1 100644
static void coroutine_fn mirror_throttle(MirrorBlockJob *s) static void coroutine_fn mirror_throttle(MirrorBlockJob *s)
{ {
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); 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); mirror_free_init(s);
s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
@ -94,7 +94,7 @@ index 3c4ab1159d..f2eca983f1 100644
ret = mirror_dirty_init(s); ret = mirror_dirty_init(s);
if (ret < 0 || job_is_cancelled(&s->common.job)) { if (ret < 0 || job_is_cancelled(&s->common.job)) {
goto immediate_exit; 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, .run = mirror_run,
.prepare = mirror_prepare, .prepare = mirror_prepare,
.abort = mirror_abort, .abort = mirror_abort,
@ -102,7 +102,7 @@ index 3c4ab1159d..f2eca983f1 100644
.pause = mirror_pause, .pause = mirror_pause,
.complete = mirror_complete, .complete = mirror_complete,
.cancel = mirror_cancel, .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, .run = mirror_run,
.prepare = mirror_prepare, .prepare = mirror_prepare,
.abort = mirror_abort, .abort = mirror_abort,
@ -110,7 +110,7 @@ index 3c4ab1159d..f2eca983f1 100644
.pause = mirror_pause, .pause = mirror_pause,
.complete = mirror_complete, .complete = mirror_complete,
.cancel = commit_active_cancel, .cancel = commit_active_cancel,
@@ -1593,7 +1609,10 @@ static BlockJob *mirror_start_job( @@ -1627,7 +1643,10 @@ static BlockJob *mirror_start_job(
BlockCompletionFunc *cb, BlockCompletionFunc *cb,
void *opaque, void *opaque,
const BlockJobDriver *driver, const BlockJobDriver *driver,
@ -122,7 +122,7 @@ index 3c4ab1159d..f2eca983f1 100644
bool auto_complete, const char *filter_node_name, bool auto_complete, const char *filter_node_name,
bool is_mirror, MirrorCopyMode copy_mode, bool is_mirror, MirrorCopyMode copy_mode,
Error **errp) 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; uint64_t target_perms, target_shared_perms;
int ret; int ret;
@ -164,7 +164,7 @@ index 3c4ab1159d..f2eca983f1 100644
assert(is_power_of_2(granularity)); assert(is_power_of_2(granularity));
if (buf_size < 0) { 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->replaces = g_strdup(replaces);
s->on_source_error = on_source_error; s->on_source_error = on_source_error;
s->on_target_error = on_target_error; s->on_target_error = on_target_error;
@ -175,7 +175,7 @@ index 3c4ab1159d..f2eca983f1 100644
s->backing_mode = backing_mode; s->backing_mode = backing_mode;
s->zero_target = zero_target; s->zero_target = zero_target;
s->copy_mode = copy_mode; 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); 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, ret = block_job_add_bdrv(&s->common, "source", bs, 0,
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
BLK_PERM_CONSISTENT_READ, BLK_PERM_CONSISTENT_READ,
@@ -1838,6 +1900,9 @@ fail: @@ -1872,6 +1934,9 @@ fail:
if (s->dirty_bitmap) { if (s->dirty_bitmap) {
bdrv_release_dirty_bitmap(s->dirty_bitmap); bdrv_release_dirty_bitmap(s->dirty_bitmap);
} }
@ -204,7 +204,7 @@ index 3c4ab1159d..f2eca983f1 100644
job_early_fail(&s->common.job); 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, BlockDriverState *target, const char *replaces,
int creation_flags, int64_t speed, int creation_flags, int64_t speed,
uint32_t granularity, int64_t buf_size, 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, 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, job_id, bs, creation_flags, base, NULL, speed, 0, 0,
MIRROR_LEAVE_BACKING_CHAIN, false, MIRROR_LEAVE_BACKING_CHAIN, false,
on_error, on_error, true, cb, opaque, on_error, on_error, true, cb, opaque,
@ -252,10 +252,10 @@ index 3c4ab1159d..f2eca983f1 100644
errp); errp);
if (!job) { if (!job) {
diff --git a/blockdev.c b/blockdev.c diff --git a/blockdev.c b/blockdev.c
index 9230888e34..9a1a3118ed 100644 index 3f1dec6242..2ee30323cb 100644
--- a/blockdev.c --- a/blockdev.c
+++ b/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, BlockDriverState *target,
bool has_replaces, const char *replaces, bool has_replaces, const char *replaces,
enum MirrorSyncMode sync, enum MirrorSyncMode sync,
@ -266,7 +266,7 @@ index 9230888e34..9a1a3118ed 100644
BlockMirrorBackingMode backing_mode, BlockMirrorBackingMode backing_mode,
bool zero_target, bool zero_target,
bool has_speed, int64_t speed, 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; BlockDriverState *unfiltered_bs;
int job_flags = JOB_DEFAULT; int job_flags = JOB_DEFAULT;
@ -274,7 +274,7 @@ index 9230888e34..9a1a3118ed 100644
if (!has_speed) { if (!has_speed) {
speed = 0; 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; sync = MIRROR_SYNC_MODE_FULL;
} }
@ -304,7 +304,7 @@ index 9230888e34..9a1a3118ed 100644
if (!has_replaces) { if (!has_replaces) {
/* We want to mirror from @bs, but keep implicit filters on top */ /* We want to mirror from @bs, but keep implicit filters on top */
unfiltered_bs = bdrv_skip_implicit_filters(bs); 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 * and will allow to check whether the node still exist at mirror completion
*/ */
mirror_start(job_id, bs, target, mirror_start(job_id, bs, target,
@ -315,7 +315,7 @@ index 9230888e34..9a1a3118ed 100644
on_source_error, on_target_error, unmap, filter_node_name, on_source_error, on_target_error, unmap, filter_node_name,
copy_mode, errp); 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, blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
arg->has_replaces, arg->replaces, arg->sync, arg->has_replaces, arg->replaces, arg->sync,
@ -324,7 +324,7 @@ index 9230888e34..9a1a3118ed 100644
backing_mode, zero_target, backing_mode, zero_target,
arg->has_speed, arg->speed, arg->has_speed, arg->speed,
arg->has_granularity, arg->granularity, 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, const char *device, const char *target,
bool has_replaces, const char *replaces, bool has_replaces, const char *replaces,
MirrorSyncMode sync, MirrorSyncMode sync,
@ -333,7 +333,7 @@ index 9230888e34..9a1a3118ed 100644
bool has_speed, int64_t speed, bool has_speed, int64_t speed,
bool has_granularity, uint32_t granularity, bool has_granularity, uint32_t granularity,
bool has_buf_size, int64_t buf_size, 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, 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_source_error,
BlockdevOnError on_target_error, BlockdevOnError on_target_error,
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -2000,10 +2000,19 @@ @@ -2000,10 +2000,19 @@
@ -426,10 +426,10 @@ index 2173e7734a..e1857e7094 100644
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError', '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError',
diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c 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 --- a/tests/unit/test-block-iothread.c
+++ b/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 */ /* Start a mirror job */
mirror_start("job0", src, target, NULL, JOB_DEFAULT, 0, 0, 0, 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, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
false, "filter_node", MIRROR_COPY_MODE_BACKGROUND, false, "filter_node", MIRROR_COPY_MODE_BACKGROUND,
&error_abort); &error_abort);
job = job_get("job0"); WITH_JOB_LOCK_GUARD() {

View File

@ -24,10 +24,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 18 insertions(+), 6 deletions(-) 1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c diff --git a/block/mirror.c b/block/mirror.c
index f2eca983f1..b6475d50ad 100644 index 8ead5f77a0..35c1b8f25d 100644
--- a/block/mirror.c --- a/block/mirror.c
+++ b/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); 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, /* Make sure that the source BDS doesn't go away during bdrv_replace_node,
* before we can call bdrv_drained_end */ * before we can call bdrv_drained_end */
bdrv_ref(src); 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); block_job_remove_all_bdrv(bjob);
bdrv_replace_node(mirror_top_bs, mirror_top_bs->backing->bs, &error_abort); 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; bs_opaque->job = NULL;
bdrv_drained_end(src); bdrv_drained_end(src);
@@ -1634,10 +1644,6 @@ static BlockJob *mirror_start_job( @@ -1668,10 +1678,6 @@ static BlockJob *mirror_start_job(
" sync mode", " sync mode",
MirrorSyncMode_str(sync_mode)); MirrorSyncMode_str(sync_mode));
return NULL; return NULL;
@ -66,7 +66,7 @@ index f2eca983f1..b6475d50ad 100644
} }
} else if (bitmap) { } else if (bitmap) {
error_setg(errp, error_setg(errp,
@@ -1654,6 +1660,12 @@ static BlockJob *mirror_start_job( @@ -1688,6 +1694,12 @@ static BlockJob *mirror_start_job(
return NULL; return NULL;
} }
granularity = bdrv_dirty_bitmap_granularity(bitmap); granularity = bdrv_dirty_bitmap_granularity(bitmap);

View File

@ -16,10 +16,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)
diff --git a/blockdev.c b/blockdev.c diff --git a/blockdev.c b/blockdev.c
index 9a1a3118ed..a57b0af2e7 100644 index 2ee30323cb..dd1c2cdef7 100644
--- a/blockdev.c --- a/blockdev.c
+++ b/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)) { if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
return; return;
} }

View File

@ -16,10 +16,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 4 insertions(+), 7 deletions(-) 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c diff --git a/block/mirror.c b/block/mirror.c
index b6475d50ad..8b3342f9ec 100644 index 35c1b8f25d..4969c6833c 100644
--- a/block/mirror.c --- a/block/mirror.c
+++ b/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)) { job->ret == 0 && ret == 0)) {
/* Success; synchronize copy back to sync. */ /* Success; synchronize copy back to sync. */
bdrv_clear_dirty_bitmap(s->sync_bitmap, NULL); bdrv_clear_dirty_bitmap(s->sync_bitmap, NULL);
@ -30,7 +30,7 @@ index b6475d50ad..8b3342f9ec 100644
} }
} }
bdrv_release_dirty_bitmap(s->dirty_bitmap); 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) { if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) {

View File

@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 70 insertions(+), 59 deletions(-) 3 files changed, 70 insertions(+), 59 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c diff --git a/block/mirror.c b/block/mirror.c
index 8b3342f9ec..1d4ff0efad 100644 index 4969c6833c..cf85ae1074 100644
--- a/block/mirror.c --- a/block/mirror.c
+++ b/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; uint64_t target_perms, target_shared_perms;
int ret; int ret;
@ -60,10 +60,10 @@ index 8b3342f9ec..1d4ff0efad 100644
if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) { if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) {
diff --git a/blockdev.c b/blockdev.c diff --git a/blockdev.c b/blockdev.c
index a57b0af2e7..ce62a9b439 100644 index dd1c2cdef7..756e980889 100644
--- a/blockdev.c --- a/blockdev.c
+++ b/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; sync = MIRROR_SYNC_MODE_FULL;
} }

View File

@ -48,7 +48,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 files changed, 59 insertions(+), 5 deletions(-) 6 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h 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 --- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h +++ b/include/monitor/monitor.h
@@ -16,6 +16,7 @@ extern QemuOptsList qemu_mon_opts; @@ -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(void);
void monitor_init_globals_core(void); void monitor_init_globals_core(void);
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h 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 --- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h
@@ -152,6 +152,13 @@ typedef struct { @@ -152,6 +152,13 @@ typedef struct {

View File

@ -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())

View File

@ -21,10 +21,10 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
1 file changed, 5 insertions(+), 4 deletions(-) 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c diff --git a/softmmu/vl.c b/softmmu/vl.c
index 706bd7cff7..3381c56af7 100644 index 5115221efe..5f7f6ca981 100644
--- a/softmmu/vl.c --- a/softmmu/vl.c
+++ b/softmmu/vl.c +++ b/softmmu/vl.c
@@ -2438,10 +2438,11 @@ static void qemu_maybe_daemonize(const char *pid_file) @@ -2460,10 +2460,11 @@ static void qemu_maybe_daemonize(const char *pid_file)
pid_file_realpath = g_malloc0(PATH_MAX); pid_file_realpath = g_malloc0(PATH_MAX);
if (!realpath(pid_file, pid_file_realpath)) { if (!realpath(pid_file, pid_file_realpath)) {

View File

@ -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;
}

View File

@ -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,

View File

@ -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;
}

View File

@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c 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 --- a/block/file-posix.c
+++ b/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", .name = "locking",
.type = QEMU_OPT_STRING, .type = QEMU_OPT_STRING,
@ -26,7 +26,7 @@ index 48cd096624..3d60b80286 100644
}, },
{ {
.name = "pr-manager", .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; s->use_lock = false;
break; break;
case ON_OFF_AUTO_AUTO: case ON_OFF_AUTO_AUTO:

View File

@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/net.h b/include/net/net.h 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 --- a/include/net/net.h
+++ b/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); int net_hub_id_for_client(NetClientState *nc, int *id);
NetClientState *net_hub_port_find(int hub_id); NetClientState *net_hub_port_find(int hub_id);

View File

@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h 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 --- a/target/i386/cpu.h
+++ b/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 #define CPU_RESOLVING_TYPE TYPE_X86_CPU
#ifdef TARGET_X86_64 #ifdef TARGET_X86_64

View File

@ -9,7 +9,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 11 insertions(+), 4 deletions(-) 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c diff --git a/block/gluster.c b/block/gluster.c
index b60213ab80..93da76bc31 100644 index 7c90f7ba4b..2e03102f00 100644
--- a/block/gluster.c --- a/block/gluster.c
+++ b/block/gluster.c +++ b/block/gluster.c
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@

View File

@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 43 insertions(+) 3 files changed, 43 insertions(+)
diff --git a/net/net.c b/net/net.c diff --git a/net/net.c b/net/net.c
index 2db160e063..8329347891 100644 index 840ad9dca5..28e97c5d85 100644
--- a/net/net.c --- a/net/net.c
+++ b/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; NetClientState *nc;
diff --git a/qapi/net.json b/qapi/net.json diff --git a/qapi/net.json b/qapi/net.json
index 75ba2cb989..a3c93ab88f 100644 index 522ac582ed..327d7c5a37 100644
--- a/qapi/net.json --- a/qapi/net.json
+++ b/qapi/net.json +++ b/qapi/net.json
@@ -35,6 +35,21 @@ @@ -36,6 +36,21 @@
## ##
{ 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} } { 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }

View File

@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 9 insertions(+), 1 deletion(-) 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/block/gluster.c b/block/gluster.c diff --git a/block/gluster.c b/block/gluster.c
index 93da76bc31..1079b6186b 100644 index 2e03102f00..7886c5fe8c 100644
--- a/block/gluster.c --- a/block/gluster.c
+++ b/block/gluster.c +++ b/block/gluster.c
@@ -57,6 +57,7 @@ typedef struct GlusterAIOCB { @@ -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, ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0,
gluster_finish_aiocb, &acb); 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.ret = 0;
acb.coroutine = qemu_coroutine_self(); acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs); 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); ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
if (ret < 0) { 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.ret = 0;
acb.coroutine = qemu_coroutine_self(); acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs); acb.aio_context = bdrv_get_aio_context(bs);

View File

@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c diff --git a/qemu-img.c b/qemu-img.c
index 7d4b33b3da..bb36f42dd2 100644 index a9b3a8103c..0bc9f1af59 100644
--- a/qemu-img.c --- a/qemu-img.c
+++ b/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, list = collect_image_info_list(image_opts, filename, fmt, chain,
force_share); force_share);
if (!list) { if (!list) {

View File

@ -54,10 +54,10 @@ index 1b1dab5b17..d1616c045a 100644
DEF("info", img_info, DEF("info", img_info,
diff --git a/qemu-img.c b/qemu-img.c diff --git a/qemu-img.c b/qemu-img.c
index bb36f42dd2..74afcb79ef 100644 index 0bc9f1af59..221b9d6a16 100644
--- a/qemu-img.c --- a/qemu-img.c
+++ b/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_IF 04
#define C_OF 010 #define C_OF 010
#define C_SKIP 020 #define C_SKIP 020
@ -70,7 +70,7 @@ index bb36f42dd2..74afcb79ef 100644
}; };
struct DdIo { 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; return 0;
} }
@ -90,7 +90,7 @@ index bb36f42dd2..74afcb79ef 100644
static int img_dd(int argc, char **argv) static int img_dd(int argc, char **argv)
{ {
int ret = 0; 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 }, { "if", img_dd_if, C_IF },
{ "of", img_dd_of, C_OF }, { "of", img_dd_of, C_OF },
{ "skip", img_dd_skip, C_SKIP }, { "skip", img_dd_skip, C_SKIP },
@ -98,7 +98,7 @@ index bb36f42dd2..74afcb79ef 100644
{ NULL, NULL, 0 } { NULL, NULL, 0 }
}; };
const struct option long_options[] = { 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; arg = NULL;
} }
@ -275,10 +275,10 @@ index bb36f42dd2..74afcb79ef 100644
} }
if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz || 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); 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 in_ret, out_ret;
int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz; int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
- -

View File

@ -16,10 +16,10 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
1 file changed, 25 insertions(+), 3 deletions(-) 1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c diff --git a/qemu-img.c b/qemu-img.c
index 74afcb79ef..14594d44b6 100644 index 221b9d6a16..c1306385a8 100644
--- a/qemu-img.c --- a/qemu-img.c
+++ b/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_OF 010
#define C_SKIP 020 #define C_SKIP 020
#define C_OSIZE 040 #define C_OSIZE 040
@ -33,7 +33,7 @@ index 74afcb79ef..14594d44b6 100644
}; };
struct DdIo { 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; return 0;
} }
@ -53,13 +53,13 @@ index 74afcb79ef..14594d44b6 100644
static int img_dd(int argc, char **argv) static int img_dd(int argc, char **argv)
{ {
int ret = 0; 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; int c, i;
const char *out_fmt = "raw"; const char *out_fmt = "raw";
const char *fmt = NULL; const char *fmt = NULL;
- int64_t size = 0; - int64_t size = 0;
+ int64_t size = 0, readsize = 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; bool force_share = false;
struct DdInfo dd = { struct DdInfo dd = {
.flags = 0, .flags = 0,
@ -69,7 +69,7 @@ index 74afcb79ef..14594d44b6 100644
}; };
struct DdIo in = { struct DdIo in = {
.bsz = 512, /* Block size is by default 512 bytes */ .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 }, { "of", img_dd_of, C_OF },
{ "skip", img_dd_skip, C_SKIP }, { "skip", img_dd_skip, C_SKIP },
{ "osize", img_dd_osize, C_OSIZE }, { "osize", img_dd_osize, C_OSIZE },
@ -77,20 +77,20 @@ index 74afcb79ef..14594d44b6 100644
{ NULL, NULL, 0 } { NULL, NULL, 0 }
}; };
const struct option long_options[] = { 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); 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; + 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 in_ret, out_ret;
- int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz; - int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
+ int bytes = (in_pos + in.bsz > readsize) ? readsize - in_pos : in.bsz; + int bytes = (in_pos + in.bsz > readsize) ? readsize - in_pos : in.bsz;
if (blk1) { if (blk1) {
in_ret = blk_pread(blk1, in_pos, bytes, in.buf, 0); in_ret = blk_pread(blk1, in_pos, bytes, in.buf, 0);
if (in_ret == 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 { } else {
in_ret = read(STDIN_FILENO, in.buf, bytes); in_ret = read(STDIN_FILENO, in.buf, bytes);
if (in_ret == 0) { if (in_ret == 0) {

View 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> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
[FE: fix getopt-string + add documentation] [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 ++++++++++- docs/tools/qemu-img.rst | 11 ++++++++++-
qemu-img-cmds.hx | 4 ++-- 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(-) 3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst 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 --- a/docs/tools/qemu-img.rst
+++ b/docs/tools/qemu-img.rst +++ b/docs/tools/qemu-img.rst
@@ -208,6 +208,10 @@ Parameters to convert subcommand: @@ -208,6 +208,10 @@ Parameters to convert subcommand:
@ -65,19 +65,19 @@ index d1616c045a..b5b0bb4467 100644
DEF("info", img_info, DEF("info", img_info,
diff --git a/qemu-img.c b/qemu-img.c diff --git a/qemu-img.c b/qemu-img.c
index 14594d44b6..c6b4a5567d 100644 index c1306385a8..59c403373b 100644
--- a/qemu-img.c --- a/qemu-img.c
+++ b/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; const char *fmt = NULL;
int64_t size = 0, readsize = 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; - bool force_share = false;
+ bool force_share = false, skip_create = false; + bool force_share = false, skip_create = false;
struct DdInfo dd = { struct DdInfo dd = {
.flags = 0, .flags = 0,
.count = 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 } { 0, 0, 0, 0 }
}; };
@ -86,7 +86,7 @@ index 14594d44b6..c6b4a5567d 100644
if (c == EOF) { if (c == EOF) {
break; 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': case 'h':
help(); help();
break; break;
@ -96,7 +96,7 @@ index 14594d44b6..c6b4a5567d 100644
case 'U': case 'U':
force_share = true; force_share = true;
break; 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); size - in.bsz * in.offset, &error_abort);
} }

View File

@ -58,10 +58,10 @@ index 73ac5eb675..bbfe7eca62 100644
static void virtio_balloon_to_target(void *opaque, ram_addr_t target) static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c 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 --- a/monitor/hmp-cmds.c
+++ b/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; return;
} }
@ -99,7 +99,7 @@ index c6cd6f91dd..15572befb1 100644
qapi_free_BalloonInfo(info); qapi_free_BalloonInfo(info);
} }
diff --git a/qapi/machine.json b/qapi/machine.json diff --git a/qapi/machine.json b/qapi/machine.json
index 6afd1936b0..8b4be9b718 100644 index b9228a5e46..10e77a9af3 100644
--- a/qapi/machine.json --- a/qapi/machine.json
+++ b/qapi/machine.json +++ b/qapi/machine.json
@@ -1054,9 +1054,29 @@ @@ -1054,9 +1054,29 @@

View File

@ -30,7 +30,7 @@ index 4f4ab30f8c..76fff60a6b 100644
info->default_cpu_type = g_strdup(mc->default_cpu_type); info->default_cpu_type = g_strdup(mc->default_cpu_type);
info->has_default_cpu_type = true; info->has_default_cpu_type = true;
diff --git a/qapi/machine.json b/qapi/machine.json diff --git a/qapi/machine.json b/qapi/machine.json
index 8b4be9b718..555458f785 100644 index 10e77a9af3..9156103c8f 100644
--- a/qapi/machine.json --- a/qapi/machine.json
+++ b/qapi/machine.json +++ b/qapi/machine.json
@@ -138,6 +138,8 @@ @@ -138,6 +138,8 @@

View File

@ -12,7 +12,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 files changed, 8 insertions(+) 2 files changed, 8 insertions(+)
diff --git a/qapi/ui.json b/qapi/ui.json diff --git a/qapi/ui.json b/qapi/ui.json
index cf58ab4283..0be2388941 100644 index 0abba3e930..bf8f441227 100644
--- a/qapi/ui.json --- a/qapi/ui.json
+++ b/qapi/ui.json +++ b/qapi/ui.json
@@ -310,11 +310,14 @@ @@ -310,11 +310,14 @@

View File

@ -42,10 +42,10 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
create mode 100644 migration/savevm-async.c create mode 100644 migration/savevm-async.c
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx 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 --- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx +++ b/hmp-commands-info.hx
@@ -538,6 +538,19 @@ SRST @@ -540,6 +540,19 @@ SRST
Show current migration parameters. Show current migration parameters.
ERST ERST
@ -66,13 +66,13 @@ index 188d9ece3b..97b88eaaad 100644
.name = "balloon", .name = "balloon",
.args_type = "", .args_type = "",
diff --git a/hmp-commands.hx b/hmp-commands.hx diff --git a/hmp-commands.hx b/hmp-commands.hx
index 182e639d14..bbcc73e942 100644 index 673e39a697..039be0033d 100644
--- a/hmp-commands.hx --- a/hmp-commands.hx
+++ b/hmp-commands.hx +++ b/hmp-commands.hx
@@ -1800,3 +1800,36 @@ ERST @@ -1815,3 +1815,36 @@ SRST
"\n\t\t\t\t\t limit on a specified virtual cpu", Dump the FDT in dtb format to *filename*.
.cmd = hmp_cancel_vcpu_dirty_limit, ERST
}, #endif
+ +
+ { + {
+ .name = "savevm-start", + .name = "savevm-start",
@ -118,10 +118,10 @@ index e72083b117..c846d37806 100644
+ +
#endif #endif
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h 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 --- a/include/monitor/hmp.h
+++ b/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_uuid(Monitor *mon, const QDict *qdict);
void hmp_info_chardev(Monitor *mon, const QDict *qdict); void hmp_info_chardev(Monitor *mon, const QDict *qdict);
void hmp_info_mice(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(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(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); 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_netdev_del(Monitor *mon, const QDict *qdict);
void hmp_getfd(Monitor *mon, const QDict *qdict); void hmp_getfd(Monitor *mon, const QDict *qdict);
void hmp_closefd(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_delete_drive_snapshot(Monitor *mon, const QDict *qdict);
+void hmp_savevm_end(Monitor *mon, const QDict *qdict); +void hmp_savevm_end(Monitor *mon, const QDict *qdict);
void hmp_sendkey(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); void hmp_chardev_add(Monitor *mon, const QDict *qdict);
diff --git a/migration/meson.build b/migration/meson.build diff --git a/migration/meson.build b/migration/meson.build
index 8cac83c06c..0842d00cd2 100644 index 8cac83c06c..0842d00cd2 100644
@ -690,10 +690,10 @@ index 0000000000..05d394c0e2
+ return ret; + return ret;
+} +}
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c 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 --- a/monitor/hmp-cmds.c
+++ b/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); hmp_handle_error(mon, err);
} }
@ -758,7 +758,7 @@ index 15572befb1..1507180990 100644
{ {
IOThreadInfoList *info_list = qmp_query_iothreads(NULL); IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
diff --git a/qapi/migration.json b/qapi/migration.json diff --git a/qapi/migration.json b/qapi/migration.json
index 81185d4311..3129f71fa8 100644 index 88ecf86ac8..4435866379 100644
--- a/qapi/migration.json --- a/qapi/migration.json
+++ b/qapi/migration.json +++ b/qapi/migration.json
@@ -261,6 +261,40 @@ @@ -261,6 +261,40 @@
@ -846,10 +846,10 @@ index 27ef5a2b20..b3ce75dcae 100644
# @CommandLineParameterType: # @CommandLineParameterType:
# #
diff --git a/qemu-options.hx b/qemu-options.hx diff --git a/qemu-options.hx b/qemu-options.hx
index 31c04f7eea..c2ca6e91b5 100644 index 7f99d15b23..54efb127c4 100644
--- a/qemu-options.hx --- a/qemu-options.hx
+++ b/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) Start right away with a saved state (``loadvm`` in monitor)
ERST ERST
@ -869,10 +869,10 @@ index 31c04f7eea..c2ca6e91b5 100644
DEF("daemonize", 0, QEMU_OPTION_daemonize, \ DEF("daemonize", 0, QEMU_OPTION_daemonize, \
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL) "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
diff --git a/softmmu/vl.c b/softmmu/vl.c diff --git a/softmmu/vl.c b/softmmu/vl.c
index 706bd7cff7..b8637c4262 100644 index 5f7f6ca981..21f067d115 100644
--- a/softmmu/vl.c --- a/softmmu/vl.c
+++ b/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 bool have_custom_ram_size;
static const char *ram_memdev_id; static const char *ram_memdev_id;
static QDict *machine_opts_dict; 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(, ObjectOption) object_opts = QTAILQ_HEAD_INITIALIZER(object_opts);
static QTAILQ_HEAD(, DeviceOption) device_opts = QTAILQ_HEAD_INITIALIZER(device_opts); static QTAILQ_HEAD(, DeviceOption) device_opts = QTAILQ_HEAD_INITIALIZER(device_opts);
static int display_remote; 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) { if (loadvm) {
load_snapshot(loadvm, NULL, false, NULL, &error_fatal); load_snapshot(loadvm, NULL, false, NULL, &error_fatal);
@ -893,7 +893,7 @@ index 706bd7cff7..b8637c4262 100644
} }
if (replay_mode != REPLAY_MODE_NONE) { if (replay_mode != REPLAY_MODE_NONE) {
replay_vmstate_init(); 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: case QEMU_OPTION_loadvm:
loadvm = optarg; loadvm = optarg;
break; break;

View File

@ -19,7 +19,7 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
3 files changed, 38 insertions(+), 18 deletions(-) 3 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c 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 --- a/migration/qemu-file.c
+++ b/migration/qemu-file.c +++ b/migration/qemu-file.c
@@ -31,8 +31,8 @@ @@ -31,8 +31,8 @@
@ -43,7 +43,7 @@ index 4f400c2e52..21e8998867 100644
DECLARE_BITMAP(may_free, MAX_IOV_SIZE); DECLARE_BITMAP(may_free, MAX_IOV_SIZE);
struct iovec iov[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; return false;
} }
@ -54,7 +54,7 @@ index 4f400c2e52..21e8998867 100644
{ {
QEMUFile *f; 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); object_ref(ioc);
f->ioc = ioc; f->ioc = ioc;
f->is_writable = is_writable; f->is_writable = is_writable;
@ -63,7 +63,7 @@ index 4f400c2e52..21e8998867 100644
return f; 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) 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) 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 { do {
len = qio_channel_read(f->ioc, len = qio_channel_read(f->ioc,
(char *)f->buf + pending, (char *)f->buf + pending,
@ -103,7 +103,7 @@ index 4f400c2e52..21e8998867 100644
&local_error); &local_error);
if (len == QIO_CHANNEL_ERR_BLOCK) { if (len == QIO_CHANNEL_ERR_BLOCK) {
if (qemu_in_coroutine()) { 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); 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 /* If any error was spotted before closing, we should report it
* instead of the close() return value. * 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)) { if (!add_to_iovec(f, f->buf + f->buf_index, len, false)) {
f->buf_index += len; f->buf_index += len;
@ -121,7 +121,7 @@ index 4f400c2e52..21e8998867 100644
qemu_fflush(f); 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) { while (size > 0) {
@ -130,7 +130,7 @@ index 4f400c2e52..21e8998867 100644
if (l > size) { if (l > size) {
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; size_t index;
assert(!qemu_file_is_writable(f)); assert(!qemu_file_is_writable(f));
@ -141,7 +141,7 @@ index 4f400c2e52..21e8998867 100644
/* The 1st byte to read from */ /* The 1st byte to read from */
index = f->buf_index + offset; 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; size_t res;
uint8_t *src; uint8_t *src;
@ -150,7 +150,7 @@ index 4f400c2e52..21e8998867 100644
if (res == 0) { if (res == 0) {
return done; 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) 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; size_t res;
uint8_t *src = NULL; 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; int index = f->buf_index + offset;
assert(!qemu_file_is_writable(f)); assert(!qemu_file_is_writable(f));
@ -168,7 +168,7 @@ index 4f400c2e52..21e8998867 100644
if (index >= f->buf_size) { if (index >= f->buf_size) {
qemu_fill_buffer(f); 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, ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
const uint8_t *p, size_t size) const uint8_t *p, size_t size)
{ {
@ -192,7 +192,7 @@ index fa13d04d78..914f1a63a8 100644
int qemu_fclose(QEMUFile *f); int qemu_fclose(QEMUFile *f);
diff --git a/migration/savevm-async.c b/migration/savevm-async.c 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 --- a/migration/savevm-async.c
+++ b/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) @@ -367,7 +367,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)

View File

@ -8,12 +8,12 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
--- ---
block/meson.build | 1 + block/meson.build | 1 +
block/zeroinit.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++ block/zeroinit.c | 198 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 197 insertions(+) 2 files changed, 199 insertions(+)
create mode 100644 block/zeroinit.c create mode 100644 block/zeroinit.c
diff --git a/block/meson.build b/block/meson.build diff --git a/block/meson.build b/block/meson.build
index 60bc305597..ad40c10b6a 100644 index b7c68b83a3..020a89ae07 100644
--- a/block/meson.build --- a/block/meson.build
+++ b/block/meson.build +++ b/block/meson.build
@@ -43,6 +43,7 @@ block_ss.add(files( @@ -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')) softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
diff --git a/block/zeroinit.c b/block/zeroinit.c diff --git a/block/zeroinit.c b/block/zeroinit.c
new file mode 100644 new file mode 100644
index 0000000000..20ee611f22 index 0000000000..b60e1b84dc
--- /dev/null --- /dev/null
+++ b/block/zeroinit.c +++ b/block/zeroinit.c
@@ -0,0 +1,196 @@ @@ -0,0 +1,198 @@
+/* +/*
+ * Filter to fake a zero-initialized block device. + * Filter to fake a zero-initialized block device.
+ * + *
@ -109,7 +109,9 @@ index 0000000000..20ee611f22
+ +
+ /* Open the raw file */ + /* Open the raw file */
+ bs->file = bdrv_open_child(qemu_opt_get(opts, "x-next"), options, "next", + 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) { + if (local_err) {
+ ret = -EINVAL; + ret = -EINVAL;
+ error_propagate(errp, local_err); + error_propagate(errp, local_err);

View File

@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 files changed, 11 insertions(+) 2 files changed, 11 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx diff --git a/qemu-options.hx b/qemu-options.hx
index c2ca6e91b5..ab4734ef32 100644 index 54efb127c4..ef456d03ec 100644
--- a/qemu-options.hx --- a/qemu-options.hx
+++ b/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 ERST
@ -28,10 +28,10 @@ index c2ca6e91b5..ab4734ef32 100644
"-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL) "-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) DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
diff --git a/softmmu/vl.c b/softmmu/vl.c diff --git a/softmmu/vl.c b/softmmu/vl.c
index b8637c4262..39f149924e 100644 index 21f067d115..9d737e7914 100644
--- a/softmmu/vl.c --- a/softmmu/vl.c
+++ b/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; MachineClass *machine_class;
bool userconfig = true; bool userconfig = true;
FILE *vmstate_dump_file = NULL; FILE *vmstate_dump_file = NULL;
@ -39,7 +39,7 @@ index b8637c4262..39f149924e 100644
qemu_add_opts(&qemu_drive_opts); qemu_add_opts(&qemu_drive_opts);
qemu_add_drive_opts(&qemu_legacy_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"), machine_parse_property_opt(qemu_find_opts("smp-opts"),
"smp", optarg); "smp", optarg);
break; break;

View File

@ -13,10 +13,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 files changed, 42 insertions(+), 20 deletions(-) 2 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c 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 --- a/block/file-posix.c
+++ b/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; int fd;
uint64_t perm, shared; uint64_t perm, shared;
int result = 0; int result = 0;
@ -24,7 +24,7 @@ index 3d60b80286..49ee1db5f9 100644
/* Validate options and set default values */ /* Validate options and set default values */
assert(options->driver == BLOCKDEV_DRIVER_FILE); 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; perm = BLK_PERM_WRITE | BLK_PERM_RESIZE;
shared = BLK_PERM_ALL & ~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 */ /* 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: out_unlock:
@ -82,7 +82,7 @@ index 3d60b80286..49ee1db5f9 100644
} }
out_close: 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; PreallocMode prealloc;
char *buf = NULL; char *buf = NULL;
Error *local_err = NULL; Error *local_err = NULL;
@ -90,7 +90,7 @@ index 3d60b80286..49ee1db5f9 100644
/* Skip file: protocol prefix */ /* Skip file: protocol prefix */
strstart(filename, "file:", &filename); 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; return -EINVAL;
} }
@ -109,7 +109,7 @@ index 3d60b80286..49ee1db5f9 100644
options = (BlockdevCreateOptions) { options = (BlockdevCreateOptions) {
.driver = BLOCKDEV_DRIVER_FILE, .driver = BLOCKDEV_DRIVER_FILE,
.u.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, .nocow = nocow,
.has_extent_size_hint = has_extent_size_hint, .has_extent_size_hint = has_extent_size_hint,
.extent_size_hint = extent_size_hint, .extent_size_hint = extent_size_hint,
@ -119,10 +119,10 @@ index 3d60b80286..49ee1db5f9 100644
}; };
return raw_co_create(&options, errp); return raw_co_create(&options, errp);
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -4537,7 +4537,8 @@ @@ -4624,7 +4624,8 @@
'size': 'size', 'size': 'size',
'*preallocation': 'PreallocMode', '*preallocation': 'PreallocMode',
'*nocow': 'bool', '*nocow': 'bool',

View File

@ -26,10 +26,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c 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 --- a/hw/core/machine.c
+++ b/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-vga", "edid", "false" },
{ "virtio-gpu-device", "edid", "false" }, { "virtio-gpu-device", "edid", "false" },
{ "virtio-device", "use-started", "false" }, { "virtio-device", "use-started", "false" },

View File

@ -36,7 +36,7 @@ index 76fff60a6b..ec9201fb9a 100644
if (mc->default_cpu_type) { if (mc->default_cpu_type) {
diff --git a/include/hw/boards.h b/include/hw/boards.h 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 --- a/include/hw/boards.h
+++ b/include/hw/boards.h +++ b/include/hw/boards.h
@@ -230,6 +230,8 @@ struct MachineClass { @@ -230,6 +230,8 @@ struct MachineClass {
@ -46,10 +46,10 @@ index 7b416c9787..8ae15c51aa 100644
+ const char *pve_version; + const char *pve_version;
+ +
void (*init)(MachineState *state); void (*init)(MachineState *state);
void (*reset)(MachineState *state); void (*reset)(MachineState *state, ShutdownCause reason);
void (*wakeup)(MachineState *state); void (*wakeup)(MachineState *state);
diff --git a/qapi/machine.json b/qapi/machine.json diff --git a/qapi/machine.json b/qapi/machine.json
index 555458f785..d868e4d31d 100644 index 9156103c8f..f4fb1b2c9c 100644
--- a/qapi/machine.json --- a/qapi/machine.json
+++ b/qapi/machine.json +++ b/qapi/machine.json
@@ -157,6 +157,8 @@ @@ -157,6 +157,8 @@
@ -71,10 +71,10 @@ index 555458f785..d868e4d31d 100644
## ##
# @query-machines: # @query-machines:
diff --git a/softmmu/vl.c b/softmmu/vl.c diff --git a/softmmu/vl.c b/softmmu/vl.c
index 39f149924e..0d233d55f3 100644 index 9d737e7914..a64eee2fad 100644
--- a/softmmu/vl.c --- a/softmmu/vl.c
+++ b/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) static MachineClass *select_machine(QDict *qdict, Error **errp)
{ {
const char *optarg = qdict_get_try_str(qdict, "type"); 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); GSList *machines = object_class_get_list(TYPE_MACHINE, false);
MachineClass *machine_class; MachineClass *machine_class;
Error *local_err = NULL; 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); g_slist_free(machines);
if (local_err) { if (local_err) {
error_append_hint(&local_err, "Use -machine help to list supported machines\n"); 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: case QEMU_OPTION_machine:
{ {
bool help; bool help;

View File

@ -25,7 +25,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 4 insertions(+), 4 deletions(-) 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/backup.c b/block/backup.c diff --git a/block/backup.c b/block/backup.c
index b2b649e305..b6fa9e8a69 100644 index 6a9ad97a53..9b0151c5be 100644
--- a/block/backup.c --- a/block/backup.c
+++ b/block/backup.c +++ b/block/backup.c
@@ -237,8 +237,8 @@ static void backup_init_bcs_bitmap(BackupBlockJob *job) @@ -237,8 +237,8 @@ static void backup_init_bcs_bitmap(BackupBlockJob *job)

View File

@ -20,7 +20,7 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
create mode 100644 vma.h create mode 100644 vma.h
diff --git a/block/meson.build b/block/meson.build diff --git a/block/meson.build b/block/meson.build
index ad40c10b6a..3a0b84bc11 100644 index 020a89ae07..4feae20e37 100644
--- a/block/meson.build --- a/block/meson.build
+++ b/block/meson.build +++ b/block/meson.build
@@ -46,6 +46,8 @@ block_ss.add(files( @@ -46,6 +46,8 @@ block_ss.add(files(
@ -30,13 +30,13 @@ index ad40c10b6a..3a0b84bc11 100644
+block_ss.add(files('../vma-writer.c'), libuuid) +block_ss.add(files('../vma-writer.c'), libuuid)
+ +
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c')) 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 diff --git a/meson.build b/meson.build
index d5230eadd6..ffff66c0cc 100644 index 5c6b5a1c75..e8cf7e3d78 100644
--- a/meson.build --- a/meson.build
+++ b/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') has_gettid = cc.has_function('gettid')
@ -45,7 +45,7 @@ index d5230eadd6..ffff66c0cc 100644
# libselinux # libselinux
selinux = dependency('libselinux', selinux = dependency('libselinux',
required: get_option('selinux'), required: get_option('selinux'),
@@ -3607,6 +3609,9 @@ if have_tools @@ -3596,6 +3598,9 @@ if have_tools
dependencies: [blockdev, qemuutil, gnutls, selinux], dependencies: [blockdev, qemuutil, gnutls, selinux],
install: true) install: true)

View File

@ -192,7 +192,7 @@ index 0000000000..04718a94e2
+ return bs; + return bs;
+} +}
diff --git a/block/backup.c b/block/backup.c diff --git a/block/backup.c b/block/backup.c
index b6fa9e8a69..789f8b7799 100644 index 9b0151c5be..6e8f6e67b3 100644
--- a/block/backup.c --- a/block/backup.c
+++ b/block/backup.c +++ b/block/backup.c
@@ -29,28 +29,6 @@ @@ -29,28 +29,6 @@
@ -240,7 +240,7 @@ index b6fa9e8a69..789f8b7799 100644
if (perf->max_chunk && perf->max_chunk < cluster_size) { if (perf->max_chunk && perf->max_chunk < cluster_size) {
error_setg(errp, "Required max-chunk (%" PRIi64 ") is less than backup " error_setg(errp, "Required max-chunk (%" PRIi64 ") is less than backup "
diff --git a/block/meson.build b/block/meson.build diff --git a/block/meson.build b/block/meson.build
index 3a0b84bc11..7f22e7f177 100644 index 4feae20e37..0d7023fc82 100644
--- a/block/meson.build --- a/block/meson.build
+++ b/block/meson.build +++ b/block/meson.build
@@ -4,6 +4,7 @@ block_ss.add(files( @@ -4,6 +4,7 @@ block_ss.add(files(
@ -252,7 +252,7 @@ index 3a0b84bc11..7f22e7f177 100644
'blkdebug.c', 'blkdebug.c',
'blklogwrites.c', 'blklogwrites.c',
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h 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 --- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h +++ b/include/block/block_int-common.h
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
@ -305,16 +305,16 @@ index 8947abab76..f272d0d8dc 100644
BDRV_TRACKED_READ, BDRV_TRACKED_READ,
BDRV_TRACKED_WRITE, BDRV_TRACKED_WRITE,
diff --git a/job.c b/job.c diff --git a/job.c b/job.c
index 075c6f3a20..e5699ad200 100644 index 72d57f0934..93e22d180b 100644
--- a/job.c --- a/job.c
+++ b/job.c +++ b/job.c
@@ -276,7 +276,8 @@ static bool job_started(Job *job) @@ -330,7 +330,8 @@ static bool job_started_locked(Job *job)
return job->co;
} }
-static bool job_should_pause(Job *job) /* Called with job_mutex held. */
+bool job_should_pause(Job *job); -static bool job_should_pause_locked(Job *job)
+bool job_should_pause(Job *job) +bool job_should_pause_locked(Job *job);
+bool job_should_pause_locked(Job *job)
{ {
return job->pause_count > 0; return job->pause_count > 0;
} }

View File

@ -7,8 +7,9 @@ Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
[PVE-Backup: avoid coroutines to fix AIO freeze, cleanups] [PVE-Backup: avoid coroutines to fix AIO freeze, cleanups]
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
[add new force parameter to job_cancel_sync calls] [FE: add new force parameter to job_cancel_sync calls
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> adapt for new job lock mechanism replacing AioContext locks]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
--- ---
block/meson.build | 5 + block/meson.build | 5 +
block/monitor/block-hmp-cmds.c | 33 ++ 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 ++ monitor/hmp-cmds.c | 44 ++
proxmox-backup-client.c | 176 ++++++ proxmox-backup-client.c | 176 ++++++
proxmox-backup-client.h | 59 ++ proxmox-backup-client.h | 59 ++
pve-backup.c | 959 +++++++++++++++++++++++++++++++++ pve-backup.c | 956 +++++++++++++++++++++++++++++++++
qapi/block-core.json | 109 ++++ qapi/block-core.json | 109 ++++
qapi/common.json | 13 + qapi/common.json | 13 +
qapi/machine.json | 15 +- 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.c
create mode 100644 proxmox-backup-client.h create mode 100644 proxmox-backup-client.h
create mode 100644 pve-backup.c create mode 100644 pve-backup.c
diff --git a/block/meson.build b/block/meson.build diff --git a/block/meson.build b/block/meson.build
index 7f22e7f177..2783b77e9c 100644 index 0d7023fc82..e995ae72b9 100644
--- a/block/meson.build --- a/block/meson.build
+++ b/block/meson.build +++ b/block/meson.build
@@ -48,6 +48,11 @@ block_ss.add(files( @@ -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(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 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 --- a/block/monitor/block-hmp-cmds.c
+++ b/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) @@ -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); + hmp_handle_error(mon, error);
+} +}
diff --git a/blockdev.c b/blockdev.c diff --git a/blockdev.c b/blockdev.c
index ce62a9b439..1600b24eab 100644 index 756e980889..bc8d67b290 100644
--- a/blockdev.c --- a/blockdev.c
+++ b/blockdev.c +++ b/blockdev.c
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
@ -99,10 +100,10 @@ index ce62a9b439..1600b24eab 100644
#include "monitor/monitor.h" #include "monitor/monitor.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx 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 --- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx +++ b/hmp-commands-info.hx
@@ -484,6 +484,20 @@ SRST @@ -486,6 +486,20 @@ SRST
Show the current VM UUID. Show the current VM UUID.
ERST ERST
@ -124,7 +125,7 @@ index 97b88eaaad..92a8867afb 100644
{ {
.name = "usernet", .name = "usernet",
diff --git a/hmp-commands.hx b/hmp-commands.hx diff --git a/hmp-commands.hx b/hmp-commands.hx
index bbcc73e942..97f24942b3 100644 index 039be0033d..fcf9461295 100644
--- a/hmp-commands.hx --- a/hmp-commands.hx
+++ b/hmp-commands.hx +++ b/hmp-commands.hx
@@ -101,6 +101,35 @@ ERST @@ -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 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 --- a/include/monitor/hmp.h
+++ b/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(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(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); 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_cpus(Monitor *mon, const QDict *qdict);
void hmp_info_vnc(Monitor *mon, const QDict *qdict); void hmp_info_vnc(Monitor *mon, const QDict *qdict);
void hmp_info_spice(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_set_password(Monitor *mon, const QDict *qdict);
void hmp_expire_password(Monitor *mon, const QDict *qdict); void hmp_expire_password(Monitor *mon, const QDict *qdict);
void hmp_change(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_add(Monitor *mon, const QDict *qdict);
void hmp_device_del(Monitor *mon, const QDict *qdict); void hmp_device_del(Monitor *mon, const QDict *qdict);
diff --git a/meson.build b/meson.build diff --git a/meson.build b/meson.build
index ffff66c0cc..0bc2fb5b10 100644 index e8cf7e3d78..782756162c 100644
--- a/meson.build --- a/meson.build
+++ b/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') has_gettid = cc.has_function('gettid')
libuuid = cc.find_library('uuid', required: true) libuuid = cc.find_library('uuid', required: true)
@ -197,10 +198,10 @@ index ffff66c0cc..0bc2fb5b10 100644
# libselinux # libselinux
selinux = dependency('libselinux', selinux = dependency('libselinux',
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c 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 --- a/monitor/hmp-cmds.c
+++ b/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); qapi_free_MouseInfoList(mice_list);
} }
@ -248,9 +249,9 @@ index 1507180990..1168773da7 100644
+ qapi_free_BackupStatus(info); + 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 diff --git a/proxmox-backup-client.c b/proxmox-backup-client.c
new file mode 100644 new file mode 100644
index 0000000000..a8f6653a81 index 0000000000..a8f6653a81
@ -500,10 +501,10 @@ index 0000000000..1dda8b7d8f
+#endif /* PROXMOX_BACKUP_CLIENT_H */ +#endif /* PROXMOX_BACKUP_CLIENT_H */
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
new file mode 100644 new file mode 100644
index 0000000000..88f5ee133f index 0000000000..3d28975eaa
--- /dev/null --- /dev/null
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -0,0 +1,959 @@ @@ -0,0 +1,956 @@
+#include "proxmox-backup-client.h" +#include "proxmox-backup-client.h"
+#include "vma.h" +#include "vma.h"
+ +
@ -581,14 +582,16 @@ index 0000000000..88f5ee133f
+lookup_active_block_job(PVEBackupDevInfo *di) +lookup_active_block_job(PVEBackupDevInfo *di)
+{ +{
+ if (!di->completed && di->bs) { + if (!di->completed && di->bs) {
+ for (BlockJob *job = block_job_next(NULL); job; job = block_job_next(job)) { + WITH_JOB_LOCK_GUARD() {
+ if (job->job.driver->job_type != JOB_TYPE_BACKUP) { + for (BlockJob *job = block_job_next_locked(NULL); job; job = block_job_next_locked(job)) {
+ continue; + if (job->job.driver->job_type != JOB_TYPE_BACKUP) {
+ } + continue;
+ }
+ +
+ BackupBlockJob *bjob = container_of(job, BackupBlockJob, common); + BackupBlockJob *bjob = container_of(job, BackupBlockJob, common);
+ if (bjob && bjob->source_bs == di->bs) { + if (bjob && bjob->source_bs == di->bs) {
+ return job; + return job;
+ }
+ } + }
+ } + }
+ } + }
@ -858,10 +861,7 @@ index 0000000000..88f5ee133f
+ qemu_mutex_unlock(&backup_state.backup_mutex); + qemu_mutex_unlock(&backup_state.backup_mutex);
+ +
+ if (next_job) { + if (next_job) {
+ AioContext *aio_context = next_job->job.aio_context;
+ aio_context_acquire(aio_context);
+ job_cancel_sync(&next_job->job, true); + job_cancel_sync(&next_job->job, true);
+ aio_context_release(aio_context);
+ } else { + } else {
+ break; + break;
+ } + }
@ -923,7 +923,7 @@ index 0000000000..88f5ee133f
+ goto out; + goto out;
+} +}
+ +
+bool job_should_pause(Job *job); +bool job_should_pause_locked(Job *job);
+ +
+static void pvebackup_run_next_job(void) +static void pvebackup_run_next_job(void)
+{ +{
@ -941,18 +941,16 @@ index 0000000000..88f5ee133f
+ if (job) { + if (job) {
+ qemu_mutex_unlock(&backup_state.backup_mutex); + qemu_mutex_unlock(&backup_state.backup_mutex);
+ +
+ AioContext *aio_context = job->job.aio_context; + WITH_JOB_LOCK_GUARD() {
+ aio_context_acquire(aio_context); + if (job_should_pause_locked(&job->job)) {
+ + bool error_or_canceled = pvebackup_error_or_canceled();
+ if (job_should_pause(&job->job)) { + if (error_or_canceled) {
+ bool error_or_canceled = pvebackup_error_or_canceled(); + job_cancel_sync_locked(&job->job, true);
+ if (error_or_canceled) { + } else {
+ job_cancel_sync(&job->job, true); + job_resume_locked(&job->job);
+ } else { + }
+ job_resume(&job->job);
+ } + }
+ } + }
+ aio_context_release(aio_context);
+ return; + return;
+ } + }
+ } + }
@ -1464,7 +1462,7 @@ index 0000000000..88f5ee133f
+ return info; + return info;
+} +}
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -740,6 +740,115 @@ @@ -740,6 +740,115 @@
@ -1605,7 +1603,7 @@ index 356db3f670..aae8a3b682 100644
+## +##
+{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} } +{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
diff --git a/qapi/machine.json b/qapi/machine.json diff --git a/qapi/machine.json b/qapi/machine.json
index d868e4d31d..a63d9a078d 100644 index f4fb1b2c9c..0d6ee836ed 100644
--- a/qapi/machine.json --- a/qapi/machine.json
+++ b/qapi/machine.json +++ b/qapi/machine.json
@@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@

View File

@ -12,10 +12,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
create mode 100644 pbs-restore.c create mode 100644 pbs-restore.c
diff --git a/meson.build b/meson.build diff --git a/meson.build b/meson.build
index 0bc2fb5b10..f48d2e0457 100644 index 782756162c..63ea813a9a 100644
--- a/meson.build --- a/meson.build
+++ b/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, vma = executable('vma', files('vma.c', 'vma-reader.c') + genh,
dependencies: [authz, block, crypto, io, qom], install: true) dependencies: [authz, block, crypto, io, qom], install: true)

View File

@ -29,7 +29,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 files changed, 142 insertions(+), 23 deletions(-) 6 files changed, 142 insertions(+), 23 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c 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 --- a/block/monitor/block-hmp-cmds.c
+++ b/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) @@ -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, false, NULL, false, NULL, !!devlist,
devlist, qdict_haskey(qdict, "speed"), speed, &error); devlist, qdict_haskey(qdict, "speed"), speed, &error);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c 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 --- a/monitor/hmp-cmds.c
+++ b/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)); 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 diff --git a/pve-backup.c b/pve-backup.c
index 88f5ee133f..1c49cd178d 100644 index 3d28975eaa..abd7062afe 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -28,6 +28,8 @@ @@ -28,6 +28,8 @@
@ -162,7 +162,7 @@ index 88f5ee133f..1c49cd178d 100644
BlockDriverState *target; BlockDriverState *target;
} PVEBackupDevInfo; } 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; return error_or_canceled;
} }
@ -176,7 +176,7 @@ index 88f5ee133f..1c49cd178d 100644
qemu_mutex_unlock(&backup_state.stat.lock); 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); pvebackup_propagate_error(local_err);
return pbs_res; return pbs_res;
} else { } else {
@ -186,7 +186,7 @@ index 88f5ee133f..1c49cd178d 100644
} }
return size; return size;
@@ -208,11 +215,11 @@ pvebackup_co_dump_vma_cb( @@ -210,11 +217,11 @@ pvebackup_co_dump_vma_cb(
} else { } else {
if (remaining >= VMA_CLUSTER_SIZE) { if (remaining >= VMA_CLUSTER_SIZE) {
assert(ret == VMA_CLUSTER_SIZE); assert(ret == VMA_CLUSTER_SIZE);
@ -200,7 +200,7 @@ index 88f5ee133f..1c49cd178d 100644
remaining = 0; 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) { if (local_err != NULL) {
pvebackup_propagate_error(local_err); pvebackup_propagate_error(local_err);
} }
@ -219,7 +219,7 @@ index 88f5ee133f..1c49cd178d 100644
} }
proxmox_backup_disconnect(backup_state.pbs); 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 // remove self from job queue
backup_state.di_list = g_list_remove(backup_state.di_list, di); backup_state.di_list = g_list_remove(backup_state.di_list, di);
@ -232,7 +232,7 @@ index 88f5ee133f..1c49cd178d 100644
g_free(di); g_free(di);
qemu_mutex_unlock(&backup_state.backup_mutex); 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); assert(di->target != NULL);
@ -253,7 +253,7 @@ index 88f5ee133f..1c49cd178d 100644
JOB_DEFAULT, pvebackup_complete_cb, di, NULL, &local_err); JOB_DEFAULT, pvebackup_complete_cb, di, NULL, &local_err);
aio_context_release(aio_context); aio_context_release(aio_context);
@@ -528,6 +559,8 @@ typedef struct QmpBackupTask { @@ -525,6 +556,8 @@ typedef struct QmpBackupTask {
const char *fingerprint; const char *fingerprint;
bool has_fingerprint; bool has_fingerprint;
int64_t backup_time; int64_t backup_time;
@ -262,7 +262,7 @@ index 88f5ee133f..1c49cd178d 100644
bool has_format; bool has_format;
BackupFormat format; BackupFormat format;
bool has_config_file; 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; size_t total = 0;
@ -270,7 +270,7 @@ index 88f5ee133f..1c49cd178d 100644
l = di_list; l = di_list;
while (l) { 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) int dump_cb_block_size = PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE; // Hardcoded (4M)
firewall_name = "fw.conf"; firewall_name = "fw.conf";
@ -279,7 +279,7 @@ index 88f5ee133f..1c49cd178d 100644
char *pbs_err = NULL; char *pbs_err = NULL;
pbs = proxmox_backup_new( pbs = proxmox_backup_new(
task->backup_file, 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; goto err;
} }
@ -289,7 +289,7 @@ index 88f5ee133f..1c49cd178d 100644
goto err; goto err;
/* register all devices */ /* 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); 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))) { if (!(di->target = bdrv_backup_dump_create(dump_cb_block_size, di->size, pvebackup_co_dump_pbs_cb, di, task->errp))) {
goto err; 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; di->dev_id = dev_id;
} }
} else if (format == BACKUP_FORMAT_VMA) { } else if (format == BACKUP_FORMAT_VMA) {
@ -341,7 +341,7 @@ index 88f5ee133f..1c49cd178d 100644
vmaw = vma_writer_create(task->backup_file, uuid, &local_err); vmaw = vma_writer_create(task->backup_file, uuid, &local_err);
if (!vmaw) { if (!vmaw) {
if (local_err) { 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) { } else if (format == BACKUP_FORMAT_DIR) {
@ -350,7 +350,7 @@ index 88f5ee133f..1c49cd178d 100644
if (mkdir(task->backup_file, 0640) != 0) { if (mkdir(task->backup_file, 0640) != 0) {
error_setg_errno(task->errp, errno, "can't create directory '%s'\n", error_setg_errno(task->errp, errno, "can't create directory '%s'\n",
task->backup_file); 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); char *uuid_str = g_strdup(backup_state.stat.uuid_str);
backup_state.stat.total = total; backup_state.stat.total = total;
@ -361,7 +361,7 @@ index 88f5ee133f..1c49cd178d 100644
qemu_mutex_unlock(&backup_state.stat.lock); qemu_mutex_unlock(&backup_state.stat.lock);
@@ -821,6 +895,10 @@ err: @@ -818,6 +892,10 @@ err:
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data; PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l); l = g_list_next(l);
@ -372,7 +372,7 @@ index 88f5ee133f..1c49cd178d 100644
if (di->target) { if (di->target) {
bdrv_unref(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_fingerprint, const char *fingerprint,
bool has_backup_id, const char *backup_id, bool has_backup_id, const char *backup_id,
bool has_backup_time, int64_t backup_time, bool has_backup_time, int64_t backup_time,
@ -380,7 +380,7 @@ index 88f5ee133f..1c49cd178d 100644
bool has_format, BackupFormat format, bool has_format, BackupFormat format,
bool has_config_file, const char *config_file, bool has_config_file, const char *config_file,
bool has_firewall_file, const char *firewall_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, .backup_id = backup_id,
.has_backup_time = has_backup_time, .has_backup_time = has_backup_time,
.backup_time = backup_time, .backup_time = backup_time,
@ -389,7 +389,7 @@ index 88f5ee133f..1c49cd178d 100644
.has_format = has_format, .has_format = has_format,
.format = format, .format = format,
.has_config_file = has_config_file, .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->has_total = true;
info->total = backup_state.stat.total; info->total = backup_state.stat.total;
@ -405,7 +405,7 @@ index 88f5ee133f..1c49cd178d 100644
qemu_mutex_unlock(&backup_state.stat.lock); qemu_mutex_unlock(&backup_state.stat.lock);
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -753,8 +753,13 @@ @@ -753,8 +753,13 @@

View File

@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 54 insertions(+), 13 deletions(-) 3 files changed, 54 insertions(+), 13 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c 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 --- a/block/monitor/block-hmp-cmds.c
+++ b/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) @@ -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, false, NULL, false, NULL, !!devlist,
devlist, qdict_haskey(qdict, "speed"), speed, &error); devlist, qdict_haskey(qdict, "speed"), speed, &error);
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 1c49cd178d..c15abefdda 100644 index abd7062afe..e113ab61b9 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
@ -53,7 +53,7 @@ index 1c49cd178d..c15abefdda 100644
uint8_t dev_id; uint8_t dev_id;
bool completed; bool completed;
char targetfile[PATH_MAX]; 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; PVEBackupDevInfo *di = opaque;
assert(backup_state.pbs); assert(backup_state.pbs);
@ -67,7 +67,7 @@ index 1c49cd178d..c15abefdda 100644
qemu_co_mutex_lock(&backup_state.dump_callback_mutex); qemu_co_mutex_lock(&backup_state.dump_callback_mutex);
// avoid deadlock if job is cancelled // 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; return -1;
} }
@ -105,7 +105,7 @@ index 1c49cd178d..c15abefdda 100644
return size; return size;
} }
@@ -178,6 +195,7 @@ pvebackup_co_dump_vma_cb( @@ -180,6 +197,7 @@ pvebackup_co_dump_vma_cb(
int ret = -1; int ret = -1;
assert(backup_state.vmaw); assert(backup_state.vmaw);
@ -113,7 +113,7 @@ index 1c49cd178d..c15abefdda 100644
uint64_t remaining = size; 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); qemu_co_mutex_unlock(&backup_state.dump_callback_mutex);
++cluster_num; ++cluster_num;
@ -124,7 +124,7 @@ index 1c49cd178d..c15abefdda 100644
if (ret < 0) { if (ret < 0) {
Error *local_err = NULL; Error *local_err = NULL;
vma_writer_error_propagate(backup_state.vmaw, &local_err); 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; const char *firewall_file;
bool has_devlist; bool has_devlist;
const char *devlist; const char *devlist;
@ -135,7 +135,7 @@ index 1c49cd178d..c15abefdda 100644
bool has_speed; bool has_speed;
int64_t speed; int64_t speed;
Error **errp; 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; 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; char *pbs_err = NULL;
pbs = proxmox_backup_new( pbs = proxmox_backup_new(
task->backup_file, 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_password ? task->password : NULL,
task->has_keyfile ? task->keyfile : NULL, task->has_keyfile ? task->keyfile : NULL,
task->has_key_password ? task->key_password : NULL, task->has_key_password ? task->key_password : NULL,
@ -155,7 +155,7 @@ index 1c49cd178d..c15abefdda 100644
if (!pbs) { if (!pbs) {
error_set(task->errp, ERROR_CLASS_GENERIC_ERROR, 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; PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l); l = g_list_next(l);
@ -164,7 +164,7 @@ index 1c49cd178d..c15abefdda 100644
const char *devname = bdrv_get_device_name(di->bs); const char *devname = bdrv_get_device_name(di->bs);
BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME); 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_id, const char *backup_id,
bool has_backup_time, int64_t backup_time, bool has_backup_time, int64_t backup_time,
bool has_use_dirty_bitmap, bool use_dirty_bitmap, bool has_use_dirty_bitmap, bool use_dirty_bitmap,
@ -173,7 +173,7 @@ index 1c49cd178d..c15abefdda 100644
bool has_format, BackupFormat format, bool has_format, BackupFormat format,
bool has_config_file, const char *config_file, bool has_config_file, const char *config_file,
bool has_firewall_file, const char *firewall_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, .backup_file = backup_file,
.has_password = has_password, .has_password = has_password,
.password = password, .password = password,
@ -182,7 +182,7 @@ index 1c49cd178d..c15abefdda 100644
.has_key_password = has_key_password, .has_key_password = has_key_password,
.key_password = key_password, .key_password = key_password,
.has_fingerprint = has_fingerprint, .has_fingerprint = has_fingerprint,
@@ -961,6 +990,10 @@ UuidInfo *qmp_backup( @@ -958,6 +987,10 @@ UuidInfo *qmp_backup(
.backup_time = backup_time, .backup_time = backup_time,
.has_use_dirty_bitmap = has_use_dirty_bitmap, .has_use_dirty_bitmap = has_use_dirty_bitmap,
.use_dirty_bitmap = use_dirty_bitmap, .use_dirty_bitmap = use_dirty_bitmap,
@ -194,7 +194,7 @@ index 1c49cd178d..c15abefdda 100644
.format = format, .format = format,
.has_config_file = has_config_file, .has_config_file = has_config_file,
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -818,6 +818,10 @@ @@ -818,6 +818,10 @@

View File

@ -20,7 +20,7 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
create mode 100644 block/pbs.c create mode 100644 block/pbs.c
diff --git a/block/meson.build b/block/meson.build diff --git a/block/meson.build b/block/meson.build
index 2783b77e9c..a26a69434e 100644 index e995ae72b9..7ef2fa72d5 100644
--- a/block/meson.build --- a/block/meson.build
+++ b/block/meson.build +++ b/block/meson.build
@@ -53,6 +53,9 @@ block_ss.add(files( @@ -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(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 diff --git a/block/pbs.c b/block/pbs.c
new file mode 100644 new file mode 100644
index 0000000000..9d1f1f39d4 index 0000000000..9d1f1f39d4
@ -316,18 +316,18 @@ index 0000000000..9d1f1f39d4
+ +
+block_init(bdrv_pbs_init); +block_init(bdrv_pbs_init);
diff --git a/configure b/configure diff --git a/configure b/configure
index 72ab03f11a..7203c270ec 100755 index 26c7bc5154..c587e986c7 100755
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -309,6 +309,7 @@ linux_user="" @@ -285,6 +285,7 @@ linux_user=""
bsd_user="" bsd_user=""
pie="" pie=""
coroutine="" coroutine=""
+pbs_bdrv="yes" +pbs_bdrv="yes"
plugins="$default_feature" plugins="$default_feature"
meson="" meson=""
meson_args="" ninja=""
@@ -902,6 +903,10 @@ for opt do @@ -864,6 +865,10 @@ for opt do
--enable-uuid|--disable-uuid) --enable-uuid|--disable-uuid)
echo "$0: $opt is obsolete, UUID support is always built" >&2 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=*) git="$optarg"
;; ;;
--with-git-submodules=*) --with-git-submodules=*)
@@ -1087,6 +1092,7 @@ cat << EOF @@ -1049,6 +1054,7 @@ cat << EOF
debug-info debugging information debug-info debugging information
safe-stack SafeStack Stack Smash Protection. Depends on safe-stack SafeStack Stack Smash Protection. Depends on
clang/llvm >= 3.7 and requires coroutine backend ucontext. 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 NOTE: The object files are built at the place where configure is launched
EOF 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 if test "$modules" = "yes"; then
echo "CONFIG_MODULES=y" >> $config_host_mak echo "CONFIG_MODULES=y" >> $config_host_mak
fi fi
@ -357,10 +357,10 @@ index 72ab03f11a..7203c270ec 100755
# XXX: suppress that # XXX: suppress that
if [ "$bsd" = "yes" ] ; then if [ "$bsd" = "yes" ] ; then
diff --git a/meson.build b/meson.build diff --git a/meson.build b/meson.build
index f48d2e0457..be4785e2f6 100644 index 63ea813a9a..f7f5b3f253 100644
--- a/meson.build --- a/meson.build
+++ b/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 += {'lzfse support': liblzfse}
summary_info += {'zstd support': zstd} summary_info += {'zstd support': zstd}
summary_info += {'NUMA host support': numa} summary_info += {'NUMA host support': numa}
@ -370,18 +370,18 @@ index f48d2e0457..be4785e2f6 100644
summary_info += {'libdaxctl support': libdaxctl} summary_info += {'libdaxctl support': libdaxctl}
summary_info += {'libudev': libudev} summary_info += {'libudev': libudev}
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -3099,6 +3099,7 @@ @@ -3103,6 +3103,7 @@
'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'parallels', 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum',
'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', 'raw', 'rbd',
{ 'name': 'replication', 'if': 'CONFIG_REPLICATION' }, { 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
+ 'pbs', + 'pbs',
'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } 'ssh', 'throttle', 'vdi', 'vhdx',
{ 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
## { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
@@ -3171,6 +3172,17 @@ @@ -3179,6 +3180,17 @@
{ 'struct': 'BlockdevOptionsNull', { 'struct': 'BlockdevOptionsNull',
'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } } 'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
@ -399,11 +399,11 @@ index 4120052690..96bc696aaa 100644
## ##
# @BlockdevOptionsNVMe: # @BlockdevOptionsNVMe:
# #
@@ -4455,6 +4467,7 @@ @@ -4531,6 +4543,7 @@
'nfs': 'BlockdevOptionsNfs', 'nfs': 'BlockdevOptionsNfs',
'null-aio': 'BlockdevOptionsNull', 'null-aio': 'BlockdevOptionsNull',
'null-co': 'BlockdevOptionsNull', 'null-co': 'BlockdevOptionsNull',
+ 'pbs': 'BlockdevOptionsPbs', + 'pbs': 'BlockdevOptionsPbs',
'nvme': 'BlockdevOptionsNVMe', 'nvme': 'BlockdevOptionsNVMe',
'parallels': 'BlockdevOptionsGenericFormat', 'nvme-io_uring': { 'type': 'BlockdevOptionsNvmeIoUring',
'preallocate':'BlockdevOptionsPreallocate', 'if': 'CONFIG_BLKIO' },

View File

@ -16,10 +16,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 files changed, 38 insertions(+) 2 files changed, 38 insertions(+)
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index c15abefdda..4684789813 100644 index e113ab61b9..9318ca4f0c 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/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; return info;
} }
@ -33,7 +33,7 @@ index c15abefdda..4684789813 100644
+ return ret; + return ret;
+} +}
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -863,6 +863,35 @@ @@ -863,6 +863,35 @@

View File

@ -15,10 +15,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 159 insertions(+), 42 deletions(-) 3 files changed, 159 insertions(+), 42 deletions(-)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c 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 --- a/monitor/hmp-cmds.c
+++ b/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) void hmp_info_backup(Monitor *mon, const QDict *qdict)
{ {
BackupStatus *info; BackupStatus *info;
@ -26,7 +26,7 @@ index 4c1671e289..c1152f55a7 100644
info = qmp_query_backup(NULL); 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 // this should not happen normally
monitor_printf(mon, "Total size: %d\n", 0); monitor_printf(mon, "Total size: %d\n", 0);
} else { } else {
@ -69,7 +69,7 @@ index 4c1671e289..c1152f55a7 100644
info->zero_bytes, zero_per); info->zero_bytes, zero_per);
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 4684789813..f90abaa50a 100644 index 9318ca4f0c..c85b2ecd83 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -46,6 +46,7 @@ static struct PVEBackupState { @@ -46,6 +46,7 @@ static struct PVEBackupState {
@ -80,7 +80,7 @@ index 4684789813..f90abaa50a 100644
} stat; } stat;
int64_t speed; int64_t speed;
VmaWriter *vmaw; 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; size_t total = 0;
@ -88,7 +88,7 @@ index 4684789813..f90abaa50a 100644
l = di_list; l = di_list;
while (l) { 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); uuid_generate(uuid);
@ -125,7 +125,7 @@ index 4684789813..f90abaa50a 100644
} }
int dump_cb_block_size = PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE; // Hardcoded (4M) 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, error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
"proxmox_backup_new failed: %s", pbs_err); "proxmox_backup_new failed: %s", pbs_err);
proxmox_backup_free_error(pbs_err); proxmox_backup_free_error(pbs_err);
@ -140,7 +140,7 @@ index 4684789813..f90abaa50a 100644
/* register all devices */ /* register all devices */
l = di_list; 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; di->block_size = dump_cb_block_size;
const char *devname = bdrv_get_device_name(di->bs); 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); BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
bool expect_only_dirty = false; 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) { if (bitmap == NULL) {
bitmap = bdrv_create_dirty_bitmap(di->bs, dump_cb_block_size, PBS_BITMAP_NAME, task->errp); bitmap = bdrv_create_dirty_bitmap(di->bs, dump_cb_block_size, PBS_BITMAP_NAME, task->errp);
if (!bitmap) { if (!bitmap) {
@ -219,7 +219,7 @@ index 4684789813..f90abaa50a 100644
} }
/* register all devices for vma writer */ /* 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); 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))) { 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); 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) { if (di->dev_id <= 0) {
error_set(task->errp, ERROR_CLASS_GENERIC_ERROR, error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
"register_stream failed"); "register_stream failed");
@ -247,7 +247,7 @@ index 4684789813..f90abaa50a 100644
} }
backup_dir = task->backup_file; 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); di->size, flags, false, &local_err);
if (local_err) { if (local_err) {
error_propagate(task->errp, 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 (task->has_config_file) {
if (pvebackup_co_add_config(task->config_file, config_name, format, backup_dir, if (pvebackup_co_add_config(task->config_file, config_name, format, backup_dir,
vmaw, pbs, task->errp) != 0) { 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 (task->has_firewall_file) {
if (pvebackup_co_add_config(task->firewall_file, firewall_name, format, backup_dir, if (pvebackup_co_add_config(task->firewall_file, firewall_name, format, backup_dir,
vmaw, pbs, task->errp) != 0) { vmaw, pbs, task->errp) != 0) {
@ -293,7 +293,7 @@ index 4684789813..f90abaa50a 100644
if (backup_state.stat.error) { if (backup_state.stat.error) {
error_free(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); char *uuid_str = g_strdup(backup_state.stat.uuid_str);
backup_state.stat.total = total; backup_state.stat.total = total;
@ -305,7 +305,7 @@ index 4684789813..f90abaa50a 100644
qemu_mutex_unlock(&backup_state.stat.lock); 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; task->result = uuid_info;
return; return;
@ -315,7 +315,7 @@ index 4684789813..f90abaa50a 100644
err: err:
l = di_list; 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; return info;
} }
@ -359,7 +359,7 @@ index 4684789813..f90abaa50a 100644
return ret; return ret;
} }
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -871,6 +871,8 @@ @@ -871,6 +871,8 @@

View File

@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 files changed, 7 insertions(+), 2 deletions(-) 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build diff --git a/meson.build b/meson.build
index be4785e2f6..3fc7c8d435 100644 index f7f5b3f253..283b0e356e 100644
--- a/meson.build --- a/meson.build
+++ b/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') has_gettid = cc.has_function('gettid')
libuuid = cc.find_library('uuid', required: true) 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) libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
# libselinux # 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-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
# os-win32.c does not # os-win32.c does not
blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
@ -34,7 +34,7 @@ index be4785e2f6..3fc7c8d435 100644
endif endif
diff --git a/os-posix.c b/os-posix.c diff --git a/os-posix.c b/os-posix.c
index 321fc4bd13..b1870d2690 100644 index 4858650c3e..c5cb12226a 100644
--- a/os-posix.c --- a/os-posix.c
+++ b/os-posix.c +++ b/os-posix.c
@@ -28,6 +28,8 @@ @@ -28,6 +28,8 @@
@ -46,7 +46,7 @@ index 321fc4bd13..b1870d2690 100644
/* Needed early for CONFIG_BSD etc. */ /* Needed early for CONFIG_BSD etc. */
#include "net/slirp.h" #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, 0);
dup2(fd, 1); dup2(fd, 1);

View File

@ -7,14 +7,14 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
--- ---
include/qemu/job.h | 12 ++++++++++++ include/qemu/job.h | 12 ++++++++++++
job.c | 31 +++++++++++++++++++++++++++++++ job.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+) 2 files changed, 46 insertions(+)
diff --git a/include/qemu/job.h b/include/qemu/job.h 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 --- a/include/qemu/job.h
+++ b/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); 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 * 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. * job_txn_new. If it's the last reference to the object, it will be freed.
diff --git a/job.c b/job.c diff --git a/job.c b/job.c
index e5699ad200..34c9758349 100644 index 93e22d180b..2b31f1e14f 100644
--- a/job.c --- a/job.c
+++ b/job.c +++ b/job.c
@@ -72,6 +72,8 @@ struct JobTxn { @@ -93,6 +93,8 @@ struct JobTxn {
/* Reference count */ /* Reference count */
int refcnt; int refcnt;
@ -45,8 +45,8 @@ index e5699ad200..34c9758349 100644
+ bool sequential; + bool sequential;
}; };
/* Right now, this mutex is only needed to synchronize accesses to job->busy void job_lock(void)
@@ -102,6 +104,25 @@ JobTxn *job_txn_new(void) @@ -118,6 +120,25 @@ JobTxn *job_txn_new(void)
return txn; return txn;
} }
@ -69,20 +69,23 @@ index e5699ad200..34c9758349 100644
+ job_start(first); + 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++; @@ -1057,6 +1078,12 @@ static void job_completed_txn_success_locked(Job *job)
@@ -897,6 +918,9 @@ static void job_completed_txn_success(Job *job)
*/ */
QLIST_FOREACH(other_job, &txn->jobs, txn_list) { QLIST_FOREACH(other_job, &txn->jobs, txn_list) {
if (!job_is_completed(other_job)) { if (!job_is_completed_locked(other_job)) {
+ if (txn->sequential) { + if (txn->sequential) {
+ job_unlock();
+ /* Needs to be called without holding the job lock */
+ job_start(other_job); + job_start(other_job);
+ job_lock();
+ } + }
return; return;
} }
assert(other_job->ret == 0); 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; return -EBUSY;
} }
@ -90,9 +93,9 @@ index e5699ad200..34c9758349 100644
+ * of cancelling, these have not begun work so job_enter won't do anything, + * of cancelling, these have not begun work so job_enter won't do anything,
+ * let's ensure they are marked as ABORTING if required */ + * let's ensure they are marked as ABORTING if required */
+ if (job->status == JOB_STATUS_CREATED && job->txn->sequential) { + 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_unlock();
(job_enter(job), !job_is_completed(job))); AIO_WAIT_WHILE_UNLOCKED(job->aio_context,
(job_enter(job), !job_is_completed(job)));

View 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: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
[add new force parameter to job_cancel_sync calls] [FE: add new force parameter to job_cancel_sync calls
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> adapt for new job lock mechanism replacing AioContext locks]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
--- ---
pve-backup.c | 167 +++++++++++++++------------------------------------ pve-backup.c | 163 ++++++++++++++++-----------------------------------
1 file changed, 49 insertions(+), 118 deletions(-) 1 file changed, 50 insertions(+), 113 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index f90abaa50a..63c686463f 100644 index c85b2ecd83..b5fb844434 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -52,6 +52,7 @@ static struct PVEBackupState { @@ -52,6 +52,7 @@ static struct PVEBackupState {
@ -30,7 +31,7 @@ index f90abaa50a..63c686463f 100644
QemuMutex backup_mutex; QemuMutex backup_mutex;
CoMutex dump_callback_mutex; CoMutex dump_callback_mutex;
} backup_state; } backup_state;
@@ -71,32 +72,12 @@ typedef struct PVEBackupDevInfo { @@ -71,34 +72,12 @@ typedef struct PVEBackupDevInfo {
size_t size; size_t size;
uint64_t block_size; uint64_t block_size;
uint8_t dev_id; uint8_t dev_id;
@ -47,14 +48,16 @@ index f90abaa50a..63c686463f 100644
-lookup_active_block_job(PVEBackupDevInfo *di) -lookup_active_block_job(PVEBackupDevInfo *di)
-{ -{
- if (!di->completed && di->bs) { - if (!di->completed && di->bs) {
- for (BlockJob *job = block_job_next(NULL); job; job = block_job_next(job)) { - WITH_JOB_LOCK_GUARD() {
- if (job->job.driver->job_type != JOB_TYPE_BACKUP) { - for (BlockJob *job = block_job_next_locked(NULL); job; job = block_job_next_locked(job)) {
- continue; - if (job->job.driver->job_type != JOB_TYPE_BACKUP) {
- } - continue;
- }
- -
- BackupBlockJob *bjob = container_of(job, BackupBlockJob, common); - BackupBlockJob *bjob = container_of(job, BackupBlockJob, common);
- if (bjob && bjob->source_bs == di->bs) { - if (bjob && bjob->source_bs == di->bs) {
- return job; - return job;
- }
- } - }
- } - }
- } - }
@ -64,7 +67,7 @@ index f90abaa50a..63c686463f 100644
static void pvebackup_propagate_error(Error *err) static void pvebackup_propagate_error(Error *err)
{ {
qemu_mutex_lock(&backup_state.stat.lock); 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) { if (local_err != NULL) {
pvebackup_propagate_error(local_err); pvebackup_propagate_error(local_err);
} }
@ -83,7 +86,7 @@ index f90abaa50a..63c686463f 100644
} }
proxmox_backup_disconnect(backup_state.pbs); 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); qemu_mutex_lock(&backup_state.backup_mutex);
@ -92,7 +95,7 @@ index f90abaa50a..63c686463f 100644
if (ret < 0) { if (ret < 0) {
Error *local_err = NULL; Error *local_err = NULL;
error_setg(&local_err, "job failed with err %d - %s", ret, strerror(-ret)); 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); block_on_coroutine_fn(pvebackup_complete_stream, di);
@ -119,7 +122,7 @@ index f90abaa50a..63c686463f 100644
} }
static void pvebackup_cancel(void) 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"); proxmox_backup_abort(backup_state.pbs, "backup canceled");
} }
@ -128,13 +131,6 @@ index f90abaa50a..63c686463f 100644
- for(;;) { - for(;;) {
- -
- BlockJob *next_job = NULL; - 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 + /* it's enough to cancel one job in the transaction, the rest will follow
+ * automatically */ + * automatically */
+ GList *bdi = g_list_first(backup_state.di_list); + GList *bdi = g_list_first(backup_state.di_list);
@ -142,15 +138,23 @@ index f90abaa50a..63c686463f 100644
+ ((PVEBackupDevInfo *)bdi->data)->job : + ((PVEBackupDevInfo *)bdi->data)->job :
+ NULL; + 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); - BlockJob *job = lookup_active_block_job(di);
- if (job != NULL) { - if (job != NULL) {
- next_job = job; - next_job = job;
- break; - break;
- } - }
- }
+ /* ref the job before releasing the mutex, just to be safe */ + /* ref the job before releasing the mutex, just to be safe */
+ if (cancel_job) { + 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); - qemu_mutex_unlock(&backup_state.backup_mutex);
@ -159,27 +163,21 @@ index f90abaa50a..63c686463f 100644
+ qemu_mutex_unlock(&backup_state.backup_mutex); + qemu_mutex_unlock(&backup_state.backup_mutex);
- if (next_job) { - if (next_job) {
- AioContext *aio_context = next_job->job.aio_context;
- aio_context_acquire(aio_context);
- job_cancel_sync(&next_job->job, true); - job_cancel_sync(&next_job->job, true);
- aio_context_release(aio_context);
- } else { - } else {
- break; - break;
- }
+ if (cancel_job) { + if (cancel_job) {
+ AioContext *aio_context = cancel_job->job.aio_context; + WITH_JOB_LOCK_GUARD() {
+ aio_context_acquire(aio_context); + job_cancel_sync_locked(&cancel_job->job, true);
+ job_cancel_sync(&cancel_job->job, true); + job_unref_locked(&cancel_job->job);
+ job_unref(&cancel_job->job); }
+ aio_context_release(aio_context);
} }
} }
@@ -458,49 +416,19 @@ static int coroutine_fn pvebackup_co_add_config(
@@ -459,51 +415,19 @@ static int coroutine_fn pvebackup_co_add_config(
goto out; goto out;
} }
-bool job_should_pause(Job *job); -bool job_should_pause_locked(Job *job);
- -
-static void pvebackup_run_next_job(void) -static void pvebackup_run_next_job(void)
-{ -{
@ -197,18 +195,16 @@ index f90abaa50a..63c686463f 100644
- if (job) { - if (job) {
- qemu_mutex_unlock(&backup_state.backup_mutex); - qemu_mutex_unlock(&backup_state.backup_mutex);
- -
- AioContext *aio_context = job->job.aio_context; - WITH_JOB_LOCK_GUARD() {
- aio_context_acquire(aio_context); - if (job_should_pause_locked(&job->job)) {
- - bool error_or_canceled = pvebackup_error_or_canceled();
- if (job_should_pause(&job->job)) { - if (error_or_canceled) {
- bool error_or_canceled = pvebackup_error_or_canceled(); - job_cancel_sync_locked(&job->job, true);
- if (error_or_canceled) { - } else {
- job_cancel_sync(&job->job, true); - job_resume_locked(&job->job);
- } else { - }
- job_resume(&job->job);
- } - }
- } - }
- aio_context_release(aio_context);
- return; - return;
- } - }
- } - }
@ -234,7 +230,7 @@ index f90abaa50a..63c686463f 100644
BackupPerf perf = { .max_workers = 16 }; BackupPerf perf = { .max_workers = 16 };
/* create and start all jobs (paused state) */ /* 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( BlockJob *job = backup_job_create(
NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap, 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, 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); 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); pvebackup_propagate_error(create_job_err);
break; break;
} }
@ -253,18 +249,20 @@ index f90abaa50a..63c686463f 100644
bdrv_unref(di->target); bdrv_unref(di->target);
di->target = NULL; 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); bdrv_unref(di->target);
di->target = NULL; di->target = NULL;
} }
+ +
+ if (di->job) { + 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; PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l); l = g_list_next(l);
@ -275,7 +273,7 @@ index f90abaa50a..63c686463f 100644
if (di->target) { if (di->target) {
bdrv_unref(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); block_on_coroutine_fn(pvebackup_co_prepare, &task);
if (*errp == NULL) { if (*errp == NULL) {

View File

@ -49,15 +49,15 @@ before.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
[add new force parameter to job_cancel_sync calls] [FE: add new force parameter to job_cancel_sync calls]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
--- ---
pve-backup.c | 217 ++++++++++++++++++++++++++++--------------- pve-backup.c | 212 +++++++++++++++++++++++++++----------------
qapi/block-core.json | 5 +- 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 diff --git a/pve-backup.c b/pve-backup.c
index 63c686463f..6f05796fad 100644 index b5fb844434..88268bb586 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap"; @@ -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 // remove self from job list
backup_state.di_list = g_list_remove(backup_state.di_list, di); 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 */ /* call cleanup if we're the last job */
if (!g_list_first(backup_state.di_list)) { if (!g_list_first(backup_state.di_list)) {
@ -229,10 +229,7 @@ index 63c686463f..6f05796fad 100644
+static void job_cancel_bh(void *opaque) { +static void job_cancel_bh(void *opaque) {
+ CoCtxData *data = (CoCtxData*)opaque; + CoCtxData *data = (CoCtxData*)opaque;
+ Job *job = (Job*)data->data; + Job *job = (Job*)data->data;
+ AioContext *job_ctx = job->aio_context;
+ aio_context_acquire(job_ctx);
+ job_cancel_sync(job, true); + job_cancel_sync(job, true);
+ aio_context_release(job_ctx);
+ aio_co_enter(data->ctx, data->co); + aio_co_enter(data->ctx, data->co);
+} +}
@ -247,13 +244,15 @@ index 63c686463f..6f05796fad 100644
if (backup_state.vmaw) { if (backup_state.vmaw) {
/* make sure vma writer does not block anymore */ /* 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 : ((PVEBackupDevInfo *)bdi->data)->job :
NULL; NULL;
- /* ref the job before releasing the mutex, just to be safe */ - /* ref the job before releasing the mutex, just to be safe */
if (cancel_job) { if (cancel_job) {
- job_ref(&cancel_job->job); - WITH_JOB_LOCK_GUARD() {
- job_ref_locked(&cancel_job->job);
- }
+ CoCtxData data = { + CoCtxData data = {
+ .ctx = qemu_get_current_aio_context(), + .ctx = qemu_get_current_aio_context(),
+ .co = qemu_coroutine_self(), + .co = qemu_coroutine_self(),
@ -268,11 +267,10 @@ index 63c686463f..6f05796fad 100644
- qemu_mutex_unlock(&backup_state.backup_mutex); - qemu_mutex_unlock(&backup_state.backup_mutex);
- -
- if (cancel_job) { - if (cancel_job) {
- AioContext *aio_context = cancel_job->job.aio_context; - WITH_JOB_LOCK_GUARD() {
- aio_context_acquire(aio_context); - job_cancel_sync_locked(&cancel_job->job, true);
- job_cancel_sync(&cancel_job->job, true); - job_unref_locked(&cancel_job->job);
- job_unref(&cancel_job->job); - }
- aio_context_release(aio_context);
- } - }
+ qemu_co_mutex_unlock(&backup_state.backup_mutex); + qemu_co_mutex_unlock(&backup_state.backup_mutex);
} }
@ -284,7 +282,7 @@ index 63c686463f..6f05796fad 100644
} }
// assumes the caller holds backup_mutex // 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; goto out;
} }
@ -304,7 +302,7 @@ index 63c686463f..6f05796fad 100644
Error *local_err = NULL; Error *local_err = NULL;
/* create job transaction to synchronize bitmap commit and cancel all /* 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); aio_context_release(aio_context);
@ -334,15 +332,13 @@ index 63c686463f..6f05796fad 100644
l = backup_state.di_list; l = backup_state.di_list;
while (l) { while (l) {
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data; 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) { if (di->job) {
+ AioContext *ctx = di->job->job.aio_context; WITH_JOB_LOCK_GUARD() {
+ aio_context_acquire(ctx); + job_cancel_sync_locked(&di->job->job, true);
+ job_cancel_sync(&di->job->job, true); job_unref_locked(&di->job->job);
job_unref(&di->job->job); }
+ aio_context_release(ctx);
} }
} }
} }
@ -353,7 +349,7 @@ index 63c686463f..6f05796fad 100644
} }
typedef struct QmpBackupTask { typedef struct QmpBackupTask {
@@ -525,11 +567,12 @@ typedef struct QmpBackupTask { @@ -528,11 +563,12 @@ typedef struct QmpBackupTask {
UuidInfo *result; UuidInfo *result;
} QmpBackupTask; } QmpBackupTask;
@ -367,7 +363,7 @@ index 63c686463f..6f05796fad 100644
QmpBackupTask *task = opaque; QmpBackupTask *task = opaque;
task->result = NULL; // just to be sure 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"; const char *firewall_name = "qemu-server.fw";
if (backup_state.di_list) { if (backup_state.di_list) {
@ -378,7 +374,7 @@ index 63c686463f..6f05796fad 100644
return; 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; di->size = size;
total += size; total += size;
@ -387,7 +383,7 @@ index 63c686463f..6f05796fad 100644
} }
uuid_generate(uuid); 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.dirty = total - backup_state.stat.reused;
backup_state.stat.transferred = 0; backup_state.stat.transferred = 0;
backup_state.stat.zero_bytes = 0; backup_state.stat.zero_bytes = 0;
@ -396,7 +392,7 @@ index 63c686463f..6f05796fad 100644
qemu_mutex_unlock(&backup_state.stat.lock); 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; uuid_info->UUID = uuid_str;
task->result = uuid_info; task->result = uuid_info;
@ -430,7 +426,7 @@ index 63c686463f..6f05796fad 100644
return; return;
err_mutex: err_mutex:
@@ -885,6 +960,7 @@ err: @@ -888,6 +956,7 @@ err:
g_free(di); g_free(di);
} }
g_list_free(di_list); g_list_free(di_list);
@ -438,7 +434,7 @@ index 63c686463f..6f05796fad 100644
if (devs) { if (devs) {
g_strfreev(devs); g_strfreev(devs);
@@ -905,6 +981,8 @@ err: @@ -908,6 +977,8 @@ err:
} }
task->result = NULL; task->result = NULL;
@ -447,7 +443,7 @@ index 63c686463f..6f05796fad 100644
return; return;
} }
@@ -958,24 +1036,8 @@ UuidInfo *qmp_backup( @@ -961,24 +1032,8 @@ UuidInfo *qmp_backup(
.errp = errp, .errp = errp,
}; };
@ -472,7 +468,7 @@ index 63c686463f..6f05796fad 100644
return task.result; 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->transferred = backup_state.stat.transferred;
info->has_reused = true; info->has_reused = true;
info->reused = backup_state.stat.reused; info->reused = backup_state.stat.reused;
@ -481,7 +477,7 @@ index 63c686463f..6f05796fad 100644
qemu_mutex_unlock(&backup_state.stat.lock); qemu_mutex_unlock(&backup_state.stat.lock);
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -770,12 +770,15 @@ @@ -770,12 +770,15 @@

View File

@ -51,7 +51,7 @@ index 0842d00cd2..d012f4d8d3 100644
softmmu_ss.add(files( softmmu_ss.add(files(
'block-dirty-bitmap.c', 'block-dirty-bitmap.c',
diff --git a/migration/migration.c b/migration/migration.c diff --git a/migration/migration.c b/migration/migration.c
index bb8bbddfe4..8109e468eb 100644 index f485eea5fb..89b287180f 100644
--- a/migration/migration.c --- a/migration/migration.c
+++ b/migration/migration.c +++ b/migration/migration.c
@@ -229,6 +229,7 @@ void migration_object_init(void) @@ -229,6 +229,7 @@ void migration_object_init(void)
@ -175,10 +175,10 @@ index 0000000000..29f2b3860d
+ NULL); + NULL);
+} +}
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 6f05796fad..5fa3cc1352 100644 index 88268bb586..fa9c6c4493 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/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_library_version = g_strdup(proxmox_backup_qemu_version());
ret->pbs_dirty_bitmap = true; ret->pbs_dirty_bitmap = true;
ret->pbs_dirty_bitmap_savevm = true; ret->pbs_dirty_bitmap_savevm = true;
@ -187,7 +187,7 @@ index 6f05796fad..5fa3cc1352 100644
return ret; return ret;
} }
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -879,6 +879,11 @@ @@ -879,6 +879,11 @@

View File

@ -21,10 +21,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 30 insertions(+) 1 file changed, 30 insertions(+)
diff --git a/block/iscsi.c b/block/iscsi.c diff --git a/block/iscsi.c b/block/iscsi.c
index d707d0b354..da6ed52323 100644 index a316d46d96..3ed4a50c0d 100644
--- a/block/iscsi.c --- a/block/iscsi.c
+++ b/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; const char *name;
char *iscsi_name; char *iscsi_name;
UuidInfo *uuid_info; UuidInfo *uuid_info;

View File

@ -32,7 +32,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 files changed, 77 insertions(+), 196 deletions(-) 5 files changed, 77 insertions(+), 196 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c 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 --- a/block/monitor/block-hmp-cmds.c
+++ b/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) @@ -1016,7 +1016,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
@ -54,7 +54,7 @@ index ea7b665aa2..ef45552e3b 100644
Error *error = NULL; Error *error = NULL;
diff --git a/hmp-commands.hx b/hmp-commands.hx diff --git a/hmp-commands.hx b/hmp-commands.hx
index 97f24942b3..7a2be816da 100644 index fcf9461295..5fdb198ca4 100644
--- a/hmp-commands.hx --- a/hmp-commands.hx
+++ b/hmp-commands.hx +++ b/hmp-commands.hx
@@ -111,6 +111,7 @@ ERST @@ -111,6 +111,7 @@ ERST
@ -116,10 +116,10 @@ index 4ce7bc0b5e..0923037dec 100644
static void proxmox_backup_schedule_wake(void *data) { static void proxmox_backup_schedule_wake(void *data) {
CoCtxData *waker = (CoCtxData *)data; CoCtxData *waker = (CoCtxData *)data;
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 5fa3cc1352..323014744c 100644 index fa9c6c4493..109498eaf9 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/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); aio_co_enter(data->ctx, data->co);
} }
@ -128,7 +128,7 @@ index 5fa3cc1352..323014744c 100644
{ {
Error *cancel_err = NULL; Error *cancel_err = NULL;
error_setg(&cancel_err, "backup canceled"); 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); qemu_co_mutex_unlock(&backup_state.backup_mutex);
} }
@ -140,7 +140,7 @@ index 5fa3cc1352..323014744c 100644
// assumes the caller holds backup_mutex // assumes the caller holds backup_mutex
static int coroutine_fn pvebackup_co_add_config( static int coroutine_fn pvebackup_co_add_config(
const char *file, 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); aio_co_enter(data->ctx, data->co);
} }
@ -207,7 +207,7 @@ index 5fa3cc1352..323014744c 100644
BlockBackend *blk; BlockBackend *blk;
BlockDriverState *bs = NULL; BlockDriverState *bs = NULL;
const char *backup_dir = 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"; const char *firewall_name = "qemu-server.fw";
if (backup_state.di_list) { if (backup_state.di_list) {
@ -230,7 +230,7 @@ index 5fa3cc1352..323014744c 100644
gchar **d = devs; gchar **d = devs;
while (d && *d) { 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) { if (blk) {
bs = blk_bs(blk); bs = blk_bs(blk);
if (!bdrv_is_inserted(bs)) { if (!bdrv_is_inserted(bs)) {
@ -247,7 +247,7 @@ index 5fa3cc1352..323014744c 100644
"Device '%s' not found", *d); "Device '%s' not found", *d);
goto err; 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) { if (!di_list) {
@ -256,7 +256,7 @@ index 5fa3cc1352..323014744c 100644
goto err; 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) { while (l) {
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data; PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l); l = g_list_next(l);
@ -272,7 +272,7 @@ index 5fa3cc1352..323014744c 100644
goto err; goto err;
} }
di->size = size; 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) { if (format == BACKUP_FORMAT_PBS) {
@ -337,7 +337,7 @@ index 5fa3cc1352..323014744c 100644
if (connect_result < 0) if (connect_result < 0)
goto err_mutex; 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); BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
bool expect_only_dirty = false; bool expect_only_dirty = false;
@ -349,7 +349,7 @@ index 5fa3cc1352..323014744c 100644
if (!bitmap) { if (!bitmap) {
goto err_mutex; 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; 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); backup_state.stat.bitmap_list = g_list_append(backup_state.stat.bitmap_list, info);
} }
} else if (format == BACKUP_FORMAT_VMA) { } else if (format == BACKUP_FORMAT_VMA) {
@ -377,7 +377,7 @@ index 5fa3cc1352..323014744c 100644
} }
goto err_mutex; 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; PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l); l = g_list_next(l);
@ -409,7 +409,7 @@ index 5fa3cc1352..323014744c 100644
l = di_list; l = di_list;
while (l) { 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, bdrv_img_create(di->targetfile, "raw", NULL, NULL, NULL,
di->size, flags, false, &local_err); di->size, flags, false, &local_err);
if (local_err) { if (local_err) {
@ -453,7 +453,7 @@ index 5fa3cc1352..323014744c 100644
goto err_mutex; 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) { if (backup_state.stat.backup_file) {
g_free(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_copy(backup_state.stat.uuid, uuid);
uuid_unparse_lower(uuid, backup_state.stat.uuid_str); 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); qemu_mutex_unlock(&backup_state.stat.lock);
@ -471,7 +471,7 @@ index 5fa3cc1352..323014744c 100644
backup_state.vmaw = vmaw; backup_state.vmaw = vmaw;
backup_state.pbs = pbs; 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 = g_malloc0(sizeof(*uuid_info));
uuid_info->UUID = uuid_str; 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 /* 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 * 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. * 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(); qemu_coroutine_yield();
if (local_err) { if (local_err) {
@ -489,7 +489,7 @@ index 5fa3cc1352..323014744c 100644
goto err; 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 */ /* start the first job in the transaction */
job_txn_start_seq(backup_state.txn); job_txn_start_seq(backup_state.txn);
@ -498,7 +498,7 @@ index 5fa3cc1352..323014744c 100644
err_mutex: err_mutex:
qemu_mutex_unlock(&backup_state.stat.lock); qemu_mutex_unlock(&backup_state.stat.lock);
@@ -969,7 +936,7 @@ err: @@ -965,7 +932,7 @@ err:
if (vmaw) { if (vmaw) {
Error *err = NULL; Error *err = NULL;
vma_writer_close(vmaw, &err); vma_writer_close(vmaw, &err);
@ -507,7 +507,7 @@ index 5fa3cc1352..323014744c 100644
} }
if (pbs) { if (pbs) {
@@ -980,65 +947,8 @@ err: @@ -976,65 +943,8 @@ err:
rmdir(backup_dir); rmdir(backup_dir);
} }
@ -575,7 +575,7 @@ index 5fa3cc1352..323014744c 100644
BackupStatus *qmp_query_backup(Error **errp) BackupStatus *qmp_query_backup(Error **errp)
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -842,7 +842,7 @@ @@ -842,7 +842,7 @@

View File

@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 11 insertions(+) 3 files changed, 11 insertions(+)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c 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 --- a/block/monitor/block-hmp-cmds.c
+++ b/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) @@ -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, NULL, // PBS backup-id
false, 0, // PBS backup-time false, 0, // PBS backup-time
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 323014744c..9f6c04a512 100644 index 109498eaf9..4b5134ed27 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/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_password, const char *password,
bool has_keyfile, const char *keyfile, bool has_keyfile, const char *keyfile,
bool has_key_password, const char *key_password, bool has_key_password, const char *key_password,
@ -42,7 +42,7 @@ index 323014744c..9f6c04a512 100644
bool has_fingerprint, const char *fingerprint, bool has_fingerprint, const char *fingerprint,
bool has_backup_id, const char *backup_id, bool has_backup_id, const char *backup_id,
bool has_backup_time, int64_t backup_time, 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_password ? password : NULL,
has_keyfile ? keyfile : NULL, has_keyfile ? keyfile : NULL,
has_key_password ? key_password : NULL, has_key_password ? key_password : NULL,
@ -50,7 +50,7 @@ index 323014744c..9f6c04a512 100644
has_compress ? compress : true, has_compress ? compress : true,
has_encrypt ? encrypt : has_keyfile, has_encrypt ? encrypt : has_keyfile,
has_fingerprint ? fingerprint : NULL, 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_savevm = true;
ret->pbs_dirty_bitmap_migration = true; ret->pbs_dirty_bitmap_migration = true;
ret->query_bitmap_info = true; ret->query_bitmap_info = true;
@ -58,7 +58,7 @@ index 323014744c..9f6c04a512 100644
return ret; return ret;
} }
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -813,6 +813,8 @@ @@ -813,6 +813,8 @@

View File

@ -17,7 +17,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 14 insertions(+), 3 deletions(-) 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/block/pbs.c b/block/pbs.c diff --git a/block/pbs.c b/block/pbs.c
index 0b05ea9080..c5eb4d5bad 100644 index 9d1f1f39d4..ce9a870885 100644
--- a/block/pbs.c --- a/block/pbs.c
+++ b/block/pbs.c +++ b/block/pbs.c
@@ -200,7 +200,16 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs, @@ -200,7 +200,16 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,

View File

@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 4 insertions(+) 1 file changed, 4 insertions(+)
diff --git a/block/io.c b/block/io.c diff --git a/block/io.c b/block/io.c
index 0a8cbefe86..531b3b7a2d 100644 index b9424024f9..01f50d28c8 100644
--- a/block/io.c --- a/block/io.c
+++ b/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; int ret;

View File

@ -390,7 +390,7 @@ index 0000000000..43d40d11af
+ +
+block_init(bdrv_alloc_track_init); +block_init(bdrv_alloc_track_init);
diff --git a/block/meson.build b/block/meson.build diff --git a/block/meson.build b/block/meson.build
index a26a69434e..74e5f49758 100644 index 7ef2fa72d5..15352f579f 100644
--- a/block/meson.build --- a/block/meson.build
+++ b/block/meson.build +++ b/block/meson.build
@@ -2,6 +2,7 @@ block_ss.add(genh) @@ -2,6 +2,7 @@ block_ss.add(genh)

View File

@ -11,7 +11,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 5 insertions(+) 1 file changed, 5 insertions(+)
diff --git a/migration/savevm-async.c b/migration/savevm-async.c 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 --- a/migration/savevm-async.c
+++ b/migration/savevm-async.c +++ b/migration/savevm-async.c
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@

View File

@ -12,7 +12,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 36 insertions(+), 7 deletions(-) 3 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst 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 --- a/docs/tools/qemu-img.rst
+++ b/docs/tools/qemu-img.rst +++ b/docs/tools/qemu-img.rst
@@ -492,10 +492,10 @@ Command description: @@ -492,10 +492,10 @@ Command description:
@ -46,10 +46,10 @@ index b5b0bb4467..36f97e1f19 100644
DEF("info", img_info, DEF("info", img_info,
diff --git a/qemu-img.c b/qemu-img.c diff --git a/qemu-img.c b/qemu-img.c
index c6b4a5567d..041c203fc3 100644 index 59c403373b..065a54cc42 100644
--- a/qemu-img.c --- a/qemu-img.c
+++ b/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; BlockDriver *drv = NULL, *proto_drv = NULL;
BlockBackend *blk1 = NULL, *blk2 = NULL; BlockBackend *blk1 = NULL, *blk2 = NULL;
QemuOpts *opts = NULL; QemuOpts *opts = NULL;
@ -57,15 +57,15 @@ index c6b4a5567d..041c203fc3 100644
QemuOptsList *create_opts = NULL; QemuOptsList *create_opts = NULL;
Error *local_err = NULL; Error *local_err = NULL;
bool image_opts = false; 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 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; bool force_share = false, skip_create = false;
+ const char *snapshot_name = NULL; + const char *snapshot_name = NULL;
struct DdInfo dd = { struct DdInfo dd = {
.flags = 0, .flags = 0,
.count = 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 } { 0, 0, 0, 0 }
}; };
@ -74,7 +74,7 @@ index c6b4a5567d..041c203fc3 100644
if (c == EOF) { if (c == EOF) {
break; 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': case 'n':
skip_create = true; skip_create = true;
break; break;
@ -94,7 +94,7 @@ index c6b4a5567d..041c203fc3 100644
case 'U': case 'U':
force_share = true; force_share = true;
break; 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) { if (dd.flags & C_IF) {
blk1 = img_open(image_opts, in.filename, fmt, 0, false, false, blk1 = img_open(image_opts, in.filename, fmt, 0, false, false,
force_share); force_share);
@ -120,7 +120,7 @@ index c6b4a5567d..041c203fc3 100644
} }
if (dd.flags & C_OSIZE) { 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: out:
g_free(arg); g_free(arg);
qemu_opts_del(opts); qemu_opts_del(opts);

View File

@ -13,7 +13,7 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 files changed, 47 insertions(+), 9 deletions(-) 5 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c 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 --- a/block/monitor/block-hmp-cmds.c
+++ b/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) @@ -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, 0, // PBS backup-time
false, false, // PBS use-dirty-bitmap false, false, // PBS use-dirty-bitmap
diff --git a/block/pbs.c b/block/pbs.c diff --git a/block/pbs.c b/block/pbs.c
index c5eb4d5bad..7471e2ef9d 100644 index ce9a870885..9192f3e41b 100644
--- a/block/pbs.c --- a/block/pbs.c
+++ b/block/pbs.c +++ b/block/pbs.c
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
@ -170,7 +170,7 @@ index 2f834cf42e..f03d9bab8d 100644
fprintf(stderr, "restore failed: %s\n", pbs_error); fprintf(stderr, "restore failed: %s\n", pbs_error);
return -1; return -1;
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 9f6c04a512..f6a5f8c785 100644 index 4b5134ed27..262e7d3894 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
@ -182,7 +182,7 @@ index 9f6c04a512..f6a5f8c785 100644
/* PVE backup state and related function */ /* 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_key_password, const char *key_password,
bool has_master_keyfile, const char *master_keyfile, bool has_master_keyfile, const char *master_keyfile,
bool has_fingerprint, const char *fingerprint, 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_id, const char *backup_id,
bool has_backup_time, int64_t backup_time, bool has_backup_time, int64_t backup_time,
bool has_use_dirty_bitmap, bool use_dirty_bitmap, 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"; firewall_name = "fw.conf";
char *pbs_err = NULL; char *pbs_err = NULL;
@ -202,7 +202,7 @@ index 9f6c04a512..f6a5f8c785 100644
backup_time, backup_time,
dump_cb_block_size, dump_cb_block_size,
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -817,6 +817,8 @@ @@ -817,6 +817,8 @@
@ -222,7 +222,7 @@ index fc8a125451..cc2ead0b75 100644
'*backup-id': 'str', '*backup-id': 'str',
'*backup-time': 'int', '*backup-time': 'int',
'*use-dirty-bitmap': 'bool', '*use-dirty-bitmap': 'bool',
@@ -3282,7 +3285,7 @@ @@ -3290,7 +3293,7 @@
{ 'struct': 'BlockdevOptionsPbs', { 'struct': 'BlockdevOptionsPbs',
'data': { 'repository': 'str', 'snapshot': 'str', 'archive': 'str', 'data': { 'repository': 'str', 'snapshot': 'str', 'archive': 'str',
'*keyfile': 'str', '*password': 'str', '*fingerprint': 'str', '*keyfile': 'str', '*password': 'str', '*fingerprint': 'str',

View 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() the backup QMP command fails) would try to call proxmox_backup_abort()
and run into a segfault. 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> 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 ++++++++-- pve-backup.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-) 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index f6a5f8c785..5bed6f4014 100644 index 262e7d3894..fde3554133 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/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) { if (*errp) {
@ -34,22 +36,21 @@ index f6a5f8c785..5bed6f4014 100644
l = backup_state.di_list; l = backup_state.di_list;
while (l) { while (l) {
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data; 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; di->target = NULL;
} }
- if (di->job) { - if (di->job) {
+ if (!canceled && di->job) { + if (!canceled && di->job) {
AioContext *ctx = di->job->job.aio_context; WITH_JOB_LOCK_GUARD() {
aio_context_acquire(ctx); job_cancel_sync_locked(&di->job->job, true);
job_cancel_sync(&di->job->job, true); - job_unref_locked(&di->job->job);
- job_unref(&di->job->job); }
aio_context_release(ctx);
+ canceled = true; + canceled = true;
} }
} }
} }
@@ -947,6 +952,7 @@ err: @@ -943,6 +948,7 @@ err:
if (pbs) { if (pbs) {
proxmox_backup_disconnect(pbs); proxmox_backup_disconnect(pbs);

View File

@ -14,62 +14,59 @@ freed. With unlucky timings it seems possible that:
di_list di_list
5. qmp_backup_cancel will pick a job that's already been freed 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> 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 ++++++++++++++++++++----- pve-backup.c | 22 +++++++++++++++++++---
1 file changed, 20 insertions(+), 5 deletions(-) 1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 5bed6f4014..0c34428713 100644 index fde3554133..0cf30e1ced 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/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) { + if (di->job) {
+ AioContext *ctx = di->job->job.aio_context; + WITH_JOB_LOCK_GUARD() {
+ aio_context_acquire(ctx); + job_unref_locked(&di->job->job);
+ job_unref(&di->job->job); + di->job = NULL;
+ di->job = NULL; + }
+ aio_context_release(ctx);
+ } + }
+ +
// remove self from job list // remove self from job list
backup_state.di_list = g_list_remove(backup_state.di_list, di); backup_state.di_list = g_list_remove(backup_state.di_list, di);
@@ -491,9 +499,12 @@ static void create_backup_jobs_bh(void *opaque) { @@ -491,6 +498,11 @@ static void create_backup_jobs_bh(void *opaque) {
bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, aio_context_release(aio_context);
JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, &local_err);
- aio_context_release(aio_context);
-
di->job = job; di->job = job;
+ if (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) { if (!job || local_err) {
error_setg(errp, "backup_job_create failed: %s", 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; di->target = NULL;
} }
- if (!canceled && di->job) { - if (!canceled && di->job) {
+ if (di->job) { + if (di->job) {
AioContext *ctx = di->job->job.aio_context; WITH_JOB_LOCK_GUARD() {
aio_context_acquire(ctx); - job_cancel_sync_locked(&di->job->job, true);
- job_cancel_sync(&di->job->job, true); + if (!canceled) {
+ if (!canceled) { + job_cancel_sync_locked(&di->job->job, true);
+ job_cancel_sync(&di->job->job, true); + canceled = true;
+ canceled = true; + }
+ } + job_unref_locked(&di->job->job);
+ job_unref(&di->job->job); + di->job = NULL;
+ di->job = NULL; }
aio_context_release(ctx);
- canceled = true; - canceled = true;
} }
} }

View 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 it's still necessary and possible to cancel, but the approach with
using the first non-completed job seemed more robust. 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> 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 +++++++++++++++++++++++++++++++++------------------- pve-backup.c | 57 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 39 insertions(+), 22 deletions(-) 1 file changed, 38 insertions(+), 19 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 0c34428713..2e22030eec 100644 index 0cf30e1ced..4067018dbe 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/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 * 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) { static void job_cancel_bh(void *opaque) {
CoCtxData *data = (CoCtxData*)opaque; CoCtxData *data = (CoCtxData*)opaque;
- Job *job = (Job*)data->data; - Job *job = (Job*)data->data;
- AioContext *job_ctx = job->aio_context;
- aio_context_acquire(job_ctx);
- job_cancel_sync(job, true); - job_cancel_sync(job, true);
- aio_context_release(job_ctx);
+ +
+ /* + /*
+ * Be careful to pick a valid job to cancel: + * Be careful to pick a valid job to cancel:
@ -70,16 +69,15 @@ index 0c34428713..2e22030eec 100644
+ BlockJob *bj = ((PVEBackupDevInfo *)bdi->data)->job; + BlockJob *bj = ((PVEBackupDevInfo *)bdi->data)->job;
+ if (bj) { + if (bj) {
+ Job *job = &bj->job; + Job *job = &bj->job;
+ if (!job_is_completed(job)) { + WITH_JOB_LOCK_GUARD() {
+ AioContext *job_ctx = job->aio_context; + if (!job_is_completed_locked(job)) {
+ aio_context_acquire(job_ctx); + job_cancel_sync_locked(job, true);
+ 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.
+ * It's enough to cancel one job in the transaction, the + */
+ * rest will follow automatically. + break;
+ */ + }
+ break;
+ } + }
+ } + }
+ } + }
@ -89,7 +87,7 @@ index 0c34428713..2e22030eec 100644
aio_co_enter(data->ctx, data->co); 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"); proxmox_backup_abort(backup_state.pbs, "backup canceled");
} }

View File

@ -21,7 +21,7 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/alloc-track.c b/block/alloc-track.c 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 --- a/block/alloc-track.c
+++ b/block/alloc-track.c +++ b/block/alloc-track.c
@@ -174,7 +174,8 @@ static int coroutine_fn track_co_preadv(BlockDriverState *bs, @@ -174,7 +174,8 @@ static int coroutine_fn track_co_preadv(BlockDriverState *bs,

View File

@ -31,7 +31,7 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
3 files changed, 23 insertions(+), 8 deletions(-) 3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c 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 --- a/block/monitor/block-hmp-cmds.c
+++ b/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) @@ -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); hmp_handle_error(mon, error);
} }
diff --git a/pve-backup.c b/pve-backup.c diff --git a/pve-backup.c b/pve-backup.c
index 2e22030eec..e9aa7e0f49 100644 index 4067018dbe..3ca4f74cb8 100644
--- a/pve-backup.c --- a/pve-backup.c
+++ b/pve-backup.c +++ b/pve-backup.c
@@ -55,6 +55,7 @@ static struct PVEBackupState { @@ -55,6 +55,7 @@ static struct PVEBackupState {
@ -57,7 +57,7 @@ index 2e22030eec..e9aa7e0f49 100644
VmaWriter *vmaw; VmaWriter *vmaw;
ProxmoxBackupHandle *pbs; ProxmoxBackupHandle *pbs;
GList *di_list; 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(); backup_state.txn = job_txn_new_seq();
@ -66,7 +66,7 @@ index 2e22030eec..e9aa7e0f49 100644
/* create and start all jobs (paused state) */ /* create and start all jobs (paused state) */
GList *l = backup_state.di_list; GList *l = backup_state.di_list;
while (l) { 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( BlockJob *job = backup_job_create(
NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap, 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, + BLOCKDEV_ON_ERROR_REPORT, JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn,
+ &local_err); + &local_err);
di->job = job; aio_context_release(aio_context);
if (job) {
@@ -584,7 +584,9 @@ UuidInfo coroutine_fn *qmp_backup( @@ -583,7 +583,9 @@ UuidInfo coroutine_fn *qmp_backup(
bool has_config_file, const char *config_file, bool has_config_file, const char *config_file,
bool has_firewall_file, const char *firewall_file, bool has_firewall_file, const char *firewall_file,
bool has_devlist, const char *devlist, bool has_devlist, const char *devlist,
@ -89,7 +89,7 @@ index 2e22030eec..e9aa7e0f49 100644
{ {
assert(qemu_in_coroutine()); 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; backup_state.speed = (has_speed && speed > 0) ? speed : 0;
@ -101,7 +101,7 @@ index 2e22030eec..e9aa7e0f49 100644
backup_state.vmaw = vmaw; backup_state.vmaw = vmaw;
backup_state.pbs = pbs; 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->pbs_dirty_bitmap_migration = true;
ret->query_bitmap_info = true; ret->query_bitmap_info = true;
ret->pbs_masterkey = true; ret->pbs_masterkey = true;
@ -109,7 +109,7 @@ index 2e22030eec..e9aa7e0f49 100644
return ret; return ret;
} }
diff --git a/qapi/block-core.json b/qapi/block-core.json 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 --- a/qapi/block-core.json
+++ b/qapi/block-core.json +++ b/qapi/block-core.json
@@ -829,6 +829,8 @@ @@ -829,6 +829,8 @@

View File

@ -1,9 +1,5 @@
extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch 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/0002-init-daemonize-defuse-PID-file-resolve-error.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
bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.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/0002-drive-mirror-add-support-for-conditional-and-always-.patch
bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch

2
qemu

@ -1 +1 @@
Subproject commit 621da7789083b80d6f1ff1c0fb499334007b4f51 Subproject commit b67b00e6b4c7831a3f5bc684bc0df7a9bfd1bd56