Patchwork [BUG:1854] rpc-transport/rdma: fix the bug which was causing an ioq-entry being mem_put twice.

login
register
Submitter Raghavendra G
Date 2010-10-09 01:51:59
Message ID <20101009015159.GA12549@dev.gluster.com>
Download mbox | patch
Permalink /patch/5384/
State Accepted
Headers show

Comments

Raghavendra G - 2010-10-09 01:51:59
- in case of failure to send message, ioq-entry would be freed, but it used to
    get added to the ioq-list. Failure in sending a message (for reasons
    other than insufficient quota), would result in transport being
    disconnected. In the process of handling pollerr, when ioq-list is flushed,
    the same ioq-entry which would've already been freed, would be freed for
    second time.
  - this patch also fixes spurious disconnects happening when quota was not
    available while sending a request.

Signed-off-by: Raghavendra G <raghavendra@gluster.com>
---
 rpc/rpc-transport/rdma/src/rdma.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 0066496..30f77f3 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -1682,6 +1682,8 @@  __rdma_ioq_churn_entry (rdma_peer_t *peer, rdma_ioq_t *entry)
                 if (ret != 0) {
                         __rdma_ioq_entry_free (entry);
                 }
+        } else {
+                ret = 0;
         }
 
 out:
@@ -1740,7 +1742,7 @@  rdma_writev (rpc_transport_t *this,
                 peer = &priv->peer;
                 if (list_empty (&peer->ioq)) {
                         ret = __rdma_ioq_churn_entry (peer, entry);
-                        if (ret > 0) {
+                        if (ret != 0) {
                                 need_append = 0;
                         }
                 }