[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 26/27] scsi-disk: Don't use empty string as device id
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 26/27] scsi-disk: Don't use empty string as device id |
Date: |
Fri, 1 Feb 2019 17:35:17 +0100 |
scsi-disk includes in the Device Identification VPD page, depending on
configuration amongst others, a vendor specific designator that consists
either of the serial number if given or the BlockBackend name (which is
a host detail that better shouldn't have been leaked to the guest, but
now we have to maintain it for compatibility).
With anonymous BlockBackends, i.e. scsi-disk devices constructed with
drive=<node-name>, and no serial number explicitly specified, this ends
up as an empty string. If this happens to more than one disk, we have
accidentally signalled to the OS that this is a multipath setup, which
is obviously not what was intended.
Instead of using an empty string for the vendor specific designator,
simply leave out that designator, which makes Linux detect such setups
as separate disks again.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/scsi/scsi-disk.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index b049026219..11392a8db8 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -652,12 +652,14 @@ static int scsi_disk_emulate_vpd_page(SCSIRequest *req,
uint8_t *outbuf)
DPRINTF("Inquiry EVPD[Device identification] "
"buffer size %zd\n", req->cmd.xfer);
- outbuf[buflen++] = 0x2; /* ASCII */
- outbuf[buflen++] = 0; /* not officially assigned */
- outbuf[buflen++] = 0; /* reserved */
- outbuf[buflen++] = id_len; /* length of data following */
- memcpy(outbuf + buflen, str, id_len);
- buflen += id_len;
+ if (id_len) {
+ outbuf[buflen++] = 0x2; /* ASCII */
+ outbuf[buflen++] = 0; /* not officially assigned */
+ outbuf[buflen++] = 0; /* reserved */
+ outbuf[buflen++] = id_len; /* length of data following */
+ memcpy(outbuf + buflen, str, id_len);
+ buflen += id_len;
+ }
if (s->qdev.wwn) {
outbuf[buflen++] = 0x1; /* Binary */
--
2.20.1
- [Qemu-block] [PULL 13/27] block/vpc: Don't take address of fields in packed structs, (continued)
- [Qemu-block] [PULL 13/27] block/vpc: Don't take address of fields in packed structs, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 23/27] iotests/236: fix transaction kwarg order, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 24/27] block: Fix invalidate_cache error path for parent activation, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 03/27] qcow2: Assert that refcount block offsets fit in the refcount table, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 07/27] iotests: Make 234 stable, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 08/27] vmdk: Refactor vmdk_create_extent, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 15/27] uuid: Make qemu_uuid_bswap() take and return a QemuUUID, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 21/27] virtio-scsi: Forbid devices with different iothreads sharing a blockdev, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 09/27] vmdk: Implement .bdrv_co_create callback, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 27/27] scsi-disk: Add device_id property, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 26/27] scsi-disk: Don't use empty string as device id,
Kevin Wolf <=
- [Qemu-block] [PULL 25/27] qtest.py: Wait for the result of qtest commands, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 18/27] block: Eliminate the S_1KiB, S_2KiB, ... macros, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 14/27] block/vdi: Don't take address of fields in packed structs, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 19/27] virtio-scsi: Move BlockBackend back to the main AioContext on unplug, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 22/27] iotests: Filter second BLOCK_JOB_ERROR from 229, Kevin Wolf, 2019/02/01
- [Qemu-block] [PULL 04/27] qemu-iotests: add test case for dmg, Kevin Wolf, 2019/02/01
- Re: [Qemu-block] [Qemu-devel] [PULL 00/27] Block layer patches, no-reply, 2019/02/01
- Re: [Qemu-block] [Qemu-devel] [PULL 00/27] Block layer patches, no-reply, 2019/02/01
- Re: [Qemu-block] [Qemu-devel] [PULL 00/27] Block layer patches, no-reply, 2019/02/01
- Re: [Qemu-block] [PULL 00/27] Block layer patches, Peter Maydell, 2019/02/01