Bug 2004812

Summary: [WRB][QEMU-6.1.50]Hit error "Driver 'copy-before-write' is not whitelisted" when execute "blockdev-backup"
Product: Red Hat Enterprise Linux 8 Reporter: Yanan Fu <yfu>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
qemu-kvm sub component: Block Jobs QA Contact: aihua liang <aliang>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: coli, jinzhao, jmaloy, juzhang, kkiwi, mrezanin, ngu, virt-maint, xfu, yfu, zhencliu
Version: 8.6Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-6.2.0-1.module+el8.6.0+13725+61ae1949 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 13:21:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2027716    
Bug Blocks:    

Description Yanan Fu 2021-09-16 05:55:34 UTC
Description of problem:


Version-Release number of selected component (if applicable):
qemu-kvm-6.1.50-1.scrmod+el8.5.0+12607+25db754d.wrb210915.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Boot vm with:
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie-root-port-3,addr=0x0 \
    -blockdev node-name=file_image1,driver=file,auto-read-only=on,discard=unmap,aio=threads,filename=/home/kvm_autotest_root/images/rhel850-64-virtio-scsi.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_image1,driver=qcow2,read-only=off,cache.direct=on,cache.no-flush=off,file=file_image1 \
    -device scsi-hd,id=image1,drive=drive_image1,write-cache=on \
    -blockdev node-name=file_data,driver=file,auto-read-only=on,discard=unmap,aio=threads,filename=/root/avocado/data/avocado-vt/data.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_data,driver=qcow2,read-only=off,cache.direct=on,cache.no-flush=off,file=file_data \
    -device scsi-hd,id=data,drive=drive_data,write-cache=on \


2. Create an image by blockdev-create
{"execute": "blockdev-create", "arguments": {"options": {"driver": "file", "filename": "/root/avocado/data/avocado-vt/full.qcow2", "size": 2147483648}, "job-id": "file_full"}, "id": "zORjYhoM"}{"timestamp": {"seconds": 1631724614, "microseconds": 198662}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "file_full"}}
{"timestamp": {"seconds": 1631724614, "microseconds": 198716}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "file_full"}}
{"return": {}, "id": "zORjYhoM"}
{"timestamp": {"seconds": 1631724614, "microseconds": 199129}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "file_full"}}
{"timestamp": {"seconds": 1631724614, "microseconds": 199167}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "file_full"}}
{"timestamp": {"seconds": 1631724614, "microseconds": 199191}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "file_full"}}
{"execute": "job-dismiss", "arguments": {"id": "file_full"}, "id": "p4SfD7L8"}
{"timestamp": {"seconds": 1631724614, "microseconds": 202014}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "file_full"}}
{"return": {}, "id": "p4SfD7L8"}
{"execute": "blockdev-add", "arguments": {"node-name": "file_full", "driver": "file", "filename": "/root/avocado/data/avocado-vt/full.qcow2", "aio": "threads", "auto-read-only": true, "discard": "unmap"}, "id": "IcuAqoBd"}
{"return": {}, "id": "IcuAqoBd"} 
{"execute": "blockdev-create", "arguments": {"options": {"driver": "qcow2", "file": "file_full", "size": 2147483648, "backing-fmt": "qcow2", "backing-file": "/root/avocado/data/avocado-vt/data.qcow2"}, "job-id": "drive_full"}, "id": "2u40o6Hv"} 
{"timestamp": {"seconds": 1631724614, "microseconds": 307245}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "drive_full"}}
{"timestamp": {"seconds": 1631724614, "microseconds": 307286}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "drive_full"}} 
{"return": {}, "id": "2u40o6Hv"}
{"timestamp": {"seconds": 1631724614, "microseconds": 310454}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "drive_full"}}
{"timestamp": {"seconds": 1631724614, "microseconds": 310484}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "drive_full"}} 
{"timestamp": {"seconds": 1631724614, "microseconds": 310504}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "drive_full"}}
{"execute": "job-dismiss", "arguments": {"id": "drive_full"}, "id": "ib02aVeD"} 
{"timestamp": {"seconds": 1631724615, "microseconds": 313279}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "drive_full"}}
{"return": {}, "id": "ib02aVeD"}
{"execute": "blockdev-add", "arguments": {"node-name": "drive_full", "driver": "qcow2", "backing": "drive_data", "file": "file_full", "read-only": false}, "id": "2mJGkhpb"}
{"return": {}, "id": "2mJGkhpb"} 

