From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>
Cc: kwolf@redhat.com, Benoit Canet <benoit@irqsave.net>,
qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v8 3/4] block: Add replaces argument to drive-mirror
Date: Wed, 11 Jun 2014 14:58:57 +0200 [thread overview]
Message-ID: <20140611125857.GA4765@stefanha-thinkpad.str.redhat.com> (raw)
In-Reply-To: <1402384906-335-4-git-send-email-benoit.canet@irqsave.net>
[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]
On Tue, Jun 10, 2014 at 09:21:45AM +0200, Benoît Canet wrote:
> +BlockDriverState *check_to_replace_node(const char *node_name, Error **errp)
> +{
> + BlockDriverState *to_replace_bs = bdrv_find_node(node_name);
> + if (!to_replace_bs) {
> + error_setg(errp, "node_name=%s not found",
> + node_name);
Please use "Node name '%s' not found". It's more consistent with error
message style.
> + return NULL;
> + }
> +
> + /* the code should only be able to replace the top first non filter
> + * node of the graph. For example the first BDS under a quorum.
> + */
> + if (!bdrv_is_first_non_filter(to_replace_bs)) {
> + error_set(errp, QERR_FEATURE_DISABLED,
> + "drive-mirror and replace node-name");
> + return NULL;
> + }
This seems like an arbitrary restriction. Can we drop this?
> @@ -540,6 +555,23 @@ static void mirror_complete(BlockJob *job, Error **errp)
> return;
> }
>
> + /* check the target bs is not block and block all operations on it */
> + if (s->replaces) {
> + s->to_replace = check_to_replace_node(s->replaces, errp);
> +
> + if (!s->to_replace) {
> + return;
> + }
> +
> + error_setg(&s->replace_blocker,
> + "block device is in use by block-job-complete");
> + bdrv_op_block_all(s->to_replace, s->replace_blocker);
> + bdrv_ref(s->to_replace);
> +
> + g_free(s->replaces);
> + s->replaces = NULL;
Leaks s->replaces if block-job-abort is called.
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-06-11 12:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 7:21 [Qemu-devel] [PATCH v8 0/4] Quorum maintainance operations Benoît Canet
2014-06-10 7:21 ` [Qemu-devel] [PATCH v8 1/4] quorum: Add the rewrite-corrupted parameter to quorum Benoît Canet
2014-06-10 7:25 ` Benoît Canet
2014-06-10 7:21 ` [Qemu-devel] [PATCH v8 2/4] block: Add node-name argument to drive-mirror Benoît Canet
2014-06-10 7:21 ` [Qemu-devel] [PATCH v8 3/4] block: Add replaces " Benoît Canet
2014-06-11 12:58 ` Stefan Hajnoczi [this message]
2014-06-10 7:21 ` [Qemu-devel] [PATCH v8 4/4] qemu-iotests: Add TestRepairQuorum to 041 to test drive-mirror node-name mode Benoît Canet
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=20140611125857.GA4765@stefanha-thinkpad.str.redhat.com \
--to=stefanha@redhat.com \
--cc=benoit.canet@irqsave.net \
--cc=benoit@irqsave.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).