New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
virtio-scsi with lio/vhost: strange block device size and LUKS problems #446
Comments
|
Hi Andreas, Best, |
|
I attached the output below. However, I cannot see why any alignment should make a difference on the physical (not logical) windows drive? I did more tests. The sector count (122865120) remains exactly the same even if you use qemu-sata (userland emu in qemu), qemu-virtio-scsi (userland emu in qemu) or LIO/vhost. So the reduced sector count has nothing to do with LIO/vhost or virtio-scsi. Windows is 1809 on amd64. |
|
So the bug that really blocks me is with LUKS. Why is it not working over LIO/vhost? |
|
Can you check Windows Event Log and see if there is any error reported by disk subsystem? Vadim. |
|
Using some help from the target-devel mailing list, I was able to track down the root cause. It is the following code in dm-crypt: https://elixir.bootlin.com/linux/v5.3.18/source/drivers/md/dm-crypt.c#L1251 It says that BIOs have to be aligned, which is not true for some SCSI commands coming from the virtio-scsi Windows driver. I clearly proved that by adding some debug code to the kernel. So I think the first question is: Do BIOs have to be aligned? Is that the spec of them? |
|
Hi, Reproduce steps:
root@dell-per440-05 /home/kar # fdisk -l -u /dev/sdf
Best Regards~ |
|
Hi, I ran into the same issue as what is reported here. I will give a more detailed steps on how to reproduce and what the root cause for the IO failures.
A new block device, /dev/mapper/testcrypt would be available for applications to use encrypted disk.
[root@ca-nfsdev4 debug]# targetcli ls
Jun 11 09:51:59 localhost kernel: bio error: ffff990b443e7100, err: 10
static int crypt_convert_block_skcipher(struct crypt_config *cc, } static int crypt_convert_block_aead(struct crypt_config *cc, }
If windows virtio driver ensures that the individual scatter gather buffers are multiples of sector size, then this issue would be resolved. Let me know if there are any debugging required on the vhost side in Linux. Thanks |
|
To isolate this problem further, I ran similar test but with iSCSI transport. That is, windows 2010 runs a iSCSI initiator to connect to a iSCSI target that is backed by dm-crypt block device. In this case, the format completed successfully. This could suggest that the windows SCSI stack might be fine in terms of how the sg buffers are constructed. The issue could be with either windows virtio driver or with vhost driver. |
|
@ssudhakarp |
Thanks |
|
Hi @ssudhakarp , I want to reproduce this issue with your provide steps, but I hit some problems. I tried to load tcm_vhost module, but it's failed, error as follows: Could you help to have a look? I used versions: Thanks in advance!! |
|
I've similar issue: Your kernel is probably too old @peixiu |
|
This are commands I used to create this, my LV is on top of dm-crypt. |
|
Hi JuniorJPDJ, I found the /vhost option when test with kernel-5.11.0-1.el9.x86_64 and qemu-kvm-5.2.0-7.el9.x86_64, thank you~ [root@ibm-x3250m6-06 home]# targetcli /vhost create Thanks a lot~ |
|
It's purely software, no additional hardware needed if virtualization is supported on host. |
|
Hi all, I reproduced this issue with kernel-5.9.16-200.fc33.x86_64 and qemu-kvm-5.1.0-8.fc33.x86_64, I tested on my laptop os.
For 1) test, detail steps as follows:
/usr/bin/qemu-kvm
|

I am using virtio-scsi (0.1.171-1) with the LIO/vhost backend. That works great with Linux and with Windows in normal cases. With normal I mean that targetcli has an iblock object for lets say /dev/sdc7 and a vhost target with a lun that references the iblock object.
However, on Windows the disk size differs from what Linux says about /dev/sdc7.
Windows:
So for some reason the physical disk in Windows has less sectors than the Linux device? Do you know what is going on here?
When I then want to use LUKS/cryptsetup and create a /dev/mapper/crypt and pass that as iblock I cannot even format that disk using Windows (works perfectly with Linux as a qemu guest).
With Windows I get tons of errors in the host dmesg:
Any idea about that?
Regards Andreas
The text was updated successfully, but these errors were encountered: