From: Peng Liang via <qemu-devel@nongnu.org>
To: "qemu-block@nongnu.org" <qemu-block@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>
Cc: xiexiangyou 00584000 <xiexiangyou@huawei.com>,
zhengchuan <zhengchuan@huawei.com>, <wanghao232@huawei.com>,
"Fangyi (Eric)" <eric.fangyi@huawei.com>,
yebiaoxiang 00470486 <yebiaoxiang@huawei.com>
Subject: Questions about losing the write lock of raw-format disks after migration
Date: Wed, 24 Nov 2021 20:56:00 +0800 [thread overview]
Message-ID: <faa74343-998c-f054-fb9c-1ea42b7f82a4@huawei.com> (raw)
Hi folks,
When we test migration with raw-format disk, we found that the QEMU
process in the dst will lose the write lock after migration. However,
the QEMU process in the dst will still hold the write lock for
qcow2-format disk.
After reading some block layer's code, I found that the first
blk_set_perm in blk_root_activate will set blk->shared_perm to
BLK_PERM_ALL (disable all shared permissions?). Then in
blk_vm_state_changed, blk_set_perm will set shared_perm to
blk->shared_perm, which is BLK_PERM_ALL. And it makes
raw_handle_perm_lock not to get the write lock.
So I try the following patch and it will fix the problem:
diff --git a/block/block-backend.c b/block/block-backend.c
index 12ef80ea17..96518fd1f0 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -197,13 +197,6 @@ static void blk_root_activate(BdrvChild *child,
Error **errp)
blk->disable_perm = false;
- blk_set_perm(blk, blk->perm, BLK_PERM_ALL, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- blk->disable_perm = true;
- return;
- }
-
if (runstate_check(RUN_STATE_INMIGRATE)) {
/* Activation can happen when migration process is still
active, for
* example when nbd_server_add is called during non-shared storage
I'm new to the block layer and I'm not sure that it's a right fix to the
problem. Any idea about the problem and the patch?
Thanks,
Peng
next reply other threads:[~2021-11-24 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 12:56 Peng Liang via [this message]
2021-11-25 12:52 ` Questions about losing the write lock of raw-format disks after migration Hanna 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=faa74343-998c-f054-fb9c-1ea42b7f82a4@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=eric.fangyi@huawei.com \
--cc=liangpeng10@huawei.com \
--cc=qemu-block@nongnu.org \
--cc=wanghao232@huawei.com \
--cc=xiexiangyou@huawei.com \
--cc=yebiaoxiang@huawei.com \
--cc=zhengchuan@huawei.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).