[10/19] IB/srpt: Fix abort handling
diff mbox

Message ID 20170504225102.8931-11-bart.vanassche@sandisk.com
State New, archived
Headers show

Commit Message

Bart Van Assche May 4, 2017, 10:50 p.m. UTC
Let the target core check the CMD_T_ABORTED flag instead of the SRP
target driver. Hence remove the transport_check_aborted_status()
call. Since state == SRPT_STATE_CMD_RSP_SENT is something that really
should not happen, do not try to recover if srpt_queue_response() is
called for an I/O context that is in that state. This patch is a bug
fix because the srpt_abort_cmd() call is misplaced - if that function
is called from srpt_queue_response() it should either be called
before the command state is changed or after the response has been
sent.

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 | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Hannes Reinecke May 5, 2017, 11:17 a.m. UTC | #1
On 05/05/2017 12:50 AM, Bart Van Assche wrote:
> Let the target core check the CMD_T_ABORTED flag instead of the SRP
> target driver. Hence remove the transport_check_aborted_status()
> call. Since state == SRPT_STATE_CMD_RSP_SENT is something that really
> should not happen, do not try to recover if srpt_queue_response() is
> called for an I/O context that is in that state. This patch is a bug
> fix because the srpt_abort_cmd() call is misplaced - if that function
> is called from srpt_queue_response() it should either be called
> before the command state is changed or after the response has been
> sent.
> 
> 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 | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
Nicholas A. Bellinger May 7, 2017, 11:11 p.m. UTC | #2
On Thu, 2017-05-04 at 15:50 -0700, Bart Van Assche wrote:
> Let the target core check the CMD_T_ABORTED flag instead of the SRP
> target driver. Hence remove the transport_check_aborted_status()
> call. Since state == SRPT_STATE_CMD_RSP_SENT is something that really
> should not happen, do not try to recover if srpt_queue_response() is
> called for an I/O context that is in that state. This patch is a bug
> fix because the srpt_abort_cmd() call is misplaced - if that function
> is called from srpt_queue_response() it should either be called
> before the command state is changed or after the response has been
> sent.
> 
> 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 | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Applied.

--
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

Patch
diff mbox

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 7e314c2f2071..36d15da7a395 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2302,12 +2302,8 @@  static void srpt_queue_response(struct se_cmd *cmd)
 	}
 	spin_unlock_irqrestore(&ioctx->spinlock, flags);
 
-	if (unlikely(transport_check_aborted_status(&ioctx->cmd, false)
-		     || WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) {
-		atomic_inc(&ch->req_lim_delta);
-		srpt_abort_cmd(ioctx);
+	if (unlikely(WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT)))
 		return;
-	}
 
 	/* For read commands, transfer the data to the initiator. */
 	if (ioctx->cmd.data_direction == DMA_FROM_DEVICE &&