[PATCH 3.18 002/121] IB/srpt: Fix abort handling

2018-04-11 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Bart Van Assche 


[ Upstream commit 55d694275f41a1c0eef4ef49044ff29bc3999490 ]

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 
Reviewed-by: Hannes Reinecke 
Cc: Doug Ledford 
Cc: Christoph Hellwig 
Cc: Andy Grover 
Cc: David Disseldorp 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2986,12 +2986,8 @@ static void srpt_queue_response(struct s
}
spin_unlock_irqrestore(>spinlock, flags);
 
-   if (unlikely(transport_check_aborted_status(>cmd, false)
-|| WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) {
-   atomic_inc(>req_lim_delta);
-   srpt_abort_cmd(ioctx);
+   if (unlikely(WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT)))
return;
-   }
 
dir = ioctx->cmd.data_direction;
 




[PATCH 3.18 002/121] IB/srpt: Fix abort handling

2018-04-11 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Bart Van Assche 


[ Upstream commit 55d694275f41a1c0eef4ef49044ff29bc3999490 ]

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 
Reviewed-by: Hannes Reinecke 
Cc: Doug Ledford 
Cc: Christoph Hellwig 
Cc: Andy Grover 
Cc: David Disseldorp 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2986,12 +2986,8 @@ static void srpt_queue_response(struct s
}
spin_unlock_irqrestore(>spinlock, flags);
 
-   if (unlikely(transport_check_aborted_status(>cmd, false)
-|| WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) {
-   atomic_inc(>req_lim_delta);
-   srpt_abort_cmd(ioctx);
+   if (unlikely(WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT)))
return;
-   }
 
dir = ioctx->cmd.data_direction;