From: Doug Ledford <dledford@redhat.com>
To: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: James Bottomley <jbottomley@odin.com>,
Sagi Grimberg <sagig@mellanox.com>,
Sebastian Parschauer <sebastian.riemer@profitbricks.com>,
linux-rdma <linux-rdma@vger.kernel.org>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 04/12] IB/srp: Fix connection state tracking
Date: Thu, 30 Apr 2015 12:08:14 -0400 [thread overview]
Message-ID: <1430410094.102408.71.camel@redhat.com> (raw)
In-Reply-To: <5541EE9F.8090605@sandisk.com>
[-- Attachment #1: Type: text/plain, Size: 4093 bytes --]
On Thu, 2015-04-30 at 10:58 +0200, Bart Van Assche wrote:
> Reception of a DREQ message only causes the state of a single
> channel to change. Modify the SRP initiator such that channel
> and target connection state are tracked separately. This patch
> avoids that following false positive warning can be reported
> by srp_destroy_qp():
>
> WARNING: at drivers/infiniband/ulp/srp/ib_srp.c:617 srp_destroy_qp+0xa6/0x120 [ib_srp]()
> Call Trace:
> [<ffffffff8106e10f>] warn_slowpath_common+0x7f/0xc0
> [<ffffffff8106e16a>] warn_slowpath_null+0x1a/0x20
> [<ffffffffa0440226>] srp_destroy_qp+0xa6/0x120 [ib_srp]
> [<ffffffffa0440322>] srp_free_ch_ib+0x82/0x1e0 [ib_srp]
> [<ffffffffa044408b>] srp_create_target+0x7ab/0x998 [ib_srp]
> [<ffffffff81346f60>] dev_attr_store+0x20/0x30
> [<ffffffff811dd90f>] sysfs_write_file+0xef/0x170
> [<ffffffff8116d248>] vfs_write+0xc8/0x190
> [<ffffffff8116d411>] sys_write+0x51/0x90
>
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
> Cc: <stable@vger.kernel.org> #v3.19
> ---
> drivers/infiniband/ulp/srp/ib_srp.c | 7 ++++---
> drivers/infiniband/ulp/srp/ib_srp.h | 1 +
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 5ce6cfd..0eb07d3 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -465,14 +465,13 @@ static struct srp_fr_pool *srp_alloc_fr_pool(struct srp_target_port *target)
> */
> static void srp_destroy_qp(struct srp_rdma_ch *ch)
> {
> - struct srp_target_port *target = ch->target;
> static struct ib_qp_attr attr = { .qp_state = IB_QPS_ERR };
> static struct ib_recv_wr wr = { .wr_id = SRP_LAST_WR_ID };
> struct ib_recv_wr *bad_wr;
> int ret;
>
> /* Destroying a QP and reusing ch->done is only safe if not connected */
> - WARN_ON_ONCE(target->connected);
> + WARN_ON_ONCE(ch->connected);
>
> ret = ib_modify_qp(ch->qp, &attr, IB_QP_STATE);
> WARN_ONCE(ret, "ib_cm_init_qp_attr() returned %d\n", ret);
> @@ -836,6 +835,7 @@ static void srp_disconnect_target(struct srp_target_port *target)
>
> for (i = 0; i < target->ch_count; i++) {
> ch = &target->ch[i];
> + ch->connected = false;
> if (ch->cm_id && ib_send_cm_dreq(ch->cm_id, NULL, 0)) {
> shost_printk(KERN_DEBUG, target->scsi_host,
> PFX "Sending CM DREQ failed\n");
> @@ -1017,6 +1017,7 @@ static int srp_connect_ch(struct srp_rdma_ch *ch, bool multich)
> switch (ch->status) {
> case 0:
> srp_change_conn_state(target, true);
> + ch->connected = true;
> return 0;
>
> case SRP_PORT_REDIRECT:
> @@ -2367,7 +2368,7 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
> case IB_CM_DREQ_RECEIVED:
> shost_printk(KERN_WARNING, target->scsi_host,
> PFX "DREQ received - connection closed\n");
> - srp_change_conn_state(target, false);
> + ch->connected = false;
So, in this patch, you modify disconnect to set srp_change_conn_state()
to false for the target, then loop through all the channels sending
cm_dreq's, and on the receiving side, you modify the cm_dreq handler to
set each channel to false. However, once you get to 0 channels open,
shouldn't you then set the target state to false too just to keep things
consistent?
> if (ib_send_cm_drep(cm_id, NULL, 0))
> shost_printk(KERN_ERR, target->scsi_host,
> PFX "Sending CM DREP failed\n");
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
> index a611556..95a4471 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.h
> +++ b/drivers/infiniband/ulp/srp/ib_srp.h
> @@ -170,6 +170,7 @@ struct srp_rdma_ch {
>
> struct completion tsk_mgmt_done;
> u8 tsk_mgmt_status;
> + bool connected;
> };
>
> /**
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-04-30 16:08 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 8:56 [PATCH 0/12] IB/srp patches for kernel v4.2 Bart Van Assche
2015-04-30 8:56 ` [PATCH 01/12] scsi_transport_srp: Introduce srp_wait_for_queuecommand() Bart Van Assche
[not found] ` <5541EE4A.30803-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 9:32 ` Sagi Grimberg
2015-04-30 9:37 ` Christoph Hellwig
2015-04-30 10:26 ` Bart Van Assche
2015-04-30 10:32 ` Sagi Grimberg
2015-04-30 10:58 ` Bart Van Assche
[not found] ` <55420AEA.10108-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 14:13 ` Sagi Grimberg
2015-04-30 17:25 ` Christoph Hellwig
2015-05-06 9:59 ` Bart Van Assche
2015-05-11 7:50 ` hosts resets in SRP and the rest of the world, was: " Christoph Hellwig
2015-05-11 8:54 ` Bart Van Assche
2015-05-11 9:31 ` Christoph Hellwig
2015-05-11 9:58 ` Bart Van Assche
2015-05-11 11:47 ` Christoph Hellwig
2015-05-11 10:58 ` Bart Van Assche
2015-05-11 11:50 ` Christoph Hellwig
2015-05-12 8:49 ` Bart Van Assche
2015-05-12 18:02 ` Christoph Hellwig
2015-04-30 8:57 ` [PATCH 02/12] scsi_transport_srp: Fix a race condition Bart Van Assche
[not found] ` <5541EE66.7090608-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 9:44 ` Sagi Grimberg
[not found] ` <5541F96F.8090503-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-04-30 10:20 ` Bart Van Assche
[not found] ` <5541EE21.3050809-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 8:57 ` [PATCH 03/12] IB/srp: Remove an extraneous scsi_host_put() from an error path Bart Van Assche
2015-04-30 9:44 ` Sagi Grimberg
2015-04-30 9:02 ` [PATCH 11/12] IB/srp: Add 64-bit LUN support Bart Van Assche
2015-04-30 9:02 ` [PATCH 12/12] IB/srp: Make CM timeout dependent on subnet timeout Bart Van Assche
[not found] ` <5541EFB3.6030704-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 10:27 ` Sagi Grimberg
2015-04-30 10:45 ` Bart Van Assche
2015-04-30 8:58 ` [PATCH 04/12] IB/srp: Fix connection state tracking Bart Van Assche
2015-04-30 9:51 ` Sagi Grimberg
2015-04-30 11:25 ` Bart Van Assche
[not found] ` <5542111E.1080305-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 15:00 ` Sagi Grimberg
[not found] ` <5542439D.1000107-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-05-05 9:31 ` Bart Van Assche
[not found] ` <55488E06.8040308-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-05-05 9:45 ` Sagi Grimberg
[not found] ` <5548911F.8060505-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-05-05 9:59 ` Bart Van Assche
2015-04-30 16:08 ` Doug Ledford [this message]
[not found] ` <1430410094.102408.71.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-05 9:21 ` Bart Van Assche
[not found] ` <55488BAE.7070006-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-05-05 14:10 ` Doug Ledford
2015-05-05 14:26 ` Bart Van Assche
2015-05-05 15:10 ` Doug Ledford
2015-05-05 15:27 ` Bart Van Assche
[not found] ` <5548E155.70007-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-05-05 16:10 ` Doug Ledford
[not found] ` <1430842201.2407.226.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-06 9:29 ` Bart Van Assche
[not found] ` <5549DEEC.9050501-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-05-07 13:44 ` Doug Ledford
2015-04-30 8:58 ` [PATCH 05/12] IB/srp: Fix reconnection failure handling Bart Van Assche
2015-04-30 8:59 ` [PATCH 06/12] scsi_transport_srp: Reduce failover time Bart Van Assche
2015-04-30 10:13 ` Sagi Grimberg
2015-04-30 11:02 ` Bart Van Assche
[not found] ` <55420BAA.7060507-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 15:14 ` Sagi Grimberg
[not found] ` <554246E6.9020503-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-05-05 9:38 ` Bart Van Assche
2015-04-30 9:00 ` [PATCH 07/12] IB/srp: Remove superfluous casts Bart Van Assche
2015-04-30 10:13 ` Sagi Grimberg
2015-04-30 9:00 ` [PATCH 08/12] IB/srp: Rearrange module description Bart Van Assche
[not found] ` <5541EF39.6040301-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 10:15 ` Sagi Grimberg
2015-04-30 9:01 ` [PATCH 09/12] IB/srp: Remove a superfluous check from srp_free_req_data() Bart Van Assche
[not found] ` <5541EF4F.6050200-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-04-30 10:18 ` Sagi Grimberg
2015-04-30 10:37 ` Bart Van Assche
2015-04-30 9:01 ` [PATCH 10/12] IB/srp: Remove !ch->target tests from the reconnect code Bart Van Assche
2015-04-30 10:19 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430410094.102408.71.camel@redhat.com \
--to=dledford@redhat.com \
--cc=bart.vanassche@sandisk.com \
--cc=jbottomley@odin.com \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sagig@mellanox.com \
--cc=sebastian.riemer@profitbricks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).