From: Or Gerlitz <ogerlitz@voltaire.com>
To: Or Gerlitz <ogerlitz@voltaire.com>
Cc: Sean Hefty <sean.hefty@intel.com>,
linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: Re: [openib-general] [PATCH 5/6] iser RDMA CM (CMA) and IB verbs interaction
Date: Thu, 04 May 2006 16:00:52 +0300 [thread overview]
Message-ID: <4459FB04.3090302@voltaire.com> (raw)
In-Reply-To: <445606D5.20907@voltaire.com>
Or Gerlitz wrote:
> Sean Hefty wrote:
>>> +static void iser_disconnected_handler(struct rdma_cm_id *cma_id)
>>> +{
>>> + struct iser_conn *ib_conn;
>>> +
>>> + ib_conn = (struct iser_conn *)cma_id->context;
>>> + ib_conn->disc_evt_flag = 1;
>>> +
>>> + /* If this event is unsolicited this means that the conn is
>>> being */
>>> + /* terminated asynchronously from the iSCSI layer's
>>> perspective. */
>>> + if (atomic_read(&ib_conn->state) == ISER_CONN_PENDING) {
>>> + atomic_set(&ib_conn->state, ISER_CONN_DOWN);
>>> + wake_up_interruptible(&ib_conn->wait);
>>> + } else {
>>> + if (atomic_read(&ib_conn->state) == ISER_CONN_UP) {
>>> + atomic_set(&ib_conn->state, ISER_CONN_TERMINATING);
>>> + iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
>>> + ISCSI_ERR_CONN_FAILED);
>>> + }
>>> + /* Complete the termination process if no posts are pending */
>>> + if ((atomic_read(&ib_conn->post_recv_buf_count) == 0) &&
>>> + (atomic_read(&ib_conn->post_send_buf_count) == 0)) {
>>> + atomic_set(&ib_conn->state, ISER_CONN_DOWN);
>>> + wake_up_interruptible(&ib_conn->wait);
>>> + }
>>> + }
>> Are there races here between reading ib_conn->state and setting it?
>> Could it have changed in between the atomic_read() and atomic_set()?
> It seems that indeed a race is possible here, i am rethinking now on the
> implementation of the ib connection states moves, thanks for pointing this.
Following a review and the clarification i have got from you re cma
callbacks serialization, i have committed this change which removes
unneeded state checks from two flows (disconnect handler and connect error)
Or.
r6900 | ogerlitz | 2006-05-04 11:06:24 +0300 (Thu, 04 May 2006) | 7 lines
two fixes to iser ib conn state management:
+1 when getting DISCONNECTED cma event, iser's state can't be PENDING
+2 when connect_error is called, iser's state is PENDING, no need to
check it
Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com
Index: iser_verbs.c
===================================================================
--- iser_verbs.c (revision 6802)
+++ iser_verbs.c (revision 6900)
@@ -309,12 +309,8 @@ static void iser_connect_error(struct rd
struct iser_conn *ib_conn;
ib_conn = (struct iser_conn *)cma_id->context;
- if (atomic_read(&ib_conn->state) == ISER_CONN_PENDING) {
- atomic_set(&ib_conn->state, ISER_CONN_DOWN);
- wake_up_interruptible(&ib_conn->wait);
- } else
- iser_err("Unexpected evt for conn.state: %d\n",
- atomic_read(&ib_conn->state));
+ atomic_set(&ib_conn->state, ISER_CONN_DOWN);
+ wake_up_interruptible(&ib_conn->wait);
}
static void iser_addr_handler(struct rdma_cm_id *cma_id)
@@ -386,21 +382,16 @@ static void iser_disconnected_handler(st
/* If this event is unsolicited this means that the conn is being */
/* terminated asynchronously from the iSCSI layer's perspective. */
- if (atomic_read(&ib_conn->state) == ISER_CONN_PENDING) {
+ if (atomic_read(&ib_conn->state) == ISER_CONN_UP) {
+ atomic_set(&ib_conn->state, ISER_CONN_TERMINATING);
+ iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
+ ISCSI_ERR_CONN_FAILED);
+ }
+ /* Complete the termination process if no posts are pending */
+ if ((atomic_read(&ib_conn->post_recv_buf_count) == 0) &&
+ (atomic_read(&ib_conn->post_send_buf_count) == 0)) {
atomic_set(&ib_conn->state, ISER_CONN_DOWN);
wake_up_interruptible(&ib_conn->wait);
- } else {
- if (atomic_read(&ib_conn->state) == ISER_CONN_UP) {
- atomic_set(&ib_conn->state, ISER_CONN_TERMINATING);
- iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
- ISCSI_ERR_CONN_FAILED);
- }
- /* Complete the termination process if no posts are pending */
- if ((atomic_read(&ib_conn->post_recv_buf_count) == 0) &&
- (atomic_read(&ib_conn->post_send_buf_count) == 0)) {
- atomic_set(&ib_conn->state, ISER_CONN_DOWN);
- wake_up_interruptible(&ib_conn->wait);
- }
}
}
next prev parent reply other threads:[~2006-05-04 13:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 12:30 [PATCH 0/6] iSER (iSCSI Extensions for RDMA) initiator Or Gerlitz
2006-04-27 12:30 ` [PATCH 1/6] iSER's Makefile and Kconfig Or Gerlitz
2006-04-27 12:31 ` [PATCH 2/6] iscsi_iser header file Or Gerlitz
2006-04-27 12:31 ` [PATCH 3/6] open iscsi iser transport provider code Or Gerlitz
2006-04-27 12:32 ` [PATCH 4/6] iser initiator Or Gerlitz
2006-04-27 12:32 ` [PATCH 5/6] iser RDMA CM (CMA) and IB verbs interaction Or Gerlitz
2006-04-27 12:33 ` [PATCH 6/6] iser handling of memory for RDMA Or Gerlitz
2006-04-28 23:05 ` [openib-general] [PATCH 5/6] iser RDMA CM (CMA) and IB verbsinteraction Sean Hefty
2006-04-30 12:30 ` Or Gerlitz
2006-05-01 13:02 ` Or Gerlitz
2006-05-04 13:00 ` Or Gerlitz [this message]
2006-05-04 13:06 ` [openib-general] [PATCH 5/6] iser RDMA CM (CMA) and IB verbs interaction Or Gerlitz
2006-04-27 17:01 ` [PATCH 3/6] open iscsi iser transport provider code Stephen Hemminger
2006-04-27 16:58 ` [PATCH 2/6] iscsi_iser header file Stephen Hemminger
2006-04-27 12:40 ` [PATCH 1/6] iSER's Makefile and Kconfig Jan-Benedict Glaw
2006-04-27 12:44 ` Or Gerlitz
2006-05-01 18:32 ` [PATCH 0/6] iSER (iSCSI Extensions for RDMA) initiator Roland Dreier
2006-05-02 7:56 ` Or Gerlitz
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=4459FB04.3090302@voltaire.com \
--to=ogerlitz@voltaire.com \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=sean.hefty@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.