qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Max Reitz <mreitz@redhat.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, armbru@redhat.com, eblake@redhat.com,
	jsnow@redhat.com, famz@redhat.com, den@openvz.org,
	stefanha@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v20 13/30] block: new bdrv_reopen_bitmaps_rw interface
Date: Wed, 14 Jun 2017 12:03:05 +0300	[thread overview]
Message-ID: <566c473c-3669-ebde-e50a-0f85afac5f51@virtuozzo.com> (raw)
In-Reply-To: <e4af8c75-b217-3017-708a-8760a2689c00@redhat.com>

13.06.2017 18:28, Max Reitz wrote:
> On 2017-06-13 12:25, Vladimir Sementsov-Ogievskiy wrote:
>> 09.06.2017 16:27, Max Reitz wrote:
>>> On 2017-06-02 13:21, Vladimir Sementsov-Ogievskiy wrote:
>>>> Add format driver handler, which should mark loaded read-only
>>>> bitmaps as 'IN_USE' in the image and unset read_only field in
>>>> corresponding BdrvDirtyBitmap's.
>>>>
>>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>>> ---
>>>>    block.c                   | 17 +++++++++++++++++
>>>>    include/block/block_int.h |  7 +++++++
>>>>    2 files changed, 24 insertions(+)
>>>>
>>>> diff --git a/block.c b/block.c
>>>> index 04af7697dc..161db9e32a 100644
>>>> --- a/block.c
>>>> +++ b/block.c
>>>> @@ -2946,12 +2946,16 @@ void bdrv_reopen_commit(BDRVReopenState
>>>> *reopen_state)
>>>>    {
>>>>        BlockDriver *drv;
>>>>        BlockDriverState *bs;
>>>> +    bool old_can_write, new_can_write;
>>>>          assert(reopen_state != NULL);
>>>>        bs = reopen_state->bs;
>>>>        drv = bs->drv;
>>>>        assert(drv != NULL);
>>>>    +    old_can_write =
>>>> +        !bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) &
>>>> BDRV_O_INACTIVE);
>>>> +
>>>>        /* If there are any driver level actions to take */
>>>>        if (drv->bdrv_reopen_commit) {
>>>>            drv->bdrv_reopen_commit(reopen_state);
>>>> @@ -2965,6 +2969,19 @@ void bdrv_reopen_commit(BDRVReopenState
>>>> *reopen_state)
>>>>        bs->read_only = !(reopen_state->flags & BDRV_O_RDWR);
>>>>          bdrv_refresh_limits(bs, NULL);
>>>> +
>>>> +    new_can_write =
>>>> +        !bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) &
>>>> BDRV_O_INACTIVE);
>>>> +    if (!old_can_write && new_can_write &&
>>>> drv->bdrv_reopen_bitmaps_rw) {
>>>> +        Error *local_err = NULL;
>>>> +        if (drv->bdrv_reopen_bitmaps_rw(bs, &local_err) < 0) {
>>>> +            /* This is not fatal, bitmaps just left read-only, so
>>>> all following
>>>> +             * writes will fail. User can remove read-only bitmaps
>>>> to unblock
>>>> +             * writes.
>>>> +             */
>>> In a sense, it pretty much is fatal. We were asked to make the image
>>> non-read-only but we failed because it effectively still is read-only.
>>>
>>> But I can't think of anything better, and you're right, removing the
>>> bitmaps would resolve the situation. This would require the user to know
>>> that updating the bitmaps was the issue, and local_err may not actually
>>> reflect that.
>>>
>>>> +            error_report_err(local_err);
>>> So I'd prepend this with something like "$node_name: Failed to make
>>> dirty bitmaps writable", and maybe append a hint like "Removing all
>>> persistent dirty bitmaps from this node will allow writing to it".
>> Ok for prepending, but I don't want to add last note, as for the user it
>> may better to retry an operation, leading reopening image rw..
> Which operation do you mean? The reopening? Because that operation
> already "succeeded" at this point, so you can't retry it...

So, firstly, reopen r-o again and then reopen r-w? Is it possible?

>
> Max
>

-- 
Best regards,
Vladimir

  reply	other threads:[~2017-06-14  9:03 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 11:21 [Qemu-devel] [PATCH v20 00/30] qcow2: persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 01/30] specs/qcow2: fix bitmap granularity qemu-specific note Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 02/30] specs/qcow2: do not use wording 'bitmap header' Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 03/30] hbitmap: improve dirty iter Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 04/30] tests: add hbitmap iter test Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 05/30] block: fix bdrv_dirty_bitmap_granularity signature Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 06/30] block/dirty-bitmap: add deserialize_ones func Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 07/30] qcow2-refcount: rename inc_refcounts() and make it public Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 08/30] qcow2: add bitmaps extension Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 09/30] block/dirty-bitmap: fix comment for BlockDirtyBitmap.disabled field Vladimir Sementsov-Ogievskiy