3. Add a dirty bitmap:
{"execute":"block-dirty-bitmap-add", "arguments": {"node": "drive_data", "name": "full_bitmap_data"}}
{"return": {}}

4. do blockdev backup, hit the error:
{"execute":"blockdev-backup", "arguments": {"device": "drive_data", "target": "drive_full", "job-id": "drive_data_r58s", "sync": "none", "speed": 0, "compress": false, "auto-finalize": true, "auto-dismiss": true, "on-source-error": "report", "on-target-error": "report"}}
{"error": {"class": "GenericError", "desc": "Could not create node: Driver 'copy-before-write' is not whitelisted"}}


Actual results:
Hit error: Could not create node: Driver 'copy-before-write' is not whitelisted

Expected results:
blockdev backup executed successfully

Additional info:
Qemu command line:
  /usr/libexec/qemu-kvm \
    -S  \
    -name 'avocado-vt-vm1'  \
    -sandbox off  \
    -machine q35,memory-backend=mem-machine_mem \
    -device pcie-root-port,id=pcie-root-port-0,multifunction=on,bus=pcie.0,addr=0x1,chassis=1 \
    -device pcie-pci-bridge,id=pcie-pci-bridge-0,addr=0x0,bus=pcie-root-port-0  \
    -nodefaults \
    -device VGA,bus=pcie.0,addr=0x2 \
    -device i6300esb,bus=pcie-pci-bridge-0,addr=0x1 \
    -watchdog-action reset \
    -m 15360 \
    -object memory-backend-ram,size=15360M,id=mem-machine_mem  \
    -smp 16,maxcpus=16,cores=8,threads=1,dies=1,sockets=2  \
    -cpu 'Haswell-noTSX',+kvm_pv_unhalt \
    -chardev socket,wait=off,id=qmp_id_qmpmonitor1,server=on,path=/tmp/avocado_aq95o3_r/monitor-qmpmonitor1-20210915-124757-qtDC6N5J  \
    -mon chardev=qmp_id_qmpmonitor1,mode=control \
    -device ich9-usb-ehci1,id=usb1,addr=0x1d.0x7,multifunction=on,bus=pcie.0 \
    -device ich9-usb-uhci1,id=usb1.0,multifunction=on,masterbus=usb1.0,addr=0x1d.0x0,firstport=0,bus=pcie.0 \
    -device ich9-usb-uhci2,id=usb1.1,multifunction=on,masterbus=usb1.0,addr=0x1d.0x2,firstport=2,bus=pcie.0 \
    -device ich9-usb-uhci3,id=usb1.2,multifunction=on,masterbus=usb1.0,addr=0x1d.0x4,firstport=4,bus=pcie.0 \
    -device pcie-root-port,id=pcie-root-port-2,port=0x2,addr=0x1.0x2,bus=pcie.0,chassis=3 \
    -device qemu-xhci,id=usb2,bus=pcie-root-port-2,addr=0x0 \
    -device usb-tablet,id=usb-tablet1,bus=usb2.0,port=1 \
    -device pcie-root-port,id=pcie-root-port-3,port=0x3,addr=0x1.0x3,bus=pcie.0,chassis=4 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie-root-port-3,addr=0x0 \
    -blockdev node-name=file_image1,driver=file,auto-read-only=on,discard=unmap,aio=threads,filename=/home/kvm_autotest_root/images/rhel850-64-virtio-scsi.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_image1,driver=qcow2,read-only=off,cache.direct=on,cache.no-flush=off,file=file_image1 \
    -device scsi-hd,id=image1,drive=drive_image1,write-cache=on \
    -blockdev node-name=file_data,driver=file,auto-read-only=on,discard=unmap,aio=threads,filename=/root/avocado/data/avocado-vt/data.qcow2,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_data,driver=qcow2,read-only=off,cache.direct=on,cache.no-flush=off,file=file_data \
    -device scsi-hd,id=data,drive=drive_data,write-cache=on \
    -device pcie-root-port,id=pcie-root-port-4,port=0x4,addr=0x1.0x4,bus=pcie.0,chassis=5 \
    -device virtio-net-pci,mac=9a:b2:30:66:90:08,id=idA0wmPu,netdev=idWx8fR6,bus=pcie-root-port-4,addr=0x0  \
    -netdev tap,id=idWx8fR6,vhost=on \
    -vnc :0  \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot menu=off,order=cdn,once=c,strict=off  \
    -no-hpet \
    -enable-kvm \
    -monitor stdio \

