All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 1/3] qmp: Add command 'blockdev-backup'
Date: Fri, 05 Dec 2014 10:10:17 +0100	[thread overview]
Message-ID: <54817679.505@redhat.com> (raw)
In-Reply-To: <20141205061249.GA15691@ad.nay.redhat.com>

On 2014-12-05 at 07:12, Fam Zheng wrote:
> On Thu, 12/04 14:43, Max Reitz wrote:
>>> +    if (!bs) {
>>> +        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
>>> +        return;
>>> +    }
>>> +
>>> +    target_bs = bdrv_find(target);
>>> +    if (!target_bs) {
>>> +        error_set(errp, QERR_DEVICE_NOT_FOUND, target);
>>> +        return;
>>> +    }
>>> +
>>> +    bdrv_ref(target_bs);
>>> +    bdrv_set_aio_context(target_bs, bdrv_get_aio_context(bs));
>> In the cover letter you said you were acquiring the AIO context but you're
>> not. Something like the aio_context_acquire() call in qmp_drive_backup()
>> seems missing.
> Yes. Adding.
>
>>> +    backup_start(bs, target_bs, speed, sync, on_source_error, on_target_error,
>>> +                 block_job_cb, bs, &local_err);
>>> +    if (local_err != NULL) {
>>> +        bdrv_unref(target_bs);
>> Hm, as far as I can see, backup_complete() is always run, regardless of the
>> operation status. backup_complete() in turn calls bdrv_unref(s->target), so
>> this seems unnecessary to me.
> In error case, backup_start does nothing. So we need to release for the
> bdrv_ref two lines above.

Ah, right, I forgot about early errors. local_err is not even set if the 
block job itself fails, because by the time the block job is started, 
backup_start() will have already returned. My fault.

Max

>>> +SQMP
>>> +blockdev-backup
>>> +------------
>>> +
>>> +The device version of drive-backup: this command takes an existing named device
>>> +as backup target.
>>> +
>>> +Arguments:
>>> +
>>> +- "device": the name of the device which should be copied.
>>> +            (json-string)
>>> +- "target": the target of the new image. If the file exists, or if it is a
>>> +            device, the existing file/device will be used as the new
>>> +            destination.  If it does not exist, a new file will be created.
>>> +            (json-string)
>>> +- "sync": what parts of the disk image should be copied to the destination;
>>> +          possibilities include "full" for all the disk, "top" for only the
>>> +          sectors allocated in the topmost image, or "none" to only replicate
>>> +          new I/O (MirrorSyncMode).
>>> +- "speed": the maximum speed, in bytes per second (json-int, optional)
>>> +- "on-source-error": the action to take on an error on the source, default
>>> +                     'report'.  'stop' and 'enospc' can only be used
>>> +                     if the block device supports io-status.
>>> +                     (BlockdevOnError, optional)
>>> +- "on-target-error": the action to take on an error on the target, default
>>> +                     'report' (no limitations, since this applies to
>>> +                     a different block device than device).
>>> +                     (BlockdevOnError, optional)
>>> +
>>> +Example:
>>> +-> { "execute": "blockdev-backup", "arguments": { "device": "src-id",
>>> +                                                  "target": "tgt-id" } }
>> Isn't "sync" missing?
> Yes.
>
> Thanks,
> Fam

  reply	other threads:[~2014-12-05  9:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04  2:29 [Qemu-devel] [PATCH v4 0/3] qmp: Add "blockdev-backup" Fam Zheng
2014-12-04  2:29 ` [Qemu-devel] [PATCH v4 1/3] qmp: Add command 'blockdev-backup' Fam Zheng
2014-12-04 13:43   ` Max Reitz
2014-12-05  6:12     ` Fam Zheng
2014-12-05  9:10       ` Max Reitz [this message]
2014-12-19  8:47     ` Markus Armbruster
2014-12-04  2:29 ` [Qemu-devel] [PATCH v4 2/3] block: Add blockdev-backup to transaction Fam Zheng
2014-12-04 13:59   ` Max Reitz
2014-12-05  6:37     ` Fam Zheng
2014-12-05  9:24       ` Max Reitz
2014-12-05 14:47         ` Max Reitz
2014-12-04  2:29 ` [Qemu-devel] [PATCH v4 3/3] qemu-iotests: Test blockdev-backup in 055 Fam Zheng
2014-12-04 14:21   ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54817679.505@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.