Bug 1158310 - Error "sr 0:0:1:0: rejecting I/O to offline device" when eject cdrom
Summary: Error "sr 0:0:1:0: rejecting I/O to offline device" when eject cdrom
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: John Snow
QA Contact: FuXiangChun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-29 04:47 UTC by CongLi
Modified: 2016-11-07 20:16 UTC (History)
11 users (show)

Fixed In Version: qemu 2.6.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-07 20:16:12 UTC
Target Upstream Version:


Attachments (Terms of Use)
messages of guest (1.44 MB, text/plain)
2014-10-29 04:47 UTC, CongLi
no flags Details
dmesg-change"scsi-cd"cdrom09292014 (81.30 KB, text/plain)
2014-10-29 09:05 UTC, Gu Nini
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2673 normal SHIPPED_LIVE qemu-kvm-rhev bug fix and enhancement update 2016-11-08 01:06:13 UTC

Description CongLi 2014-10-29 04:47:02 UTC
Created attachment 951626 [details]
messages of guest

Description of problem:
Error "sr 0:0:1:0: rejecting I/O to offline device" when eject cdrom

Version-Release number of selected component (if applicable):
guest:
kernel-3.10.0-196.el7.x86_64

host:
kernel-3.10.0-193.el7.x86_64
qemu-kvm-rhev-2.1.2-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Boot a RHEL.7.1 guest with the iso 'orig'
    -drive id=drive_cd1,if=none,snapshot=off,aio=native,media=cdrom,file=/home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/orig.iso \
    -device scsi-cd,id=cd1,drive=drive_cd1 \

2. update the udev rules in guest then reboot it:
udev_cdrom=/lib/udev/rules.d/60-cdrom_id.rules; [ -f $udev_cdrom ] && sed -i 's/\(.*DISK_EJECT_REQUEST.*\)/#\1/g' $udev_cdrom && sed -i  's/\(.*lock-media.*\)/#\1/g' $udev_cdrom
10/27 18:12:40 DEBUG|   aexpect:1470| Sending command: echo $? 

3. check the block status via qemu
(qemu) info block
drive_image1: /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.1-64.qcow2 (qcow2)

drive_cd1: /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/orig.iso (raw, read-only)
    Removable device: not locked, tray closed

4. eject the iso 'orig.iso' via HMP in qemu
(qemu) eject drive_cd1 

5. check the block status again after ejecting
(qemu) info block
drive_image1: /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.1-64.qcow2 (qcow2)

drive_cd1: [not inserted]
    Removable device: not locked, tray open

6. insert a new iso 'new.iso' via HMP in qemu
(qemu) change drive_cd1 /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/new.iso

7. check the block status
(qemu) info block
drive_image1: /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.1-64.qcow2 (qcow2)

drive_cd1: /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/new.iso (raw, read-only)
    Removable device: not locked, tray closed

8. eject the new iso 'new.iso' in guest
[root@unused ~]# eject /dev/sr0
eject: cannot open /dev/sr0: No such device or address

Actual results:
eject operation failed
dmesg with error:
[  203.239021] sr 1:0:1:0: device reset
[  203.239767] sr 1:0:1:0: Device offlined - not ready after error recovery
[  203.240559] sr 1:0:1:0: rejecting I/O to offline device

Expected results:
eject operation successfully

Additional info:
1. dmesg in guest:
[  203.239021] sr 1:0:1:0: device reset
[  203.239767] sr 1:0:1:0: Device offlined - not ready after error recovery
[  203.240559] sr 1:0:1:0: rejecting I/O to offline device
[  203.243239] sr 1:0:1:0: rejecting I/O to offline device
[  203.243799] sr 1:0:1:0: rejecting I/O to offline device
[  203.244437] sr 1:0:1:0: rejecting I/O to offline device
[  203.245051] sr 1:0:1:0: rejecting I/O to offline device
[  203.245639] sr 1:0:1:0: rejecting I/O to offline device
[  203.249697] sr 1:0:1:0: rejecting I/O to offline device
[  203.250306] sr 1:0:1:0: rejecting I/O to offline device
[  203.252300] sr 1:0:1:0: rejecting I/O to offline device

