Tejun Heo wrote: > For misc ATAPI commands which transfer variable length data to the > host, overflow can occur due to application or hardware bug. Such > overflows can be ignored safely as long as overflow data is properly > drained. libata HSM implementation has this implemented in > __atapi_pio_bytes() but it isn't enough. Improve drain logic such > that... > > * Multiple PIO data phases are allowed. Not allowing this used to be > okay when transfer chunk size was set to 8k unconditionally but with > transfer hcunk size set to allocation size, treating extra PIO data > phases as HSM violations cause a lot of trouble. > > * Limit the amount of draining to ATAPI_MAX_DRAIN (16k currently). > > * Don't whine if overflow is allowed and safe. When unexpected > overflow occurs, trigger HSM violation and report the problem using > ehi error description. > > * Properly calculate the number of bytes to be drained considering > actual number of consumed bytes for partial draining. > > * Add and use ata_drain_page for draining. This change fixes the > problem where LLDs which do 32bit IOs consumes 4 bytes on each 2 > byte draining resulting in draining twice more data than requested. > > This patch fixes ATAPI regressions introduced by setting transfer > chunk size to allocation size. > > Signed-off-by: Tejun Heo <htejun@xxxxxxxxx> > Cc: Albert Lee <albertcc@xxxxxxxxxx> Acked-by: Albert Lee <albertcc@xxxxxxxxxx> - To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html