On Wed, 2007-01-17 at 11:34 +0900, Tejun Heo wrote: > libata didn't used to init qc->dma_dir to any specific value on qc > initialization and command translation path didn't set qc->dma_dir if > the command doesn't need data transfer. This made non-data commands > to have random qc->dma_dir. > > This usually doesn't cause problem because LLDs usually check > qc->protocol first and look at qc->dma_dir iff the command needs data > transfer but this doesn't hold for all LLDs. > > It might be worthwhile to rename qc->dma_dir to qc->data_dir as we use > the field to tag data direction for both PIO and DMA protocols. > > This problem has been spotted by James Bottomley. > > Signed-off-by: Tejun Heo <htejun@xxxxxxxxx> > Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxx> This looks perfectly fine as a possible solution. Is there any reason not to initialise qc->dma_dir unconditionally from the SCSI command? The only potential problem is DMA_BIDIRECTIONAL, which we don't use (yet) ... but if it ever did come down libata will do the wrong thing anyway. James - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html