]> git.ipfire.org Git - thirdparty/qemu.git/commit
blockcommit: Reopen base image as RO after abort
authorAlexander Ivanov <alexander.ivanov@virtuozzo.com>
Thu, 4 Apr 2024 09:11:36 +0000 (11:11 +0200)
committerVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Tue, 28 May 2024 12:52:15 +0000 (15:52 +0300)
commit7d99ae59a20c4448732a3fb204e31915816048d6
treeb5c6aaed032df10b56aefe9bded0bb52420fa261
parentad10b4badc1dd5b28305f9b9f1168cf0aa3ae946
blockcommit: Reopen base image as RO after abort

If a blockcommit is aborted the base image remains in RW mode, that leads
to a fail of subsequent live migration.

How to reproduce:
  $ virsh snapshot-create-as vm snp1 --disk-only

  *** write something to the disk inside the guest ***

  $ virsh blockcommit vm vda --active --shallow && virsh blockjob vm vda --abort
  $ lsof /vzt/vm.qcow2
  COMMAND      PID USER   FD   TYPE DEVICE   SIZE/OFF NODE NAME
  qemu-syst 433203 root   45u   REG  253,0 1724776448  133 /vzt/vm.qcow2
  $ cat /proc/433203/fdinfo/45
  pos:    0
  flags:  02140002 <==== The last 2 means RW mode

If the base image is in RW mode at the end of blockcommit and was in RO
mode before blockcommit, reopen the base BDS in RO.

Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-Id: <20240404091136.129811-1-alexander.ivanov@virtuozzo.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
block/mirror.c