Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753651Ab3HVFKm (ORCPT ); Thu, 22 Aug 2013 01:10:42 -0400 Received: from mail-oa0-f50.google.com ([209.85.219.50]:57249 "EHLO mail-oa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753578Ab3HVFK3 (ORCPT ); Thu, 22 Aug 2013 01:10:29 -0400 From: "Nicholas A. Bellinger" To: target-devel Cc: lkml , linux-scsi , Christoph Hellwig , Hannes Reinecke , Martin Petersen , Chris Mason , Roland Dreier , James Bottomley , Nicholas Bellinger , Nicholas Bellinger Subject: [PATCH-v2 11/12] target: Add compare_and_write_post() completion callback fall through Date: Thu, 22 Aug 2013 04:54:09 +0000 Message-Id: <1377147250-10125-12-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1377147250-10125-1-git-send-email-nab@daterainc.com> References: <1377147250-10125-1-git-send-email-nab@daterainc.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2688 Lines: 77 From: Nicholas Bellinger 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 Cc: Hannes Reinecke Cc: Martin Petersen Cc: Chris Mason Cc: James Bottomley Cc: Nicholas Bellinger Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_sbc.c | 3 ++- drivers/target/target_core_transport.c | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 4076828..bb1b42b 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -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, diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index dc39f1f..a95e799 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1910,17 +1910,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) { -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/