2. Qemu CML:
/bin/qemu-kvm \
    -S  \
    -name 'virt-tests-vm1'  \
    -sandbox off  \
    -M pc  \
    -nodefaults  \
    -vga qxl  \
    -global qxl-vga.vram_size=33554432  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20141027-181201-ya8T7xOz,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=serial_id_serial0,path=/tmp/serial-serial0-20141027-181201-ya8T7xOz,server,nowait \
    -device isa-serial,chardev=serial_id_serial0  \
    -chardev socket,id=seabioslog_id_20141027-181201-ya8T7xOz,path=/tmp/seabios-20141027-181201-ya8T7xOz,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20141027-181201-ya8T7xOz,iobase=0x402 \
    -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=03 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=04 \
    -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,file=/home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.1-64.qcow2 \
    -device scsi-hd,id=image1,drive=drive_image1 \
    -device e1000,mac=9a:4e:4f:50:51:52,id=id7yBMiW,netdev=idoyaOdP,bus=pci.0,addr=05  \
    -netdev tap,id=idoyaOdP  \
    -m 4096  \
    -smp 4,cores=2,threads=1,sockets=2  \
    -cpu 'SandyBridge',+kvm_pv_unhalt \
    -drive id=drive_cd1,if=none,snapshot=off,aio=native,media=cdrom,file=/home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/orig.iso \
    -device scsi-cd,id=cd1,drive=drive_cd1 \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off  \
    -no-kvm-pit-reinjection \
    -enable-kvm \
    -monitor stdio \
    -vnc :0

Comment 3 Gu Nini 2014-10-29 09:05:20 UTC
Created attachment 951678 [details]
dmesg-change"scsi-cd"cdrom09292014

I met the same issue on RHEL.7.0 guest. The guest was booted up with a "scsi-cd" CD-ROM as follows
--------------------------------------------------------------------------
-device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi0 \
-drive file=/mnt/test1.iso,if=none,media=cdrom,readonly=on,format=raw,id=cdrom1 \
-device scsi-cd,bus=scsi0.0,drive=cdrom1,id=scsi0-0 \
--------------------------------------------------------------------------
After changed the cdrom iso file, the issue occurred, dmesg prompted "sr 2:0:0:0: rejecting I/O to offline device", please refer to the attached log "dmesg-change"scsi-cd"cdrom09292014"
However, if the guest was booted up with an "ide-drive" CD-ROM, it worked well when changed cdrom iso file.

Version:
Guest:
kernel:3.10.0-123.el7.x86_64

Host:
kernel:3.10.0-188.el7.x86_64
qemu-kvm:qemu-kvm-rhev-2.1.2-3.el7

Comment 6 John Snow 2016-06-09 20:57:27 UTC
CongLi, can you please elaborate on what Step 2 is supposed to do? Does the bug reproduce without step 2?

qemu-kvm-rhev has gone through several rebases as well, so this bug might have been fixed between then and now.

Can you please clarify and/or re-test?

(Sorry, I know this bug is an old one...)

--js

Comment 7 CongLi 2016-06-13 11:26:26 UTC
(In reply to John Snow from comment #6)
> CongLi, can you please elaborate on what Step 2 is supposed to do? Does the
> bug reproduce without step 2?
 
systemd add new cdrom rules in udev to prevent eject media, disable it
before cdrom test to avoid test failed some latest guests.

> qemu-kvm-rhev has gone through several rebases as well, so this bug might
> have been fixed between then and now.
> 
> Can you please clarify and/or re-test?

This bug can not be reproduced on latest RHEL.7.3 host with RHEL.7.3 guest.
host:
qemu-kvm-rhev-2.6.0-5.el7.x86_64
kernel-3.10.0-426.el7.x86_64
guest:
kernel-3.10.0-425.el7.x86_64

Thanks.

Comment 8 CongLi 2016-06-13 11:34:00 UTC
(In reply to CongLi from comment #7)
> (In reply to John Snow from comment #6)
> > CongLi, can you please elaborate on what Step 2 is supposed to do? Does the
> > bug reproduce without step 2?
>  
> systemd add new cdrom rules in udev to prevent eject media, disable it
> before cdrom test to avoid test failed some latest guests.
> 
> > qemu-kvm-rhev has gone through several rebases as well, so this bug might
> > have been fixed between then and now.
> > 
> > Can you please clarify and/or re-test?
> 
> This bug can not be reproduced on latest RHEL.7.3 host with RHEL.7.3 guest.
> host:
> qemu-kvm-rhev-2.6.0-5.el7.x86_64
> kernel-3.10.0-426.el7.x86_64
> guest:
> kernel-3.10.0-425.el7.x86_64
> 
> Thanks.

Either with or without step 2, this bug can not be reproduced now.

Comment 9 John Snow 2016-06-13 19:27:54 UTC
Thank you for testing! I'll move this to POST to signal that it was fixed in (at least) qemu-kvm-rhev 2.6.0.

Comment 11 FuXiangChun 2016-09-13 06:58:28 UTC
verified this bug with latest qemu-kvm-rhev-2.6.0-24 and kernel 3.10.0-505.el7.x86_64. and 7.3 host and guest.

According to comment0, I tested 3 times.  guest works well. can not reproduce this bug. so set this bug as verified.

Comment 13 errata-xmlrpc 2016-11-07 20:16:12 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://rhn.redhat.com/errata/RHBA-2016-2673.html


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