Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1079876

Summary: qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: areis, chayang, famz, hhuang, jsuchane, juzhang, knoel, michen, pbonzini, qzhang, rbalakri, sluo, stefanha, 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: 2016-09-01 22:10:01 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:
Bug Depends On:    
Bug Blocks: 1110700, 1191021, 1205796    
Attachments:
Description Flags
targetcli_configure_iscsi. none

Description Sibiao Luo 2014-03-24 08:08:03 UTC
Description of problem:
Found this bug when verify bug 1058173. Tried to install guest with ISO to a libiscsi disk which configured an iSCSI target by creating an backing device with fileio type using LIO, but it fail to install with a prompt'qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)'.

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-57.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.# yum install targetcli
2.Configuration an iSCSI target by creating an backing device with fileio type.
/iscsi> ls
o- iscsi .............................................................................................................. [Targets: 1]
  o- iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.10b139e7a94e ........................................................ [TPGs: 1]
    o- tpg1 .................................................................................................... [gen-acls, no-auth]
      o- acls ............................................................................................................ [ACLs: 0]
      o- luns ............................................................................................................ [LUNs: 1]
      | o- lun0 ................................................................................ [fileio/b0 (/home/iscsitarget.img)]
      o- portals ...................................................................................................... [Portals: 1]
        o- 10.66.8.202:3261 ................................................................................................... [OK]
/backstores> ls
o- backstores ................................................................................................................ [...]
  o- block .................................................................................................... [Storage Objects: 0]
  o- fileio ................................................................................................... [Storage Objects: 1]
  | o- b0 ................................................................... [/home/iscsitarget.img (10.0GiB) write-back activated]
  o- pscsi .................................................................................................... [Storage Objects: 0]
  o- ramdisk .................................................................................................. [Storage Objects: 0]
3.set auth mode.
/iscsi/iqn.20...39e7a94e/tpg1> set attribute generate_node_acls=1
/iscsi/iqn.20...39e7a94e/tpg1> set attribute authentication=0
4.discover the iSCSI LUN.
# iscsiadm --mode discovery --type sendtargets --portal 10.66.8.202:3261 --discover
10.66.8.202:3261,1 iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.10b139e7a94e
5.setup a QEMU with the iSCSI LUN specify.
e.g:# /usr/libexec/qemu-kvm -spice disable-ticketing,port=5932 -monitor stdio -drive file=iscsi://10.66.8.202:3261/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.10b139e7a94e/0,if=none,id=drive-data-disk,werror=stop,rerror=stop -iscsi id=iqn1 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-disk,drive=drive-data-disk,bus=scsi1.0,id=data-disk,bootindex=0 -cdrom RHEL-7.0-20131030.1-Server-x86_64-dvd1.iso -boot menu=on -enable-kvm -m 2048

Actual results:
after step 5, fail to install with a prompt'qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)', and VM in paused status.
(qemu) main_channel_link: add main channel client
main_channel_handle_parsed: net test: latency 0.624000 ms, bitrate 53894736842 bps (51398.026316 Mbps)
inputs_connect: inputs channel client create
red_dispatcher_set_cursor_peer: 
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)
block I/O error in device 'drive-data-disk': Input/output error (5)

(qemu) info status 
VM status: paused (io-error)
(qemu) cont
(qemu) qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)

(qemu) info status 
VM status: paused (io-error)

Expected results:
It should work well to complete installation successfully.

Additional info:

