Bug 1078650

Summary: bdrv_flush_all() should skip scsi-generic devices
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, chayang, hhuang, juzhang, kwolf, michen, pbonzini, qzhang, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-04 11:33:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sibiao Luo 2014-03-20 05:58:05 UTC
Description of problem:
this issue was found when re-tried bug 1067784 which meet 'qemu-kvm: Failed to sync10 data on iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_OPERATION_CODE(0x2000)' when shutdown guest if i use scsi-generic to specified the LUN 0 of my iscsi target with '/0'.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
3.10.0-113.el7.x86_64
qemu-kvm-1.5.3-55.el7.x86_64
guest info:
# uname -r
3.10.0-113.el7.x86_64

How reproducible:
3/3

Steps to Reproduce:
1. Prepare the iscsi target server:
1) On the iscsi target server, created the target by adding an XML entry to the configuration file:

# vim /etc/tgt/targets.conf
<target iqn.2008-09.com.example:server.target2>
    backing-store /iscsi.img
    incominguser redhat redhat
</target>

# service tgtd restart
# tgt-admin --show
Target 1: iqn.2008-09.com.example:server.target2
    System information:
        Driver: iscsi
        State: ready
...
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: null
            Backing store path: None
            Backing store flags: 
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 2097 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /iscsi.img
            Backing store flags: 
    Account information:
        redhat
    ACL information:
        ALL

2. Prepare the iscsi initator:

# vim /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = redhat
node.session.auth.password = redhat

# service iscsid restart

# iscsiadm --mode discovery --type sendtargets --portal 10.66.9.107 –discover
10.66.9.107:3260,1 iqn.2008-09.com.example:server.target2

# iscsiadm -m node -T iqn.2008-09.com.example:server.target2 -p 10.66.9.107 -l
Logging in to [iface: default, target: iqn.2008-09.com.example:server.target2, portal: 10.66.9.107,3260] (multiple)
Login to [iface: default, target: iqn.2008-09.com.example:server.target2, portal: 10.66.9.107,3260] successful.

# iscsiadm -m node -T iqn.2008-09.com.example:server.target2 -p 10.66.9.107 --logout
Logging out of session [sid: 5, target: iqn.2008-09.com.example:server.target2, portal: 10.66.9.107,3260]
Logout of [sid: 5, target: iqn.2008-09.com.example:server.target2, portal: 10.66.9.107,3260] successful.

3. Boot a guest using scsi-generic to specified the LUN 0 of my iscsi target with '/0' with chap authentication.
e.g:...-drive file=iscsi://10.66.9.107/iqn.2008-09.com.example:server.target1/0,if=none,id=drive-data-disk,format=raw,cache=none,aio=native -iscsi id=iqn1,user=redhat,password=redhat -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-generic,drive=drive-data-disk,bus=scsi1.0,id=data-disk

4.check the disk in guest with 'fdisk -l'.

5. shutdown guest.
guest ]# poweroff

Actual results:
after step 3, boot up guest successfully.
(qemu) info block
drive-data-disk: removable=0 file=iscsi://10.66.9.107/iqn.2008-09.com.example:server.target1/0 ro=0 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
...
after step 4, did not find the disk as there is disk for LUN 0.
after step 5, meet 'qemu-kvm: Failed to sync10 data on iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_OPERATION_CODE(0x2000)' when shutdown guest if i use scsi-generic to specified the LUN 0 of my iscsi target with '/0'.
(qemu) qemu-kvm: Failed to sync10 data on iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_OPERATION_CODE(0x2000)
qemu-kvm: Failed to sync10 data on iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_OPERATION_CODE(0x2000)

Expected results:
it should no any error when poweroff guest.

Additional info:
# /usr/libexec/qemu-kvm -M pc -enable-kvm -m 4096 -smp 4 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -drive file=/home/RHEL-Server-7.0-64-virtio.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-blk-pci,vectors=0,bus=pci.0,addr=0x4,scsi=off,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=00:01:02:03:40:21,bus=pci.0,addr=0x5 -k en-us -boot menu=on -qmp tcp:0:5555,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio -drive file=iscsi://10.66.9.107/iqn.2008-09.com.example:server.target1/0,if=none,id=drive-data-disk,format=raw,cache=none,aio=native -iscsi id=iqn1,user=redhat,password=redhat -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-generic,drive=drive-data-disk,bus=scsi1.0,id=data-disk

Comment 1 Paolo Bonzini 2014-04-02 13:06:34 UTC
It will be fixed by upstream commit 049db02e38b65aff6c7871ee3614092f886ce07d.

Comment 2 Paolo Bonzini 2014-04-04 11:33:38 UTC

*** This bug has been marked as a duplicate of bug 1025342 ***