On Thu, Dec 12, 2019 at 1:28 AM Paolo Bonzini pbonzini@redhat.com wrote:
On 12/12/19 00:05, Michael S. Tsirkin wrote:
@@ -405,6 +405,9 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
static const struct block_device_operations virtblk_fops = { .ioctl = virtblk_ioctl, +#ifdef CONFIG_COMPAT
- .compat_ioctl = blkdev_compat_ptr_ioctl,
+#endif .owner = THIS_MODULE, .getgeo = virtblk_getgeo, };
Hmm - is virtio blk lumped in with scsi things intentionally?
I think it's because the only ioctl for virtio-blk is SG_IO. It makes sense to lump it in with scsi, but I wouldn't mind getting rid of CONFIG_VIRTIO_BLK_SCSI altogether.
It currently calls scsi_cmd_blk_ioctl(), which implements a bunch of ioctl commands, including some that are unrelated to SG_IO:
case SG_GET_VERSION_NUM: case SCSI_IOCTL_GET_IDLUN: case SCSI_IOCTL_GET_BUS_NUMBER: case SG_SET_TIMEOUT: case SG_GET_TIMEOUT: case SG_GET_RESERVED_SIZE: case SG_SET_RESERVED_SIZE: case SG_EMULATED_HOST: case SG_IO: { case CDROM_SEND_PACKET: case SCSI_IOCTL_SEND_COMMAND: case CDROMCLOSETRAY: case CDROMEJECT:
My patch changes all callers of this function, and the idea is to preserve the existing behavior through my series, so I think it makes sense to keep my patch as is.
I would assume that calling scsi_cmd_blk_ioctl() is harmless here, but if you want to remove it or limit the set of supported commands, that should be independent of my change.
Arnd