Hide Forgot
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~