qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Questions about losing the write lock of raw-format disks after migration
@ 2021-11-24 12:56 Peng Liang via
  2021-11-25 12:52 ` Hanna Reitz
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Liang via @ 2021-11-24 12:56 UTC (permalink / raw)
  To: qemu-block@nongnu.org, QEMU Developers
  Cc: xiexiangyou 00584000, zhengchuan, wanghao232, Fangyi (Eric),
	yebiaoxiang 00470486

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-25 12:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-24 12:56 Questions about losing the write lock of raw-format disks after migration Peng Liang via
2021-11-25 12:52 ` Hanna Reitz

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).