From 49733d307f010bfeb3d2440402ff51a5366262f5 Mon Sep 17 00:00:00 2001 From: Yuan Ding Date: Mon, 21 Apr 2014 22:10:13 +0800 Subject: gNFS: gNFS drc cache failed to detecte duplicates. After the drc cache get full, message "DRC failed to detect duplicates" keep printed in the log. The root cause is 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. Change-Id: I925c097debe6b82f267986961fd4e7755f3de9af BUG: 1089676 Signed-off-by: Yuan Ding Reviewed-on: http://review.gluster.org/7519 Reviewed-by: Niels de Vos Reviewed-by: Santosh Pradhan Tested-by: Gluster Build System Reviewed-by: Anand Avati --- rpc/rpc-lib/src/rpc-drc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rpc/rpc-lib/src/rpc-drc.c b/rpc/rpc-lib/src/rpc-drc.c index 0babb9bc4..bc37324d3 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) -- cgit