]> Pileus Git - ~andy/linux/commitdiff
target: Add compare_and_write_post() completion callback fall through
authorNicholas Bellinger <nab@daterainc.com>
Thu, 22 Aug 2013 01:10:04 +0000 (18:10 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 10 Sep 2013 23:45:13 +0000 (16:45 -0700)
This patch changes target_complete_ok_work() to fall through
after calling the se_cmd->transport_complete_callback() ->
compare_and_write_post() callback, by keying off the existance
of SCF_COMPARE_AND_WRITE_POST.

This is necessary because once SCF_COMPARE_AND_WRITE_POST has
been set by compare_and_write_post(), the SCSI response needs
to be sent via TFO->queue_status().

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Chris Mason <chris.mason@fusionio.com>
Cc: James Bottomley <JBottomley@Parallels.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@daterainc.com>
drivers/target/target_core_sbc.c
drivers/target/target_core_transport.c

index dfb6603eab4d2a89ec59c7d2418ed1c2d03b9b1f..5c822fdc8f6f5eb346e3873ed0fc6df5f983666e 100644 (file)
@@ -375,7 +375,8 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
        buf = kzalloc(cmd->data_length, GFP_KERNEL);
        if (!buf) {
                pr_err("Unable to allocate compare_and_write buf\n");
-               return TCM_OUT_OF_RESOURCES;
+               ret = TCM_OUT_OF_RESOURCES;
+               goto out;
        }
 
        write_sg = kzalloc(sizeof(struct scatterlist) * cmd->t_data_nents,
index 672cb37a43c5b5dcb29088cf58f762ebb35854fe..e53c59ba745aa18c77230ba02b4e414be705e722 100644 (file)
@@ -1909,17 +1909,18 @@ static void target_complete_ok_work(struct work_struct *work)
                sense_reason_t rc;
 
                rc = cmd->transport_complete_callback(cmd);
-               if (!rc)
+               if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
                        return;
+               } else if (rc) {
+                       ret = transport_send_check_condition_and_sense(cmd,
+                                               rc, 0);
+                       if (ret == -EAGAIN || ret == -ENOMEM)
+                               goto queue_full;
 
-               ret = transport_send_check_condition_and_sense(cmd,
-                                       rc, 0);
-               if (ret == -EAGAIN || ret == -ENOMEM)
-                       goto queue_full;
-
-               transport_lun_remove_cmd(cmd);
-               transport_cmd_check_stop_to_fabric(cmd);
-               return;
+                       transport_lun_remove_cmd(cmd);
+                       transport_cmd_check_stop_to_fabric(cmd);
+                       return;
+               }
        }
 
        switch (cmd->data_direction) {