summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-10-02 07:36:33 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-02 07:04:19 -0700
commit33d7a49bd55d6810d87811c109c7445e27b04c17 (patch)
treec54a896e16677cf10396e128f6a62f4d79fdd8a8 /rpc
parent1b7a997a7b368aa459dcd57ec23532fe4cdd6e0c (diff)
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 <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 513 (Introduce 0 copy rdma) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=513
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 27a64d86e..0f9699d09 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);