From 33d7a49bd55d6810d87811c109c7445e27b04c17 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Sat, 2 Oct 2010 07:36:33 +0000 Subject: rpc-transport/rdma: send disconnect event only if the transport is already connected. - A disconnect event can be sent before a connect event to rpc, if some error happens during rdma handshake. - Also call rdma_quota_put only if peer is not NULL. Signed-off-by: Raghavendra G Signed-off-by: Vijay Bellur BUG: 513 (Introduce 0 copy rdma) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=513 --- rpc/rpc-transport/rdma/src/rdma.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'rpc/rpc-transport/rdma') diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 27a64d86..0f9699d0 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -3493,7 +3493,8 @@ rdma_send_completion_proc (void *data) if ((ret == 0) && (wc.status == IBV_WC_SUCCESS) && !is_request - && (post->type == RDMA_SEND_POST)) { + && (post->type == RDMA_SEND_POST) + && (peer != NULL)) { /* An RDMA_RECV_POST can end up in * rdma_send_completion_proc for * rdma-reads, and we do not take @@ -4226,7 +4227,7 @@ rdma_handshake_pollerr (rpc_transport_t *this) { rdma_private_t *priv = this->private; int32_t ret = 0; - char need_unref = 0; + char need_unref = 0, connected = 0; gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG, "%s: peer disconnected, cleaning up", @@ -4236,6 +4237,7 @@ rdma_handshake_pollerr (rpc_transport_t *this) { __rdma_teardown (this); + connected = priv->connected; if (priv->sock != -1) { event_unregister (this->ctx->event_pool, priv->sock, priv->idx); @@ -4267,7 +4269,9 @@ rdma_handshake_pollerr (rpc_transport_t *this) } pthread_mutex_unlock (&priv->write_mutex); - rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this); + if (connected) { + rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this); + } if (need_unref) rpc_transport_unref (this); -- cgit