IB/srpt: Avoid that aborting a command triggers a kernel warning
authorBart Van Assche <bart.vanassche@sandisk.com>
Thu, 4 May 2017 22:50:54 +0000 (15:50 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 7 May 2017 23:11:26 +0000 (16:11 -0700)
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>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/infiniband/ulp/srpt/ib_srpt.c

index 36d15da7a395bc4138a94da291119deb035700b7..ee026b6b4f0de99b16e158e10d1e77f791c479f6 100644 (file)
@@ -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);