2017-06-02 21:02   ` John Snow
2017-06-09 12:29     ` Max Reitz
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 10/30] block/dirty-bitmap: add readonly field to BdrvDirtyBitmap Vladimir Sementsov-Ogievskiy
2017-06-02 21:02   ` John Snow
2017-06-03 17:19     ` Sementsov-Ogievskiy Vladimir
2017-06-09 12:56   ` Max Reitz
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 11/30] qcow2: autoloading dirty bitmaps Vladimir Sementsov-Ogievskiy
2017-06-02 21:48   ` John Snow
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 12/30] block: refactor bdrv_reopen_commit Vladimir Sementsov-Ogievskiy
2017-06-02 21:57   ` John Snow
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 13/30] block: new bdrv_reopen_bitmaps_rw interface Vladimir Sementsov-Ogievskiy
2017-06-02 22:17   ` John Snow
2017-06-03 16:53     ` Sementsov-Ogievskiy Vladimir
2017-06-09 13:27   ` Max Reitz
2017-06-13 10:25     ` Vladimir Sementsov-Ogievskiy
2017-06-13 15:28       ` Max Reitz
2017-06-14  9:03         ` Vladimir Sementsov-Ogievskiy [this message]
2017-06-14 12:04           ` Max Reitz
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 14/30] qcow2: support .bdrv_reopen_bitmaps_rw Vladimir Sementsov-Ogievskiy
2017-06-02 23:09   ` John Snow
2017-06-09 13:38   ` Max Reitz
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 15/30] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 16/30] block: bdrv_close: release bitmaps after drv->bdrv_close Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 17/30] block: introduce persistent dirty bitmaps Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 18/30] block/dirty-bitmap: add bdrv_dirty_bitmap_next() Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 19/30] qcow2: add persistent dirty bitmaps support Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 20/30] qcow2: store bitmaps on reopening image as read-only Vladimir Sementsov-Ogievskiy
2017-06-09 13:48   ` Max Reitz
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 21/30] block: add bdrv_can_store_new_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 22/30] qcow2: add .bdrv_can_store_new_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 23/30] qmp: add persistent flag to block-dirty-bitmap-add Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 24/30] qmp: add autoload parameter " Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 25/30] qmp: add x-debug-block-dirty-bitmap-sha256 Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 26/30] iotests: test qcow2 persistent dirty bitmap Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 27/30] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 28/30] qcow2: add .bdrv_remove_persistent_dirty_bitmap Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 29/30] qmp: block-dirty-bitmap-remove: remove persistent Vladimir Sementsov-Ogievskiy
2017-06-02 11:21 ` [Qemu-devel] [PATCH v20 30/30] block: release persistent bitmaps on inactivate Vladimir Sementsov-Ogievskiy
2017-06-09 14:01   ` 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=566c473c-3669-ebde-e50a-0f85afac5f51@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 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).