From: Nicholas Bellinger <n...@daterainc.com>

Add a special case for COMPARE_AND_WRITE for the reverse data direction
mapping used for pci_map_sg() + friends.

Cc: Christoph Hellwig <h...@lst.de>
Cc: Giridhar Malavali <giridhar.malav...@qlogic.com>
Cc: Chad Dupuis <chad.dup...@qlogic.com>
Cc: Hannes Reinecke <h...@suse.de>
Cc: Martin Petersen <martin.peter...@oracle.com>
Cc: Chris Mason <chris.ma...@fusionio.com>
Cc: James Bottomley <jbottom...@parallels.com>
Signed-off-by: Nicholas Bellinger <n...@daterainc.com>
---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c 
b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 6a93a91..4e20d51 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -508,8 +508,13 @@ static u32 tcm_qla2xxx_sess_get_index(struct se_session 
*se_sess)
  */
 static enum dma_data_direction tcm_qla2xxx_mapping_dir(struct se_cmd *se_cmd)
 {
-       if (se_cmd->se_cmd_flags & SCF_BIDI)
-               return DMA_BIDIRECTIONAL;
+       if (se_cmd->se_cmd_flags & SCF_BIDI) {
+               /*
+                * Special fall-through case for COMPARE_AND_WRITE
+                */
+               if (se_cmd->t_task_cdb[0] != COMPARE_AND_WRITE)
+                       return DMA_BIDIRECTIONAL;
+       }
 
        switch (se_cmd->data_direction) {
        case DMA_TO_DEVICE:
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to