Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1518482 - "share-rw" property is unavailable on scsi passthrough devices
"share-rw" property is unavailable on scsi passthrough devices
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.5
x86_64 Linux
high Severity high
: rc
: ---
Assigned To: Fam Zheng
Xueqiang Wei
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-11-28 22:48 EST by Dan Zheng
Modified: 2018-04-10 20:51 EDT (History)
22 users (show)

See Also:
Fixed In Version: qemu-kvm-rhev-2.10.0-18.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 20:49:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:1104 None None None 2018-04-10 20:51 EDT

  None (edit)
Description Dan Zheng 2017-11-28 22:48:48 EST
Description of problem:
The underlying "share-rw" property is unavaiable on scsi passthrough devices.
The problem exists on x86-64 as well as ppc64le.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.10.0-8.el7.ppc64le
libvirt-3.9.0-3.el7.ppc64le
kernel-4.11.0-44.el7a.ppc64le


How reproducible:
100%

Steps to Reproduce:
1. Add below block disk to the guest

    <disk type='block' device='lun' rawio='no' sgio='unfiltered'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sdb'/>
      <target dev='sdb' bus='scsi'/>
      <shareable/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

2. Start the guest

# virsh start vm1
error: Failed to start domain vm1
error: internal error: qemu unexpectedly closed the monitor: 2017-11-28T09:19:07.595325Z qemu-kvm: -device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=1,share-rw=on,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1: Property '.share-rw' not found

Actual results:
See above. Guest fails to start. Qemu does not support the property.

Expected results:
The guest should be able to start normally

Additional info:
Comment 2 Fam Zheng 2017-12-05 02:29:23 EST
Working on upstream to add the property, sent patch:

[PATCH] scsi-block: Add share-rw option
Comment 3 Xueqiang Wei 2017-12-05 03:02:44 EST
Hi Fam,

"share-rw" property is also unavailable on scsi-generic

(qemu) qemu-kvm: -device scsi-generic,bus=bus1.0,drive=scsi-disk1,id=disk1,share-rw=off: Property '.share-rw' not found
Comment 4 Fam Zheng 2017-12-11 20:48:16 EST
Good catch, for that I posted:

https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg00695.html

[Qemu-devel] [PATCH] scsi-generic: Add share-rw option
Comment 7 jiyan 2018-01-18 02:34:12 EST
Hi, Fam, I found an issue thst scsi hostdev can use same source device with virtual disk at the same time, could you please help check whether it is expected? Thanks in advance.

Version:
libvirt-3.9.0-8.el7.x86_64
qemu-kvm-rhev-2.10.0-17.el7.x86_64
kernel-3.10.0-830.el7.x86_64

Preparation:
# virsh nodedev-list --tree |grep "scsi_host7" -A7
  +- scsi_host7
      |
      +- scsi_target7_0_0
          |
          +- scsi_7_0_0_0
              |
              +- block_sdb_360014052187b9f501b64797aa12ccc1a
              +- scsi_generic_sg1

# lsscsi
[7:0:0:0]    disk    LIO-ORG  lun1             4.0   /dev/sdb 


Test scenario:
Scenario-1: virtual disk can not be shared
# virsh start test ; virsh domstate test
Domain test started

running

# virsh dumpxml test |grep "<disk" -A7
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </disk>

# cat disk1.xml 
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/sdb'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
    </disk>

# cat disk2.xml 
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/sdb'/>
      <backingStore/>
      <target dev='vdc' bus='virtio'/>
    </disk>

# virsh attach-device test disk1.xml 
Device attached successfully

# virsh attach-device test disk2.xml      <== Bug 1526313 here
error: Failed to attach device from disk2.xml
error: internal error: unable to execute QEMU command '__com.redhat_drive_add': Device 'drive-virtio-disk2' could not be initialized


Scenario-2: scsi hostdev can not be shared
# virsh start test ; virsh domstate test
Domain test started

running

# cat hostdev.xml 
  <hostdev mode='subsystem' type='scsi' sgio='filtered' rawio='yes'>
    <source>
      <adapter name='scsi_host7'/>
      <address bus='0' target='0' unit='0'/>
    </source>
  </hostdev>

# virsh attach-device test hostdev.xml 
Device attached successfully

# virsh attach-device test hostdev.xml 
error: Failed to attach device from hostdev.xml
error: Requested operation is not valid: SCSI device 7:0:0:0 is already in use by other domain(s) as 'non-shareable'

Scenario-3: scsi hostdev whith shareable can be shared
# virsh start test ; virsh domstate test
Domain test started

running

# cat hostdev.xml 
  <hostdev mode='subsystem' type='scsi' sgio='filtered' rawio='yes'>
    <source>
      <adapter name='scsi_host7'/>
      <address bus='0' target='0' unit='0'/>
    </source>
    <shareable/>
  </hostdev>

# virsh attach-device test hostdev.xml 
Device attached successfully

# virsh attach-device test hostdev.xml 
Device attached successfully

# virsh dumpxml test |grep "<hostdev" -A8
    <hostdev mode='subsystem' type='scsi' managed='no' sgio='filtered' rawio='yes'>
      <source>
        <adapter name='scsi_host7'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <shareable/>
      <alias name='hostdev0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </hostdev>
    <hostdev mode='subsystem' type='scsi' managed='no' sgio='filtered' rawio='yes'>
      <source>
        <adapter name='scsi_host7'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <shareable/>
      <alias name='hostdev1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </hostdev>

