summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2015-04-06 12:55:13 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-04-28 21:31:25 -0700
commit32c35e175ac362a9682b10600044a5fe17441176 (patch)
treee17858be78ef37a5a00e402ca4fea3521444b5e2 /rpc/rpc-lib
parentb04b957f2f27cf03958b456b3cec097d1e04923c (diff)
rpc: Perform throttling conditionally
This change makes rpc's throttling to be performed only if attribute throttle is set in rpcsvc_t. Change-Id: I24620095570e206f5dc8fc6208fcf55cb22a1658 BUG: 1212385 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/10268 Tested-by: NetBSD Build System Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'rpc/rpc-lib')
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 0a4dc04c731..b395149e032 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -179,13 +179,25 @@ rpcsvc_can_outstanding_req_be_ignored (rpcsvc_request_t *req)
int
rpcsvc_request_outstanding (rpcsvc_request_t *req, int delta)
{
- int ret = 0;
- int old_count = 0;
- int new_count = 0;
- int limit = 0;
+ int ret = -1;
+ int old_count = 0;
+ int new_count = 0;
+ int limit = 0;
+ gf_boolean_t throttle = _gf_false;
+
+ if (!req)
+ goto out;
+
+ throttle = rpcsvc_get_throttle (req->svc);
+ if (!throttle) {
+ ret = 0;
+ goto out;
+ }
- if (rpcsvc_can_outstanding_req_be_ignored (req))
- return 0;
+ if (rpcsvc_can_outstanding_req_be_ignored (req)) {
+ ret = 0;
+ goto out;
+ }
pthread_mutex_lock (&req->trans->lock);
{
@@ -206,6 +218,7 @@ rpcsvc_request_outstanding (rpcsvc_request_t *req, int delta)
unlock:
pthread_mutex_unlock (&req->trans->lock);
+out:
return ret;
}