Comment 1 Yanan Fu 2021-09-16 05:59:02 UTC
Automation case name:

Comment 2 Yanan Fu 2021-09-16 06:09:32 UTC
Automation case name: blockdev_inc_backup_pull_mode, blockdev_inc_backup and differential_backup all can reproduce this issue.


Checked with qemu source code, several related commits was introduced in this weeklyrebase version:
783b2825f6 qapi: publish copy-before-write filter
751cec7a26 block/copy-before-write: make public block driver
06e0a9c164 block/copy-before-write: initialize block-copy bitmap
f44fd7399c block/copy-before-write: cbw_init(): use options
4c1e992bf2 block/copy-before-write: bdrv_cbw_append(): drop unused compress arg
5a50742674 block/copy-before-write: cbw_init(): use file child after attaching
fe7ea40c0e block/copy-before-write: cbw_init(): rename variables
1f0cacb967 block/copy-before-write: introduce cbw_init()
7ddbce2dec block/copy-before-write: bdrv_cbw_append(): replace child at last
3c1e63277e block/copy-before-write: use file child instead of backing
451532311a block/copy-before-write: drop extra bdrv_unref on failure path
3860c02019 block/copy-before-write: relax permission requirements when no parents

This is a new change for QEMU 6.2:
https://gitlab.com/qemu-project/qemu/-/blob/master/qapi/block-core.json#L2828

Comment 3 Yanan Fu 2021-09-16 06:17:20 UTC
qemu-kvm-6.1.50-1.scrmod+el8.5.0+12527+ae7adb1b.wrb210908  is the first version that can reproduce this issue, thanks!

Comment 4 Klaus Heinrich Kiwi 2021-09-16 17:47:05 UTC
Kevin, care to take a look? Perhaps a symptom of the recent driver whitelist changes to tools?

Comment 5 Klaus Heinrich Kiwi 2021-09-16 17:47:54 UTC
(In reply to Klaus Heinrich Kiwi from comment #4)
> Kevin, care to take a look? Perhaps a symptom of the recent driver whitelist
> changes to tools?

Ops, missed actually assigning kwolf..

Comment 6 Kevin Wolf 2021-09-20 09:46:12 UTC
(In reply to Klaus Heinrich Kiwi from comment #4)
> Kevin, care to take a look? Perhaps a symptom of the recent driver whitelist
> changes to tools?

No, it seems to be an accidental change in behaviour in the upstream code, I think from commit 751cec7a261. The code path didn't check the whitelist before for inserting the job filter driver and now it does. I've replied to the upstream patch series to check if we can just revert to the old behaviour. If not, we need to extend our whitelist downstream.

Comment 7 Kevin Wolf 2021-11-08 15:35:41 UTC
This should be fixed with upstream commit b11c8739, which we will get by rebase.

Comment 9 Kevin Wolf 2021-12-22 12:20:39 UTC
Mirek, as far as I can see, 8.6.0 has already rebased to QEMU 6.2, so can this move to MODIFIED?

Comment 10 John Ferlan 2021-12-22 18:01:48 UTC
Mass update of DTM/ITM to +3 values since the rebase of qemu-6.2 into RHEL 8.6 has been delayed or slowed due to process roadblocks (authentication changes, gating issues). This avoids the DevMissed bot and worse the bot that could come along and strip release+. The +3 was chosen mainly to give a cushion. 

Also added the qemu-6.2 rebase bug 2027716 as a dependent.

Comment 14 Yanan Fu 2021-12-24 02:48:55 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.

Comment 15 aihua liang 2021-12-24 03:16:40 UTC
Test on qemu-kvm-6.2.0-1.module+el8.6.0+13725+61ae1949, don't hit this issue any more.

(1/1) Host_RHEL.m8.u6.product_rhel.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.8.6.0.x86_64.io-github-autotest-qemu.blockdev_inc_backup_pull_mode_diff.q35: PASS (88.59 s)

So set bug's status to "VERIFIED".

Comment 17 errata-xmlrpc 2022-05-10 13:21:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:1759