Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2890087 authored by Nicholas Bellinger's avatar Nicholas Bellinger Committed by Nicholas Bellinger
Browse files

target: Add compare_and_write_post() completion callback fall through



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: default avatarNicholas Bellinger <nab@daterainc.com>
parent 68ff9b9b
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -375,7 +375,8 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
	buf = kzalloc(cmd->data_length, GFP_KERNEL);
	buf = kzalloc(cmd->data_length, GFP_KERNEL);
	if (!buf) {
	if (!buf) {
		pr_err("Unable to allocate compare_and_write buf\n");
		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,
	write_sg = kzalloc(sizeof(struct scatterlist) * cmd->t_data_nents,
+10 −9
Original line number Original line Diff line number Diff line
@@ -1909,9 +1909,9 @@ static void target_complete_ok_work(struct work_struct *work)
		sense_reason_t rc;
		sense_reason_t rc;


		rc = cmd->transport_complete_callback(cmd);
		rc = cmd->transport_complete_callback(cmd);
		if (!rc)
		if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
			return;
			return;

		} else if (rc) {
			ret = transport_send_check_condition_and_sense(cmd,
			ret = transport_send_check_condition_and_sense(cmd,
						rc, 0);
						rc, 0);
			if (ret == -EAGAIN || ret == -ENOMEM)
			if (ret == -EAGAIN || ret == -ENOMEM)
@@ -1921,6 +1921,7 @@ static void target_complete_ok_work(struct work_struct *work)
			transport_cmd_check_stop_to_fabric(cmd);
			transport_cmd_check_stop_to_fabric(cmd);
			return;
			return;
		}
		}
	}


	switch (cmd->data_direction) {
	switch (cmd->data_direction) {
	case DMA_FROM_DEVICE:
	case DMA_FROM_DEVICE: