RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1518482 - "share-rw" property is unavailable on scsi passthrough devices
Summary: "share-rw" property is unavailable on scsi passthrough devices
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.5
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Fam Zheng
QA Contact: Xueqiang Wei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-29 03:48 UTC by Dan Zheng
Modified: 2018-04-11 00:51 UTC (History)
22 users (show)

Fixed In Version: qemu-kvm-rhev-2.10.0-18.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-11 00:49:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:1104 0 None None None 2018-04-11 00:51:20 UTC

Description Dan Zheng 2017-11-29 03:48:48 UTC
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 07:29:23 UTC
Working on upstream to add the property, sent patch:

[PATCH] scsi-block: Add share-rw option

Comment 3 Xueqiang Wei 2017-12-05 08:02:44 UTC
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-12 01:48:16 UTC
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 07:34:12 UTC
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 07:38:17 UTC
It's very hard to understand the snippets you pasted, could you explain the problem?

Comment 9 jiyan 2018-01-18 07:45:30 UTC
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 07:50:00 UTC
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 12:59:33 UTC
Fix included in qemu-kvm-rhev-2.10.0-18.el7

Comment 14 Xueqiang Wei 2018-01-24 11:04:18 UTC
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-11 00:49:36 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, 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.