Bug 1410964 - 4K virtual drives broken on Windows
Summary: 4K virtual drives broken on Windows
Alias: None
Product: Virtualization Tools
Classification: Community
Component: virtio-win
Version: unspecified
Hardware: All
OS: Windows
Target Milestone: ---
Assignee: Vadim Rozenfeld
QA Contact: Virtualization Bugs
Depends On:
Blocks: 1411092
TreeView+ depends on / blocked
Reported: 2017-01-07 00:22 UTC by Angel
Modified: 2019-03-28 23:56 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1411092 (view as bug list)
Last Closed: 2019-03-28 23:56:44 UTC

Attachments (Terms of Use)

Description Angel 2017-01-07 00:22:51 UTC
Description of problem: 
4K virtual drives broken on Windows with virtio-win-0.1-104 and greater. Versions previous to virtio-winl-0.1-104 work fine.

Version-Release number of selected component (if applicable):
4K virtual drives fail to format on Windows with virtio-winl-0.1-104 and greater. Versions previous to virtio-winl-0.1-104 work fine.

How reproducible:
Configure a 4K sector virtio virtual data disk and attempt to format it in any windows guest that supports 4K sector data disks i.e W2K12R2, Windows 10.

Steps to Reproduce:
1. Specify virtual disk as 4K logical and physical sector size in XML
2. Start windows guest
3. Attempt to use the 4K sector disk by first formatting it.

Actual results:
Format fails on 4K sector drives.

Expected results:
Format 4K drives.

Additional info:
The problem is viostor stores the wrong value in the driver extension for the last lba. The driver returns the correct value for last LBA in the read capacity request but inappropriately uses this same value in I/O request bounds checking. As a result, windows fails in formating 4K sector drives. 

qemu info:
2017-01-04 19:41:55.201+0000: starting up libvirt version: 2.0.0, package: 10.el7_3.2 (CentOS BuildSystem <http://bugs.centos.org>, 2016-12-06-19:53:38, c1bm.rdu2.centos.org), qemu version: 1.5.3 (qemu-kvm-1.5.3-126.el7), hostname: xxx
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name b2win -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -cpu Broadwell,+rtm,+hle,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff -m 4096 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 78c1e479-d1a6-46a2-8828-d0fc8c570d3d -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-9-b2win/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -drive file=/mnt/vgsdb/b2_boot/b2w_boot.img,format=raw,if=none,id=drive-ide0-0-0 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive if=none,id=drive-ide0-0-1,readonly=on -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -drive file=/mnt/vgsdb/b2w_data/b2w_data.img,format=raw,if=none,id=drive-virtio-disk1 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1,logical_block_size=4096,physical_block_size=4096 -netdev tap,fd=27,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:d6:f3:59,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0,bus=usb.0,port=1 -vnc -vga std -global VGA.vgamem_mb=16 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 -msg timestamp=on
char device redirected to /dev/pts/2 (label charserial0)

Comment 1 lijin 2017-01-09 09:37:51 UTC
QE tried on win8-32 and win2012R2 guests,can NOT reproduce this issue on virtio-win-1.9.0-3.el7.noarch(the blk driver is build126),I can format the data disks correctly.

Could you try with build126?

qemu cli:
/usr/libexec/qemu-kvm -name 122BLKWIN2016 -enable-kvm -m 2G -nodefconfig -nodefaults -rtc base=localtime,driftfix=slew -boot order=cd,menu=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=win8-32-iso.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,serial=mike_cao,cache=none -device ide-drive,drive=drive-ide0-0-0,id=ide0-0-0 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=isa_serial0 -cdrom virtio-win-prewhql-126.iso -monitor stdio -qmp tcp:0:4444,server,nowait -fda virtio-win-prewhql-126.vfd -vnc -vga cirrus -netdev tap,script=/etc/qemu-ifup,downscript=no,id=hostnet0,queues=4,vhost=on -device virtio-net-pci,vectors=10,netdev=hostnet0,id=net0,mac=00:52:4c:23:8d:66,mq=off,ctrl_vq=on -smp 2 -drive file=disk1.raw,id=blk-drive1,if=none,cache=none,serial=lijin-disk1 -device virtio-blk-pci,id=blk-disk1,drive=blk-drive1,logical_block_size=4096,physical_block_size=4096 -drive file=disk2.raw,id=blk-drive2,if=none,cache=none,serial=lijin-disk2 -device virtio-blk-pci,id=blk-disk2,drive=blk-drive2,logical_block_size=4096,physical_block_size=4096

Comment 2 Angel 2017-01-09 15:51:55 UTC
We currently use virtio-win-0.1.96-1 and know it works with 4K drives. We were considering using build126 when we discovered the problem. Build126 will not work with 4K drives.


Comment 3 lijin 2017-01-10 06:35:55 UTC
(In reply to Angel from comment #2)
> We currently use virtio-win-0.1.96-1 and know it works with 4K drives. We
> were considering using build126 when we discovered the problem. Build126
> will not work with 4K drives.

I can reproduce your issue on a *new fresh installed* image,with build126,the disk can NOT format completely.

If downgrade the driver to build100,then upgrade to 126 again,the disk can be format successfully,I guess this is the reason why I did not reproduce in comment#1.

Thanks Angel.

Comment 4 lijin 2017-01-16 08:24:55 UTC
Try on win2012R2 guest with virtio-win-prewhql-130,disks can be formatted correctly with 4k logical_block_size.

So this issue has been fixed already

Comment 5 lijin 2017-08-17 07:42:47 UTC
change status to verified according to comment#4

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