Gerd Hoffmann wrote: > Hi, > >>> Answering large requests with "Illegal request, Invalid field in CDB" >>> doesn't makes linux try smaller requests, instead it reports I/O errors >>> to the syslog. >>> >>> Hmm. >>> >> Can't we just put residuals to good use here? >> Ie finish up the request up to the size we can handle, and return the >> original request with the transfer size set correctly. > > I'll try. > >> Should be straightforward to implement, one would assume. > > The infrastructure and the HBAs have to handle that already. It > frequently happens with MODE SENSE for example (guest passing a 256 byte > buffer and we have less data to fill in). So it should be easy. > >> And we could probably encapsulate it entirely within the bdrv >> as don't actually need to expose those limits when the block >> driver layer is handling it correctly. > > Hmm, I don't think so. SG_IO just returns EINVAL. > Yes, but we can hook into scsi_generic_map() to cap the resulting iovec to the limits of the underlying block device. Then we submit an iovec which matches the capabilities of the underlying device. Of course we should take care to update the resulting xferlen values to match the actualy submitted data, but that should be easily done.
Then the guest would see a partial request and retry the remainder of the request, which (possibly after some iterations) would result in all data transferred, albeit at a lower speed. Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg)