From: Chesnokov Gleb <Chesnokov.G@raidix.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
"lanevdenoche@gmail.com" <lanevdenoche@gmail.com>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"sagi@grimberg.me" <sagi@grimberg.me>,
"dledford@redhat.com" <dledford@redhat.com>
Subject: Re: [PATCH 1/1] iser-target: Fix handling of RDMA_CV_EVENT_ADDR_CHANGE
Date: Mon, 19 Jul 2021 16:07:44 +0000 [thread overview]
Message-ID: <2ea098b2bbfc4f5c9e9b590804e0dcb5@raidix.com> (raw)
In-Reply-To: <20210719121302.GA1048368@nvidia.com>
> And I don't see anything preventing that from running concurrently
> with the WQ
Thanks, i made a fix.
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index de5ab2ae8e1738455bc36eca5487f1c9136e060e..6b0fc8d54f49102ad8c9fe67b1888dc6883f2164 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -601,14 +601,18 @@ static void isert_np_reinit_id_work(struct work_struct *w)
{
struct isert_np *isert_np = container_of(w, struct isert_np, work);
- rdma_destroy_id(isert_np->cm_id);
+ mutex_lock(&isert_np->id_mutex);
+ if (isert_np->cm_id) {
+ rdma_destroy_id(isert_np->cm_id);
- isert_np->cm_id = isert_setup_id(isert_np);
- if (IS_ERR(isert_np->cm_id)) {
- isert_err("isert np %p setup id failed: %ld\n",
- isert_np, PTR_ERR(isert_np->cm_id));
- isert_np->cm_id = NULL;
+ isert_np->cm_id = isert_setup_id(isert_np);
+ if (IS_ERR(isert_np->cm_id)) {
+ isert_err("isert np %p setup id failed: %ld\n",
+ isert_np, PTR_ERR(isert_np->cm_id));
+ isert_np->cm_id = NULL;
+ }
}
+ mutex_unlock(&isert_np->id_mutex);
}
static int
@@ -2292,6 +2296,7 @@ isert_setup_np(struct iscsi_np *np,
}
INIT_WORK(&isert_np->work, isert_np_reinit_id_work);
+ mutex_init(&isert_np->id_mutex);
sema_init(&isert_np->sem, 0);
mutex_init(&isert_np->mutex);
@@ -2455,8 +2460,12 @@ isert_free_np(struct iscsi_np *np)
struct isert_np *isert_np = np->np_context;
struct isert_conn *isert_conn, *n;
- if (isert_np->cm_id)
+ mutex_lock(&isert_np->id_mutex);
+ if (isert_np->cm_id) {
rdma_destroy_id(isert_np->cm_id);
+ isert_np->cm_id = NULL;
+ }
+ mutex_unlock(&isert_np->id_mutex);
/*
* FIXME: At this point we don't have a good way to insure
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
index 5fdc799f3ca864667a454374f8548e7f031e9925..dafe7b44494d1d5687f0d87e18855d78e8729707 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -211,4 +211,5 @@ struct isert_np {
struct list_head pending;
struct work_struct work;
struct workqueue_struct *reinit_id_wq;
+ struct mutex id_mutex;
};
> What is this trying to do anyhow? If the addr has truely changed why
> does the bind fail?
When the active physical link member of bonding interface in active-standby
mode gets faulty, the standby link will represent the assigned addresses on
behalf of the active link.
Therefore, RDMA communication manager will notify iSER target with
RDMA_CM_EVENT_ADDR_CHANGE.
The iSCSI socket address does not change.
But the cma_id at the IB layer, which is bound to the iSCSI socket, will change.
The problem is that the new cma_id is trying to bind to a socket address that is still bound to the old cma_id.
That is, before you bind a new cma_id to a socket, you must first delete the old one.
Best regards,
Chesnokov Gleb
From: Jason Gunthorpe <jgg@nvidia.com>
Sent: Monday, July 19, 2021 3:13:02 PM
To: lanevdenoche@gmail.com
Cc: linux-rdma@vger.kernel.org; sagi@grimberg.me; dledford@redhat.com; Chesnokov Gleb
Subject: Re: [PATCH 1/1] iser-target: Fix handling of RDMA_CV_EVENT_ADDR_CHANGE
On Wed, Jul 14, 2021 at 09:26:46PM +0300, lanevdenoche@gmail.com wrote:
> @@ -2466,6 +2489,8 @@ isert_free_np(struct iscsi_np *np)
> }
> mutex_unlock(&isert_np->mutex);
>
> + destroy_workqueue(isert_np->reinit_id_wq);
> +
This is racy, the lines above have:
if (isert_np->cm_id)
rdma_destroy_id(isert_np->cm_id);
And I don't see anything preventing that from running concurrently
with the WQ
What is this trying to do anyhow? If the addr has truely changed why
does the bind fail?
Jason
next prev parent reply other threads:[~2021-07-19 16:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 18:26 [PATCH 1/1] iser-target: Fix handling of RDMA_CV_EVENT_ADDR_CHANGE lanevdenoche
2021-07-18 8:50 ` Leon Romanovsky
[not found] ` <9e97e113abb64952a22430462310ca83@raidix.com>
2021-07-19 6:40 ` Leon Romanovsky
2021-07-19 12:13 ` Jason Gunthorpe
2021-07-19 16:07 ` Chesnokov Gleb [this message]
2021-07-19 17:09 ` Jason Gunthorpe
2021-07-19 18:27 ` Sagi Grimberg
2021-07-19 18:29 ` Sagi Grimberg
2021-07-19 20:47 ` Chesnokov Gleb
2021-07-22 14:23 ` Jason Gunthorpe
2021-07-22 19:54 ` Sagi Grimberg
2021-07-27 17:37 ` Jason Gunthorpe
2021-08-06 20:14 ` Sagi Grimberg
2021-08-17 8:30 ` Chesnokov Gleb
2021-08-17 21:27 ` Sagi Grimberg
2021-09-01 11:43 ` Chesnokov Gleb
2021-09-01 11:56 ` Jason Gunthorpe
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=2ea098b2bbfc4f5c9e9b590804e0dcb5@raidix.com \
--to=chesnokov.g@raidix.com \
--cc=dledford@redhat.com \
--cc=jgg@nvidia.com \
--cc=lanevdenoche@gmail.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sagi@grimberg.me \
/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).