qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hanna Reitz <hreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org
Cc: kwolf@redhat.com, jsnow@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] block: bdrv_inactivate_recurse(): check for permissions and fix crash
Date: Fri, 10 Sep 2021 16:15:50 +0200	[thread overview]
Message-ID: <2aafb525-8656-5cad-face-70af76813630@redhat.com> (raw)
In-Reply-To: <20210910110100.31976-3-vsementsov@virtuozzo.com>

On 10.09.21 13:01, Vladimir Sementsov-Ogievskiy wrote:
> We must not inactivate child when parent has write permissions on
> it.
>
> Calling .bdrv_inactivate() doesn't help: actually only qcow2 has this
> handler and it is used to flush caches, not for permission
> manipulations.

I guess we could ask whether block jobs should implement 
.bdrv_inactivate() to cancel themselves, but I believe it’s indeed 
better to have the migration fail and thus force the user to manually 
cancel the job (should that be what they want).

> So, let's simply check cumulative parent permissions before
> inactivating the node.
>
> This commit fixes a crash when we do migration during backup: prior to
> the commit nothing prevents all nodes inactivation at migration finish
> and following backup write to the target crashes on assertion
> "assert(!(bs->open_flags & BDRV_O_INACTIVE));" in
> bdrv_co_write_req_prepare().
>
> After the commit, we rely on the fact that copy-before-write filter
> keeps write permission on target node to be able to write to it. So
> inactivation fails and migration fails as expected.
>
> Corresponding test now passes, so, enable it.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   block.c                                        | 8 ++++++++
>   tests/qemu-iotests/tests/migrate-during-backup | 2 +-
>   2 files changed, 9 insertions(+), 1 deletion(-)

Reviewed-by: Hanna Reitz <hreitz@redhat.com>



      reply	other threads:[~2021-09-10 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 11:00 [PATCH 0/2] fix crash if try to migrate during backup Vladimir Sementsov-Ogievskiy
2021-09-10 11:00 ` [PATCH 1/2] tests: add migrate-during-backup Vladimir Sementsov-Ogievskiy
2021-09-10 14:18   ` Hanna Reitz
2021-09-10 16:10     ` Vladimir Sementsov-Ogievskiy
2021-09-10 11:01 ` [PATCH 2/2] block: bdrv_inactivate_recurse(): check for permissions and fix crash Vladimir Sementsov-Ogievskiy
2021-09-10 14:15   ` Hanna Reitz [this message]

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=2aafb525-8656-5cad-face-70af76813630@redhat.com \
    --to=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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).