Scenairo-4: Scsi hostdev can use same source device with virtual disk at the same time can be shared
# virsh start test;virsh domstate test
Domain test started

running

# cat disk1.xml 
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/sdb'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
    </disk>

# cat hostdev.xml 
  <hostdev mode='subsystem' type='scsi' sgio='filtered' rawio='yes'>
    <source>
      <adapter name='scsi_host7'/>
      <address bus='0' target='0' unit='0'/>
    </source>
  </hostdev>

# virsh attach-device test disk1.xml 
Device attached successfully

# virsh attach-device test hostdev.xml 
Device attached successfully

# virsh dumpxml test |grep "<disk" -A7
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/sdb'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>

# virsh dumpxml test |grep "<hostdev" -A7
    <hostdev mode='subsystem' type='scsi' managed='no' sgio='filtered' rawio='yes'>
      <source>
        <adapter name='scsi_host7'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </hostdev>
Comment 8 Fam Zheng 2018-01-18 02:38:17 EST
It's very hard to understand the snippets you pasted, could you explain the problem?
Comment 9 jiyan 2018-01-18 02:45:30 EST
Hi, Fam, Sry for the that.
I am trying to check this issue shows in Scenario-4, hostdev with scsi_host7 as source, virtual disk with dev/sdb as source, while in the info returned by 'virsh nodedev-list --tree' command, those two source means same. So I want to check whether the result in Scenario-4 is expected.
Comment 10 Fam Zheng 2018-01-18 02:50:00 EST
The scsi_host7 goes through /dev/sgX, so it uses a different lock from /dev/sdb. You are right they are essentially the same device so it is a "shared" case, but it's hard to detect this from QEMU.

I wonder if virtlockd can handle this as well.
Comment 12 Miroslav Rezanina 2018-01-23 07:59:33 EST
Fix included in qemu-kvm-rhev-2.10.0-18.el7
Comment 14 Xueqiang Wei 2018-01-24 06:04:18 EST
Tested on qemu-kvm-rhev-2.10.0-18.el7, the results are all passed.

Details:

Host:
kernel-3.10.0-836.el7.x86_64
qemu-kvm-rhev-2.10.0-18.el7
Guest:
kernel-3.10.0-830.el7.x86_64


(1) scsi-block, share-rw=off
-drive file=/dev/sdb,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk1 \
    -device virtio-scsi-pci,id=bus1,bus=pci.0 \
    -device scsi-block,bus=bus1.0,drive=scsi-disk1,id=disk1,share-rw=off \
    -drive file=/dev/sdb,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk2 \
    -device virtio-scsi-pci,id=bus2,bus=pci.0 \
    -device scsi-block,bus=bus2.0,drive=scsi-disk2,id=disk2,share-rw=off \

# sh share-rw-block.sh 
QEMU 2.10.0 monitor - type 'help' for more information
(qemu) qemu-kvm: -device scsi-block,bus=bus2.0,drive=scsi-disk2,id=disk2,share-rw=off: Failed to get "write" lock
Is another process using the image?


(2) scsi-block, share-rw=on
-drive file=/dev/sdb,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk1 \
    -device virtio-scsi-pci,id=bus1,bus=pci.0 \
    -device scsi-block,bus=bus1.0,drive=scsi-disk1,id=disk1,share-rw=on \
    -drive file=/dev/sdb,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk2 \
    -device virtio-scsi-pci,id=bus2,bus=pci.0 \
    -device scsi-block,bus=bus2.0,drive=scsi-disk2,id=disk2,share-rw=on \

# sh share-rw-block.sh 
QEMU 2.10.0 monitor - type 'help' for more information
(qemu)


(3) scsi-generic, share-rw=off

-drive file=/dev/sg3,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk1 \
    -device virtio-scsi-pci,id=bus1,bus=pci.0 \
    -device scsi-generic,bus=bus1.0,drive=scsi-disk1,id=disk1,share-rw=off \
    -drive file=/dev/sg3,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk2 \
    -device virtio-scsi-pci,id=bus2,bus=pci.0 \
    -device scsi-generic,bus=bus2.0,drive=scsi-disk2,id=disk2,share-rw=off \

# sh share-rw-generic.sh 
QEMU 2.10.0 monitor - type 'help' for more information
(qemu) qemu-kvm: -device scsi-generic,bus=bus2.0,drive=scsi-disk2,id=disk2,share-rw=off: Failed to get "write" lock
Is another process using the image?


(4)  scsi-generic, share-rw=on

-drive file=/dev/sg3,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk1 \
    -device virtio-scsi-pci,id=bus1,bus=pci.0 \
    -device scsi-generic,bus=bus1.0,drive=scsi-disk1,id=disk1,share-rw=on \
    -drive file=/dev/sg3,if=none,format=raw,snapshot=off,aio=threads,cache=writethrough,id=scsi-disk2 \
    -device virtio-scsi-pci,id=bus2,bus=pci.0 \
    -device scsi-generic,bus=bus2.0,drive=scsi-disk2,id=disk2,share-rw=on \

# sh share-rw-generic.sh 
QEMU 2.10.0 monitor - type 'help' for more information
(qemu) 


So verify this bug.
Comment 17 errata-xmlrpc 2018-04-10 20:49:36 EDT
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, 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-2018:1104

Note You need to log in before you can comment on or make changes to this bug.