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.
Description of problem:
------------------------
qemu-kvm fails to hide a host device being written when passthrough it with usb-host.
Version-Release number of selected component (if applicable):
--------------------------------------------------------------
qemu-kvm-0.12.1.2-2.249.el6.bz796118.1.x86_64
(i hit this when testing bz796118, i think in this case this build equals to 249)
How reproducible:
------------------
100%
Steps to Reproduce:
--------------------
1. plug two usb stick to host
2.[root@shu ~]# ls -il /dev/sd*
6199 brw-rw----. 1 root disk 8, 0 Mar 20 22:01 /dev/sda
6200 brw-rw----. 1 root disk 8, 1 Mar 20 22:01 /dev/sda1
6201 brw-rw----. 1 root disk 8, 2 Mar 20 22:01 /dev/sda2
320354 brw-rw----. 1 root disk 8, 112 Mar 20 22:50 /dev/sdh
320520 brw-rw----. 1 root disk 8, 113 Mar 20 22:50 /dev/sdh1
320478 brw-rw----. 1 root disk 8, 128 Mar 20 22:50 /dev/sdi
320613 brw-rw----. 1 root disk 8, 129 Mar 20 22:50 /dev/sdi1
3. read from usb stick
[root@shu ~]# while true; do dd if=/dev/sdh1 of=/dev/null bs=1K count=1 & dd if=/dev/sdi1 of=/dev/null bs=1K count=1 & done
4. run qemu-kvm with "-device usb-host,hostbus=1,hostaddr=4,id=hostdev0 -device usb-host,hostbus=1,hostaddr=5,id=hostdev1"
5. [root@shu ~]# ls -il /dev/sd*
6199 brw-rw----. 1 root disk 8, 0 Mar 20 22:01 /dev/sda
6200 brw-rw----. 1 root disk 8, 1 Mar 20 22:01 /dev/sda1
6201 brw-rw----. 1 root disk 8, 2 Mar 20 22:01 /dev/sda2
6. at this time, dd will report open file error
7. by far all is expected, now let's write to the usb stick, then do 1-6:
[root@shu ~]# ls -il /dev/sd*
6199 brw-rw----. 1 root disk 8, 0 Mar 20 22:01 /dev/sda
6200 brw-rw----. 1 root disk 8, 1 Mar 20 22:01 /dev/sda1
6201 brw-rw----. 1 root disk 8, 2 Mar 20 22:01 /dev/sda2
262062 brw-rw----. 1 root disk 8, 112 Mar 20 22:44 /dev/sdh
262116 brw-rw----. 1 root disk 8, 113 Mar 20 22:47 /dev/sdh1
262171 brw-rw----. 1 root disk 8, 128 Mar 20 22:44 /dev/sdi
262224 brw-rw----. 1 root disk 8, 129 Mar 20 22:47 /dev/sdi1
9. [root@shu ~]# while true; do dd if=/dev/zero of=/dev/sdh1 bs=1K count=1 & dd if=/dev/zero of=/dev/sdi1 bs=1K count=1 & done
10. [root@shu ~]# ls -il /dev/sd*
6199 brw-rw----. 1 root disk 8, 0 Mar 20 22:01 /dev/sda
6200 brw-rw----. 1 root disk 8, 1 Mar 20 22:01 /dev/sda1
6201 brw-rw----. 1 root disk 8, 2 Mar 20 22:01 /dev/sda2
297186 -rw-r--r--. 1 root root 1024 Mar 20 22:47 /dev/sdh1
297151 -rw-r--r--. 1 root root 1024 Mar 20 22:47 /dev/sdi1
11. now, /dev/sdh1 and /dev/sdi1 is reserved, but they are common file, and inode number changes, dd continues to write at this point, no error prompt.
Actual results:
----------------
fdisk -l in guest shows the two usb stick passthroughed, but i am not sure if they can be used correctly, for formatting a 16G usb stick on uchi may take forever.
Expected results:
-----------------
hide /dev/sdh1 and /dev/sdi1, writing to them shows error.
in last comment, between step 9 and 10, should add one more step:
run qemu-kvm with "-device usb-host,hostbus=1,hostaddr=4,id=hostdev0 -device
usb-host,hostbus=1,hostaddr=5,id=hostdev1"
btw, when test this, with uchi only, no ehci.
Everything works perfectly fine. /dev/sdh1 and /dev/sdi1 go away. dd creates a regular file then and writes to it. Add "conv=nocreat" to the dd command line will make dd error out instead, which should fix your testcase.
(In reply to comment #3)
> Everything works perfectly fine. /dev/sdh1 and /dev/sdi1 go away. dd creates
> a regular file then and writes to it. Add "conv=nocreat" to the dd command
> line will make dd error out instead, which should fix your testcase.
Thanks for specifying~