From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: kwolf@redhat.com, hbrock@redhat.com, qemu-devel@nongnu.org,
rjones@redhat.com, imain@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 4/7] block: Add checks of blocker in block operations
Date: Tue, 26 Nov 2013 17:13:32 +0100 [thread overview]
Message-ID: <5294C8AC.4000506@redhat.com> (raw)
In-Reply-To: <1385438728-17924-5-git-send-email-famz@redhat.com>
Il 26/11/2013 05:05, Fam Zheng ha scritto:
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1001,6 +1001,11 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device,
> return NULL;
> }
>
> + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,
> + errp)) {
> + return NULL;
> + }
Why not check in bdrv_snapshot_delete...
> ret = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err);
> if (error_is_set(&local_err)) {
> error_propagate(errp, local_err);
> @@ -1098,6 +1103,10 @@ static void internal_snapshot_prepare(BlkTransactionState *common,
> return;
> }
>
> + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, errp)) {
> + return;
> + }
... and bdrv_snapshot_create?
> if (!bdrv_is_inserted(bs)) {
> error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
> return;
> @@ -1536,6 +1545,10 @@ void qmp_change_blockdev(const char *device, const char *filename,
> return;
> }
>
> + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_CHANGE, errp)) {
> + return;
> + }
> +
> if (format) {
> drv = bdrv_find_whitelisted_format(format, bs->read_only);
> if (!drv) {
> @@ -1684,6 +1697,10 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp)
> return;
> }
>
> + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, errp)) {
> + return;
> + }
> +
> if (size < 0) {
> error_set(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
> return;
> --
This should be redundant since bdrv_truncate already checks.
Paolo
next prev parent reply other threads:[~2013-11-26 16:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 4:05 [Qemu-devel] [PATCH v5 0/7] Drop in_use from BlockDriverState and enable point-in-time snapshot exporting over NBD Fam Zheng
2013-11-26 4:05 ` [Qemu-devel] [PATCH v5 1/7] qapi: Add BlockOperationType enum Fam Zheng
2013-11-26 16:21 ` Paolo Bonzini
2013-11-26 4:05 ` [Qemu-devel] [PATCH v5 2/7] block: Introduce op_blockers to BlockDriverState Fam Zheng
2013-11-26 4:05 ` [Qemu-devel] [PATCH v5 3/7] block: Replace in_use with operation blocker Fam Zheng
2013-11-26 4:05 ` [Qemu-devel] [PATCH v5 4/7] block: Add checks of blocker in block operations Fam Zheng
2013-11-26 16:13 ` Paolo Bonzini [this message]
2013-11-28 3:39 ` Fam Zheng
2013-11-26 4:05 ` [Qemu-devel] [PATCH v5 5/7] block: Parse "backing" option to reference existing BDS Fam Zheng
2013-11-26 16:18 ` Paolo Bonzini
2013-11-27 0:56 ` Fam Zheng
2013-11-26 4:05 ` [Qemu-devel] [PATCH v5 6/7] qmp: add command 'blockdev-backup' Fam Zheng
2013-11-26 4:05 ` [Qemu-devel] [PATCH v5 7/7] block: Allow backup on referenced named BlockDriverState Fam Zheng
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=5294C8AC.4000506@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=hbrock@redhat.com \
--cc=imain@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--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.