Comment 1 Sibiao Luo 2014-03-24 08:09:15 UTC
(In reply to Sibiao Luo from comment #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-57.el7.x86_64
> 
# rpm -qa | grep libiscsi
libiscsi-1.9.0-6.el7.x86_64

Comment 2 Sibiao Luo 2014-03-24 08:13:55 UTC
If i use the old iscsi which configuered by IET will meet bug 1078122 but different bt logs.

# /usr/libexec/qemu-kvm -spice port=5931,disable-ticketing -monitor stdio -drive file=iscsi://10.66.90.100:3260/iqn.2001-05.com.equallogic:0-8a0906-4fb1f7d03-455f49b421252a57-s2-sluo-270305-2/0,if=none,id=drive-data-disk,werror=stop,rerror=stop -iscsi id=iqn1 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-hd,drive=drive-data-disk,bus=scsi1.0,id=data-disk,bootindex=0 -cdrom RHEL-7.0-20131030.1-Server-x86_64-dvd1.iso -boot menu=on -enable-kvm -m 2048

(qemu) qemu-kvm: Failed to sync10 data on iSCSI lun. RESERVATION CONFLICT
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to sync10 data on iSCSI lun. RESERVATION CONFLICT

(qemu) info status 
VM status: paused (io-error)
(qemu) cont
(qemu) qemu-kvm: hw/scsi/scsi-bus.c:104: scsi_dma_restart_bh: Assertion `!req->sg' failed.
Aborted (core dumped)

(gdb) bt
#0  0x00007fba4a41f989 in raise () from /lib64/libc.so.6
#1  0x00007fba4a421098 in abort () from /lib64/libc.so.6
#2  0x00007fba4a4188f6 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007fba4a4189a2 in __assert_fail () from /lib64/libc.so.6
#4  0x00007fba4f8e053a in scsi_dma_restart_bh (opaque=<optimized out>) at hw/scsi/scsi-bus.c:104
#5  0x00007fba4f8384d7 in aio_bh_poll (ctx=ctx@entry=0x7fba51372400) at async.c:81
#6  0x00007fba4f838128 in aio_poll (ctx=0x7fba51372400, blocking=blocking@entry=false) at aio-posix.c:185
#7  0x00007fba4f8383e0 in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at async.c:194
#8  0x00007fba4ec74ac6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#9  0x00007fba4f90d73a in glib_pollfds_poll () at main-loop.c:187
#10 os_host_main_loop_wait (timeout=<optimized out>) at main-loop.c:232
#11 main_loop_wait (nonblocking=<optimized out>) at main-loop.c:464
#12 0x00007fba4f833e50 in main_loop () at vl.c:1988
#13 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4360
(gdb) bt full
#0  0x00007fba4a41f989 in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007fba4a421098 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x00007fba4a4188f6 in __assert_fail_base () from /lib64/libc.so.6
No symbol table info available.
#3  0x00007fba4a4189a2 in __assert_fail () from /lib64/libc.so.6
No symbol table info available.
#4  0x00007fba4f8e053a in scsi_dma_restart_bh (opaque=<optimized out>) at hw/scsi/scsi-bus.c:104
        opaque = <optimized out>
        s = <optimized out>
        req = <optimized out>
        next = 0x0
#5  0x00007fba4f8384d7 in aio_bh_poll (ctx=ctx@entry=0x7fba51372400) at async.c:81
        bh = <optimized out>
        bhp = <optimized out>
        next = 0x7fba51483b30
        ret = 1
#6  0x00007fba4f838128 in aio_poll (ctx=0x7fba51372400, blocking=blocking@entry=false) at aio-posix.c:185
        node = <optimized out>
        ret = <optimized out>
        busy = <optimized out>
        progress = false
#7  0x00007fba4f8383e0 in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at async.c:194
        ctx = <optimized out>
#8  0x00007fba4ec74ac6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
No symbol table info available.
#9  0x00007fba4f90d73a in glib_pollfds_poll () at main-loop.c:187
        context = 0x7fba51372e00
        pfds = <optimized out>
#10 os_host_main_loop_wait (timeout=<optimized out>) at main-loop.c:232
        ret = 40
        spin_counter = 1
#11 main_loop_wait (nonblocking=<optimized out>) at main-loop.c:464
        ret = 40
        timeout = 1000
#12 0x00007fba4f833e50 in main_loop () at vl.c:1988
        nonblocking = <optimized out>
        last_io = 1
#13 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4360
        i = <optimized out>
        snapshot = 0
        linux_boot = 0
        icount_option = 0x0
        initrd_filename = 0x0
        kernel_filename = 0x0
        kernel_cmdline = 0x7fba4fae1120 ""
        boot_order = 0x7fba4fa99046 "cad"
        ds = <optimized out>
        cyls = 0
        heads = 0
        secs = 0
        translation = 0
        hda_opts = <optimized out>
        opts = 0x7fba513719f0
        machine_opts = <optimized out>
        olist = <optimized out>
        optind = 26
        optarg = 0x7fff4c4a77f0 "2048"
        loadvm = 0x0
        machine = 0x7fba4fe6c3c0 <pc_machine_rhel700>
        cpu_model = 0x0
        vga_model = 0x7fba4fac3d1f "cirrus"
        pid_file = 0x0
        incoming = 0x0
        show_vnc_port = 0
        defconfig = <optimized out>
        userconfig = false
        log_mask = <optimized out>
        log_file = 0x0
        mem_trace = {malloc = 0x7fba4f9743b0 <malloc_and_trace>, realloc = 0x7fba4f974390 <realloc_and_trace>, free = 0x7fba4f974380 <free_and_trace>, calloc = 0x0, 
          try_malloc = 0x0, try_realloc = 0x0}
        trace_events = 0x0
        trace_file = 0x0
        __PRETTY_FUNCTION__ = "main"
        args = {machine = 0x7fba4fe6c3c0 <pc_machine_rhel700>, ram_size = 2147483648, boot_device = 0x7fba4fa99046 "cad", kernel_filename = 0x0, 
          kernel_cmdline = 0x7fba4fae1120 "", initrd_filename = 0x0, cpu_model = 0x0}
(gdb)

Comment 3 Fam Zheng 2014-03-24 10:15:12 UTC
Sibiao,

Please check that write protect is 0 in targetcli:

/iscsi/iqn.20...0955a279/tpg1> get attribute

[snip]

demo_mode_write_protect=0
-------------------------
The demo_mode_write_protect attribute.

[snip]

prod_mode_write_protect=0
-------------------------
The prod_mode_write_protect attribute.

Fam

Comment 4 Sibiao Luo 2014-03-24 10:29:53 UTC
(In reply to Fam Zheng from comment #3)
> Sibiao,
> 
> Please check that write protect is 0 in targetcli:
> 
> /iscsi/iqn.20...0955a279/tpg1> get attribute
> 
> [snip]
> 
> demo_mode_write_protect=0
> -------------------------
> The demo_mode_write_protect attribute.
> 
> [snip]
> 
> prod_mode_write_protect=0
> -------------------------
> The prod_mode_write_protect attribute.
> 
Hit the same issue with this configure.

/backstores> cd /iscsi/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.10b139e7a94e/
/iscsi/iqn.20....10b139e7a94e> ls
o- iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.10b139e7a94e ................................................ [TPGs: 1]
  o- tpg1 ............................................................................................ [gen-acls, no-auth]
    o- acls .................................................................................................... [ACLs: 0]
    o- luns .................................................................................................... [LUNs: 1]
    | o- lun0 ........................................................................ [fileio/b0 (/home/iscsitarget.img)]
    o- portals .............................................................................................. [Portals: 1]
      o- 10.66.8.202:3261 ........................................................................................... [OK]
/iscsi/iqn.20....10b139e7a94e> cd tpg1/
/iscsi/iqn.20...39e7a94e/tpg1> set attribute demo_mode_write_protect=0
Parameter demo_mode_write_protect is now '0'.
/iscsi/iqn.20...39e7a94e/tpg1> set attribute prod_mode_write_protect=0
Parameter prod_mode_write_protect is now '0'.
/iscsi/iqn.20...39e7a94e/tpg1> get attribute 
ATTRIBUTE CONFIG GROUP
======================
authentication=0
----------------
The authentication attribute.

cache_dynamic_acls=1
--------------------
The cache_dynamic_acls attribute.

default_cmdsn_depth=16
----------------------
The default_cmdsn_depth attribute.

demo_mode_write_protect=0
-------------------------
The demo_mode_write_protect attribute.

generate_node_acls=1
--------------------
The generate_node_acls attribute.

login_timeout=15
----------------
The login_timeout attribute.

netif_timeout=2
---------------
The netif_timeout attribute.

prod_mode_write_protect=0
-------------------------
The prod_mode_write_protect attribute.


/iscsi/iqn.20...39e7a94e/tpg1> cd /
/> saveconfig 
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
/> exit

# /usr/libexec/qemu-kvm -spice disable-ticketing,port=5932 -monitor stdio -drive file=iscsi://10.66.8.202:3261/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.10b139e7a94e/0,if=none,id=drive-data-disk,werror=stop,rerror=stop -iscsi id=iqn1 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-disk,drive=drive-data-disk,bus=scsi1.0,id=data-disk,bootindex=0 -cdrom RHEL-7.0-20131030.1-Server-x86_64-dvd1.iso -boot menu=on -enable-kvm -m 2048

(qemu) main_channel_link: add main channel client
main_channel_handle_parsed: net test: latency 10.532000 ms, bitrate 20480000000 bps (19531.250000 Mbps)
inputs_connect: inputs channel client create
red_dispatcher_set_cursor_peer: 

(qemu) qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)

(qemu) info status 
VM status: paused (io-error)
(qemu) cont
(qemu) qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)

(qemu) q

Comment 5 Sibiao Luo 2014-03-24 11:07:45 UTC
Also tried the qcow2 disk which hit the same issue. I will attach my targetcli configure.

# qemu-img info iscsi://10.66.8.202:3260/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.0e320feb6c77/0
image: iscsi://10.66.8.202:3260/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.0e320feb6c77/0
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: unavailable
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false

# /usr/libexec/qemu-kvm -spice disable-ticketing,port=5932 -monitor stdio -drive file=iscsi://10.66.8.202:3260/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.0e320feb6c77/0,if=none,id=drive-data-disk,werror=stop,rerror=stop -iscsi id=iqn1 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-disk,drive=drive-data-disk,bus=scsi1.0,id=data-disk,bootindex=0 -cdrom RHEL-7.0-20131030.1-Server-x86_64-dvd1.iso -boot menu=on -enable-kvm -m 2048

(qemu) qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)

(qemu) info status 
VM status: paused (io-error)
(qemu) cont
(qemu) qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)

(qemu) q

Also debug with the qemu-io meet the same log.
# qemu-io iscsi://10.66.8.202:3260/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.0e320feb6c77/0
qemu-io> write 0 1M
Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
write failed: Input/output error
qemu-io> q
Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)

Comment 6 Sibiao Luo 2014-03-24 11:08:35 UTC
Created attachment 877987 [details]
targetcli_configure_iscsi.

Comment 7 RHEL Program Management 2014-04-01 05:47:39 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 8 Sibiao Luo 2014-04-02 10:31:21 UTC
Retried the latest qemu-kvm-1.5.3-60.el7.x86_64 verison with the same testing.

If i use the qemu-io still hit this issue, but if i install OS with iso which can't trigger the "qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)".

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-115.el7.x86_64
qemu-kvm-1.5.3-60.el7.x86_64

# qemu-io iscsi://10.66.8.202:3261/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.10b139e7a94e/0
qemu-io> write 0 10M
Failed to write16 data to iSCSI lun. SENSE KEY:ILLEGAL_REQUEST(5) ASCQ:INVALID_FIELD_IN_CDB(0x2400)
write failed: Input/output error
qemu-io> q

# targetcli
/> ls
o- / ............................................................................................................... [...]
  o- backstores .................................................................................................... [...]
  | o- block ........................................................................................ [Storage Objects: 0]
  | o- fileio ....................................................................................... [Storage Objects: 3]
  | | o- b0 ....................................................... [/home/iscsitarget.img (10.0GiB) write-back activated]
  | | o- b1 .................................................... [/home/libiscsitarget.img (10.0GiB) write-back activated]
  | | o- b2 ............................................................... [/home/test.img (5.0GiB) write-thru activated]

Best Regards,
sluo

Comment 9 Paolo Bonzini 2014-05-06 16:34:17 UTC
Can you include the dmesg for the SCSI target machine?

Comment 10 Sibiao Luo 2014-05-09 08:23:45 UTC
(In reply to Paolo Bonzini from comment #9)
> Can you include the dmesg for the SCSI target machine?
Retried it on my AMD Opteron_G4 host meet the same isssue. There are some "[187918.557477] TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000" in SCSI target host dmesg log.

- Host info:
# uname -r && rpm -q qemu-kvm
3.10.0-123.el7.x86_64
qemu-kvm-1.5.3-60.el7.x86_64

- qemu-kvm command line:
# /usr/libexec/qemu-kvm -spice disable-ticketing,port=5931 -monitor stdio -drive file=iscsi://10.66.8.202:3261/iqn.2003-01.org.linux-iscsi.dhcp-8-202.x8664:sn.4a3b1d40a109/0,if=none,id=drive-data-disk,werror=stop,rerror=stop -iscsi id=iqn1 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-disk,drive=drive-data-disk,bus=scsi1.0,id=data-disk,bootindex=0 -cdrom RHEL-7.0-20131030.1-Server-x86_64-dvd1.iso -boot menu=on -enable-kvm -m 2048
QEMU 1.5.3 monitor - type 'help' for more information
(qemu)
(qemu) qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)

(qemu) info status 
VM status: paused (io-error)
(qemu) cont
(qemu) qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)
qemu-kvm: Failed to write16 data to iSCSI lun. SENSE KEY:DATA PROTECTION(7) ASCQ:WRITE_PROTECTED(0x2700)
block I/O error in device 'drive-data-disk': Input/output error (5)

- There log in SCSI target host:
SCSI target host]# dmesg 
[187918.557477] TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
[187918.622969] TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
[188573.788774] TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
[188573.854221] TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000

SCSI target host]# tail /var/log/messages
May  9 16:08:07 dhcp-8-202 kernel: TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
May  9 16:08:07 dhcp-8-202 kernel: TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
May  9 16:10:01 dhcp-8-202 systemd: Starting Session 376 of user root.
May  9 16:10:01 dhcp-8-202 systemd: Started Session 376 of user root.
May  9 16:19:01 dhcp-8-202 kernel: [188573.788774] TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
May  9 16:19:01 dhcp-8-202 kernel: TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
May  9 16:19:01 dhcp-8-202 kernel: TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
May  9 16:19:02 dhcp-8-202 kernel: [188573.854221] TARGET_CORE[iSCSI]: Detected WRITE_PROTECTED LUN Access for 0x00000000
May  9 16:20:01 dhcp-8-202 systemd: Starting Session 377 of user root.
May  9 16:20:01 dhcp-8-202 systemd: Started Session 377 of user root.

- My host cpu info:
# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    1
Core(s) per socket:    8
Socket(s):             2
NUMA node(s):          4
Vendor ID:             AuthenticAMD
CPU family:            16
Model:                 9
Model name:            AMD Opteron(tm) Processor 6128
Stepping:              1
CPU MHz:               1999.907
BogoMIPS:              4000.08
Virtualization:        AMD-V
L1d cache:             64K
L1i cache:             64K
L2 cache:              512K
L3 cache:              5118K
NUMA node0 CPU(s):     0,2,4,6
NUMA node1 CPU(s):     8,10,12,14
NUMA node2 CPU(s):     9,11,13,15
NUMA node3 CPU(s):     1,3,5,7

Best Regards,
sluo

Comment 18 Paolo Bonzini 2015-08-04 13:11:37 UTC
Moved to 7.3.

Comment 22 FuXiangChun 2016-09-28 05:47:56 UTC
According to comment0,Re-tested this bug with qemu-kvm-1.5.3-126.el7 & qemu-kvm-rhev-2.6.0-28.el7.

This problem is gone.