Bug 1090978

Summary: qemu-kvm: iSCSI: Failure. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
Product: Red Hat Enterprise Linux 7 Reporter: Jan Kurik <jkurik>
Component: qemu-kvmAssignee: Miroslav Rezanina <mrezanin>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, chayang, famz, hhuang, jherrman, juli, juzhang, knoel, michen, pbonzini, pm-eus, qzhang, sluo, virt-maint, xfu
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-60.el7_0.1 Doc Type: Bug Fix
Doc Text:
Due to a bug in the Internet Small Computer System Interface (iSCSI) driver, a qemu-kvm process terminated unexpectedly with a segmentation fault when the "write same" command was executed in guest mode under the iSCSI protocol. This update fixes the bug and the "write same" command now functions in guest mode under iSCSI as intended.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-10 12:34:50 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: 1083413    
Bug Blocks:    

Description Jan Kurik 2014-04-24 14:02:58 UTC
This bug has been copied from bug #1083413 and has been proposed
to be backported to 7.0 z-stream (EUS).

Comment 6 Sibiao Luo 2014-05-06 08:21:07 UTC
Verify this issue on qemu-kvm-1.5.3-60.el7_0.1.x86_64 with the same steps as bug 1083413#c0.

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-123.el7.x86_64
qemu-kvm-1.5.3-60.el7_0.1.x86_64
guest info:
# uname -r
3.10.0-123.el7.x86_64

Steps:
1.prepare a libiscsi LUN.
# qemu-img info iscsi://10.66.8.202:3260/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.e1f8ebef2fed/0
image: iscsi://10.66.8.202:3260/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.e1f8ebef2fed/0
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: unavailable
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
2.start qemu with this libiscsi disk.
# /usr/libexec/qemu-kvm -M pc -cpu Conroe -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection...-drive file=iscsi://10.66.8.202:3260/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.e1f8ebef2fed/0,if=none,media=disk,format=qcow2,id=drive-data-disk,cache=none,aio=native,discard=on -device virtio-scsi-pci,bus=pci.0,addr=0x7,id=scsi0,multifunction=on -device scsi-hd,drive=drive-data-disk,id=data-disk,bus=scsi0.0,logical_block_size=4096
3. Execute the following commands in guest:
# yes | head -n2048 > buf
# sg_write_same --in buf --num=32 --lba=80 /dev/sdb
# sg_write_same --in /dev/zero --num=96 --lba=0 /dev/sdb
# sg_write_same -U --in /dev/zero --num=16 --lba=0 /dev/sdb
# time sg_write_same --in buf --num=65536 --lba=131074 /dev/sdb
# time sg_write_same --in /dev/zero --num=65534 --lba=196608 /dev/sdb
# sg_write_same --in /dev/zero --num=0 --lba=128 /dev/sdb

Results:
It did not cause QEMU core dumped, both guest and QEMU work well.
# yes | head -n2048 > buf
# sg_write_same --in buf --num=32 --lba=80 /dev/sdb
# sg_write_same --in /dev/zero --num=96 --lba=0 /dev/sdb
# sg_write_same -U --in /dev/zero --num=16 --lba=0 /dev/sdb
# time sg_write_same --in buf --num=65536 --lba=131074 /dev/sdb

real	0m5.512s
user	0m0.001s
sys	0m0.003s
# time sg_write_same --in /dev/zero --num=65534 --lba=196608 /dev/sdb

real	0m0.010s
user	0m0.002s
sys	0m0.002s
# sg_write_same --in /dev/zero --num=0 --lba=128 /dev/sdb
bad field in Write same(10) cdb, option probably not supported

According to above testing, this issue has been fixed correctly. Move to VERIFIED status, please correct me if any mistake.

Best Regards,
sluo

Comment 7 Sibiao Luo 2014-05-06 08:33:10 UTC
Both in my AMD(Opteron_G3) and Intel(SandyBridge) host tested this issue to pass.

Comment 10 errata-xmlrpc 2014-06-10 12:34:50 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.

http://rhn.redhat.com/errata/RHSA-2014-0704.html