diff mbox

[12/19] IB/srpt: Fix handling of command / TMF submission failure

Message ID 20170504225102.8931-13-bart.vanassche@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bart Van Assche May 4, 2017, 10:50 p.m. UTC
If submitting an SRP IU to the target core fails, send the SCSI
response "BUSY" to the initiator instead of not sending any
response. If submitting a TMF to the target core fails, send
the "FUNCTION REJECTED" response to the initiator.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Hannes Reinecke May 5, 2017, 11:18 a.m. UTC | #1
On 05/05/2017 12:50 AM, Bart Van Assche wrote:
> If submitting an SRP IU to the target core fails, send the SCSI
> response "BUSY" to the initiator instead of not sending any
> response. If submitting a TMF to the target core fails, send
> the "FUNCTION REJECTED" response to the initiator.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Andy Grover <agrover@redhat.com>
> Cc: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
Nicholas A. Bellinger May 7, 2017, 11:14 p.m. UTC | #2
On Thu, 2017-05-04 at 15:50 -0700, Bart Van Assche wrote:
> If submitting an SRP IU to the target core fails, send the SCSI
> response "BUSY" to the initiator instead of not sending any
> response. If submitting a TMF to the target core fails, send
> the "FUNCTION REJECTED" response to the initiator.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Andy Grover <agrover@redhat.com>
> Cc: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index ee026b6b4f0d..317534cd2a64 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -1376,7 +1376,7 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch,
>  			pr_err("0x%llx: parsing SRP descriptor table failed.\n",
>  			       srp_cmd->tag);
>  		}
> -		goto release_ioctx;
> +		goto busy;
>  	}
>  
>  	rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb,
> @@ -1387,13 +1387,12 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch,
>  	if (rc != 0) {
>  		pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc,
>  			 srp_cmd->tag);
> -		goto release_ioctx;
> +		goto busy;
>  	}
>  	return;
>  
> -release_ioctx:
> -	send_ioctx->state = SRPT_STATE_DONE;
> -	srpt_release_cmd(cmd);
> +busy:
> +	target_send_busy(cmd);
>  }
>  
>  static int srp_tmr_to_tcm(int fn)
> @@ -1450,11 +1449,9 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
>  			       TARGET_SCF_ACK_KREF);
>  	if (rc != 0) {
>  		send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;
> -		goto fail;
> +		cmd->se_tfo->queue_tm_rsp(cmd);
>  	}
>  	return;
> -fail:
> -	transport_send_check_condition_and_sense(cmd, 0, 0); // XXX:
>  }
>  
>  /**

Ignoring for now, because it depends upon functionality that doesn't
exist as a standalone bug-fix (target_send_busy).

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

Patch

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index ee026b6b4f0d..317534cd2a64 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1376,7 +1376,7 @@  static void srpt_handle_cmd(struct srpt_rdma_ch *ch,
 			pr_err("0x%llx: parsing SRP descriptor table failed.\n",
 			       srp_cmd->tag);
 		}
-		goto release_ioctx;
+		goto busy;
 	}
 
 	rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb,
@@ -1387,13 +1387,12 @@  static void srpt_handle_cmd(struct srpt_rdma_ch *ch,
 	if (rc != 0) {
 		pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc,
 			 srp_cmd->tag);
-		goto release_ioctx;
+		goto busy;
 	}
 	return;
 
-release_ioctx:
-	send_ioctx->state = SRPT_STATE_DONE;
-	srpt_release_cmd(cmd);
+busy:
+	target_send_busy(cmd);
 }
 
 static int srp_tmr_to_tcm(int fn)
@@ -1450,11 +1449,9 @@  static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
 			       TARGET_SCF_ACK_KREF);
 	if (rc != 0) {
 		send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;
-		goto fail;
+		cmd->se_tfo->queue_tm_rsp(cmd);
 	}
 	return;
-fail:
-	transport_send_check_condition_and_sense(cmd, 0, 0); // XXX:
 }
 
 /**