[Gluster-devel] [PATCH] gNFS: glusterfs nfs server drc cache issue

beback beback198611 at gmail.com
Fri Apr 18 09:08:51 UTC 2014


Function drc_compare_reqs use the wrong compare type. This function should
use
type drc_cache_op_t as its input type. Since all rbtree related code (except
function rpcsvc_drc_lookup) in drc cache pass drc_cache_op_t as compare
type.
Only rpcsvc_drc_lookup use type rpcsvc_request_t. It has been modified too.

Signed-off-by: beback <beback198611 at gmail.com>
---
 rpc/rpc-lib/src/rpc-drc.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/rpc/rpc-lib/src/rpc-drc.c b/rpc/rpc-lib/src/rpc-drc.c
index e7ba114..5693928 100644
--- a/rpc/rpc-lib/src/rpc-drc.c
+++ b/rpc/rpc-lib/src/rpc-drc.c
@@ -127,14 +127,14 @@ int
 drc_compare_reqs (const void *item, const void *rb_node_data, void *param)
 {
         int               ret      = -1;
-        rpcsvc_request_t *req      = NULL;
+        drc_cached_op_t  *req      = NULL;
         drc_cached_op_t  *reply    = NULL;

         GF_ASSERT (item);
         GF_ASSERT (rb_node_data);
         GF_ASSERT (param);

-        req = (rpcsvc_request_t *)item;
+        req = (drc_cached_op_t *)item;
         reply = (drc_cached_op_t *)rb_node_data;

         ret = req->xid - reply->xid;
@@ -143,7 +143,7 @@ drc_compare_reqs (const void *item, const void
*rb_node_data, void *param)

         if (req->prognum == reply->prognum &&
             req->procnum == reply->procnum &&
-            req->progver == reply->progversion)
+            req->progversion == reply->progversion)
                 return 0;

         return 1;
@@ -331,6 +331,12 @@ rpcsvc_drc_lookup (rpcsvc_request_t *req)
 {
         drc_client_t           *client = NULL;
         drc_cached_op_t        *reply  = NULL;
+        drc_cached_op_t        new = {
+                .xid            = req->xid,
+                .prognum        = req->prognum,
+                .progversion    = req->progver,
+                .procnum        = req->procnum,
+        };

         GF_ASSERT (req);

@@ -347,7 +353,7 @@ rpcsvc_drc_lookup (rpcsvc_request_t *req)
         if (client->op_count == 0)
                 goto out;

-        reply = rb_find (client->rbtree, req);
+        reply = rb_find (client->rbtree, &new);

  out:
         if (client)
-- 
1.7.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20140418/af6fb0d4/attachment-0001.html>


More information about the Gluster-devel mailing list