diff mbox

[11/19] IB/srpt: Avoid that aborting a command triggers a kernel warning

Message ID 20170504225102.8931-12-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
Avoid that the following warning is triggered:

WARNING: CPU: 10 PID: 166 at ../drivers/infiniband/ulp/srpt/ib_srpt.c:2674 srpt_release_cmd+0x139/0x140 [ib_srpt]
CPU: 10 PID: 166 Comm: kworker/u24:8 Not tainted 4.9.4-1-default #1
Workqueue: tmr-fileio target_tmr_work [target_core_mod]
Call Trace:
 [<ffffffffaa3c4f70>] dump_stack+0x63/0x83
 [<ffffffffaa0844eb>] __warn+0xcb/0xf0
 [<ffffffffaa0845dd>] warn_slowpath_null+0x1d/0x20
 [<ffffffffc06ba429>] srpt_release_cmd+0x139/0x140 [ib_srpt]
 [<ffffffffc06e4377>] target_release_cmd_kref+0xb7/0x120 [target_core_mod]
 [<ffffffffc06e4d7f>] target_put_sess_cmd+0x2f/0x60 [target_core_mod]
 [<ffffffffc06e15e0>] core_tmr_lun_reset+0x340/0x790 [target_core_mod]
 [<ffffffffc06e4816>] target_tmr_work+0xe6/0x140 [target_core_mod]
 [<ffffffffaa09e4d3>] process_one_work+0x1f3/0x4d0
 [<ffffffffaa09e7f8>] worker_thread+0x48/0x4e0
 [<ffffffffaa09e7b0>] ? process_one_work+0x4d0/0x4d0
 [<ffffffffaa0a46da>] kthread+0xca/0xe0
 [<ffffffffaa0a4610>] ? kthread_park+0x60/0x60
 [<ffffffffaa71b775>] ret_from_fork+0x25/0x30

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: David Disseldorp <ddiss@suse.de>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Hannes Reinecke May 5, 2017, 11:17 a.m. UTC | #1
On 05/05/2017 12:50 AM, Bart Van Assche wrote:
> Avoid that the following warning is triggered:
> 
> WARNING: CPU: 10 PID: 166 at ../drivers/infiniband/ulp/srpt/ib_srpt.c:2674 srpt_release_cmd+0x139/0x140 [ib_srpt]
> CPU: 10 PID: 166 Comm: kworker/u24:8 Not tainted 4.9.4-1-default #1
> Workqueue: tmr-fileio target_tmr_work [target_core_mod]
> Call Trace:
>  [<ffffffffaa3c4f70>] dump_stack+0x63/0x83
>  [<ffffffffaa0844eb>] __warn+0xcb/0xf0
>  [<ffffffffaa0845dd>] warn_slowpath_null+0x1d/0x20
>  [<ffffffffc06ba429>] srpt_release_cmd+0x139/0x140 [ib_srpt]
>  [<ffffffffc06e4377>] target_release_cmd_kref+0xb7/0x120 [target_core_mod]
>  [<ffffffffc06e4d7f>] target_put_sess_cmd+0x2f/0x60 [target_core_mod]
>  [<ffffffffc06e15e0>] core_tmr_lun_reset+0x340/0x790 [target_core_mod]
>  [<ffffffffc06e4816>] target_tmr_work+0xe6/0x140 [target_core_mod]
>  [<ffffffffaa09e4d3>] process_one_work+0x1f3/0x4d0
>  [<ffffffffaa09e7f8>] worker_thread+0x48/0x4e0
>  [<ffffffffaa09e7b0>] ? process_one_work+0x4d0/0x4d0
>  [<ffffffffaa0a46da>] kthread+0xca/0xe0
>  [<ffffffffaa0a4610>] ? kthread_park+0x60/0x60
>  [<ffffffffaa71b775>] ret_from_fork+0x25/0x30
> 
> 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: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
Nicholas A. Bellinger May 7, 2017, 11:12 p.m. UTC | #2
On Thu, 2017-05-04 at 15:50 -0700, Bart Van Assche wrote:
> Avoid that the following warning is triggered:
> 
> WARNING: CPU: 10 PID: 166 at ../drivers/infiniband/ulp/srpt/ib_srpt.c:2674 srpt_release_cmd+0x139/0x140 [ib_srpt]
> CPU: 10 PID: 166 Comm: kworker/u24:8 Not tainted 4.9.4-1-default #1
> Workqueue: tmr-fileio target_tmr_work [target_core_mod]
> Call Trace:
>  [<ffffffffaa3c4f70>] dump_stack+0x63/0x83
>  [<ffffffffaa0844eb>] __warn+0xcb/0xf0
>  [<ffffffffaa0845dd>] warn_slowpath_null+0x1d/0x20
>  [<ffffffffc06ba429>] srpt_release_cmd+0x139/0x140 [ib_srpt]
>  [<ffffffffc06e4377>] target_release_cmd_kref+0xb7/0x120 [target_core_mod]
>  [<ffffffffc06e4d7f>] target_put_sess_cmd+0x2f/0x60 [target_core_mod]
>  [<ffffffffc06e15e0>] core_tmr_lun_reset+0x340/0x790 [target_core_mod]
>  [<ffffffffc06e4816>] target_tmr_work+0xe6/0x140 [target_core_mod]
>  [<ffffffffaa09e4d3>] process_one_work+0x1f3/0x4d0
>  [<ffffffffaa09e7f8>] worker_thread+0x48/0x4e0
>  [<ffffffffaa09e7b0>] ? process_one_work+0x4d0/0x4d0
>  [<ffffffffaa0a46da>] kthread+0xca/0xe0
>  [<ffffffffaa0a4610>] ? kthread_park+0x60/0x60
>  [<ffffffffaa71b775>] ret_from_fork+0x25/0x30
> 
> 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: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

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

Patch

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 36d15da7a395..ee026b6b4f0d 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2685,7 +2685,8 @@  static void srpt_release_cmd(struct se_cmd *se_cmd)
 	struct srpt_rdma_ch *ch = ioctx->ch;
 	unsigned long flags;
 
-	WARN_ON(ioctx->state != SRPT_STATE_DONE);
+	WARN_ON_ONCE(ioctx->state != SRPT_STATE_DONE &&
+		     !(ioctx->cmd.transport_state & CMD_T_ABORTED));
 
 	if (ioctx->n_rw_ctx) {
 		srpt_free_rw_ctxs(ch, ioctx);