|
|
e7a346 |
From 435e0a9cfd3df40498ca835ed573c994da2fc66b Mon Sep 17 00:00:00 2001
|
|
|
e7a346 |
From: Milind Changire <mchangir@redhat.com>
|
|
|
e7a346 |
Date: Mon, 21 May 2018 12:16:42 +0530
|
|
|
e7a346 |
Subject: [PATCH 279/282] Revert "rpc: make actor search parallel"
|
|
|
e7a346 |
|
|
|
e7a346 |
This reverts commit 72dc3a3eff84c5e17bbc3bfddec9daf50338464f.
|
|
|
e7a346 |
|
|
|
e7a346 |
> Reviewed-on: https://code.engineering.redhat.com/gerrit/131909
|
|
|
e7a346 |
|
|
|
e7a346 |
Change-Id: I0ce4f1c6c14f89031a31d5bb7ffb66ea16348cb9
|
|
|
e7a346 |
BUG: 1558989
|
|
|
e7a346 |
Signed-off-by: Milind Changire <mchangir@redhat.com>
|
|
|
e7a346 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/139307
|
|
|
e7a346 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e7a346 |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
e7a346 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e7a346 |
---
|
|
|
e7a346 |
rpc/rpc-lib/src/rpcsvc-common.h | 2 +-
|
|
|
e7a346 |
rpc/rpc-lib/src/rpcsvc.c | 54 ++++++++++++++++++++---------------------
|
|
|
e7a346 |
2 files changed, 28 insertions(+), 28 deletions(-)
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/rpc/rpc-lib/src/rpcsvc-common.h b/rpc/rpc-lib/src/rpcsvc-common.h
|
|
|
e7a346 |
index ab715d3..dd95803 100644
|
|
|
e7a346 |
--- a/rpc/rpc-lib/src/rpcsvc-common.h
|
|
|
e7a346 |
+++ b/rpc/rpc-lib/src/rpcsvc-common.h
|
|
|
e7a346 |
@@ -42,7 +42,7 @@ typedef struct rpcsvc_state {
|
|
|
e7a346 |
* other options.
|
|
|
e7a346 |
*/
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_t rpclock;
|
|
|
e7a346 |
+ pthread_mutex_t rpclock;
|
|
|
e7a346 |
|
|
|
e7a346 |
unsigned int memfactor;
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
|
|
|
e7a346 |
index fbd1071..31b5eb5 100644
|
|
|
e7a346 |
--- a/rpc/rpc-lib/src/rpcsvc.c
|
|
|
e7a346 |
+++ b/rpc/rpc-lib/src/rpcsvc.c
|
|
|
e7a346 |
@@ -88,11 +88,11 @@ rpcsvc_listener_destroy (rpcsvc_listener_t *listener)
|
|
|
e7a346 |
goto listener_free;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_wrlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_del_init (&listener->list);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
listener_free:
|
|
|
e7a346 |
GF_FREE (listener);
|
|
|
e7a346 |
@@ -110,7 +110,7 @@ rpcsvc_get_program_vector_sizer (rpcsvc_t *svc, uint32_t prognum,
|
|
|
e7a346 |
if (!svc)
|
|
|
e7a346 |
return NULL;
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_rdlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
/* Find the matching RPC program from registered list */
|
|
|
e7a346 |
list_for_each_entry (program, &svc->programs, program) {
|
|
|
e7a346 |
@@ -121,7 +121,7 @@ rpcsvc_get_program_vector_sizer (rpcsvc_t *svc, uint32_t prognum,
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (found) {
|
|
|
e7a346 |
/* Make sure the requested procnum is supported by RPC prog */
|
|
|
e7a346 |
@@ -237,7 +237,7 @@ rpcsvc_program_actor (rpcsvc_request_t *req)
|
|
|
e7a346 |
|
|
|
e7a346 |
svc = req->svc;
|
|
|
e7a346 |
peername = req->trans->peerinfo.identifier;
|
|
|
e7a346 |
- pthread_rwlock_rdlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_for_each_entry (program, &svc->programs, program) {
|
|
|
e7a346 |
if (program->prognum == req->prognum) {
|
|
|
e7a346 |
@@ -251,7 +251,7 @@ rpcsvc_program_actor (rpcsvc_request_t *req)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (!found) {
|
|
|
e7a346 |
if (err != PROG_MISMATCH) {
|
|
|
e7a346 |
@@ -735,7 +735,7 @@ rpcsvc_handle_disconnect (rpcsvc_t *svc, rpc_transport_t *trans)
|
|
|
e7a346 |
event = (trans->listener == NULL) ? RPCSVC_EVENT_LISTENER_DEAD
|
|
|
e7a346 |
: RPCSVC_EVENT_DISCONNECT;
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_rdlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
if (!svc->notify_count)
|
|
|
e7a346 |
goto unlock;
|
|
|
e7a346 |
@@ -755,7 +755,7 @@ rpcsvc_handle_disconnect (rpcsvc_t *svc, rpc_transport_t *trans)
|
|
|
e7a346 |
wrapper_count = i;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
unlock:
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (wrappers) {
|
|
|
e7a346 |
for (i = 0; i < wrapper_count; i++) {
|
|
|
e7a346 |
@@ -1495,7 +1495,7 @@ rpcsvc_get_listener (rpcsvc_t *svc, uint16_t port, rpc_transport_t *trans)
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_rdlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_for_each_entry (listener, &svc->listeners, list) {
|
|
|
e7a346 |
if (trans != NULL) {
|
|
|
e7a346 |
@@ -1521,7 +1521,7 @@ rpcsvc_get_listener (rpcsvc_t *svc, uint16_t port, rpc_transport_t *trans)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (!found) {
|
|
|
e7a346 |
listener = NULL;
|
|
|
e7a346 |
@@ -1566,7 +1566,7 @@ rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t *program)
|
|
|
e7a346 |
" program failed");
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_rdlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_for_each_entry (prog, &svc->programs, program) {
|
|
|
e7a346 |
if ((prog->prognum == program->prognum)
|
|
|
e7a346 |
@@ -1575,7 +1575,7 @@ rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t *program)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (prog == NULL) {
|
|
|
e7a346 |
ret = -1;
|
|
|
e7a346 |
@@ -1592,11 +1592,11 @@ rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t *program)
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_wrlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_del_init (&prog->program);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = 0;
|
|
|
e7a346 |
out:
|
|
|
e7a346 |
@@ -1655,11 +1655,11 @@ rpcsvc_listener_alloc (rpcsvc_t *svc, rpc_transport_t *trans)
|
|
|
e7a346 |
|
|
|
e7a346 |
INIT_LIST_HEAD (&listener->list);
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_wrlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_add_tail (&listener->list, &svc->listeners);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
out:
|
|
|
e7a346 |
return listener;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -1813,7 +1813,7 @@ rpcsvc_unregister_notify (rpcsvc_t *svc, rpcsvc_notify_t notify, void *mydata)
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_wrlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_for_each_entry_safe (wrapper, tmp, &svc->notify, list) {
|
|
|
e7a346 |
if ((wrapper->notify == notify)
|
|
|
e7a346 |
@@ -1824,7 +1824,7 @@ rpcsvc_unregister_notify (rpcsvc_t *svc, rpcsvc_notify_t notify, void *mydata)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
out:
|
|
|
e7a346 |
return ret;
|
|
|
e7a346 |
@@ -1844,12 +1844,12 @@ rpcsvc_register_notify (rpcsvc_t *svc, rpcsvc_notify_t notify, void *mydata)
|
|
|
e7a346 |
wrapper->data = mydata;
|
|
|
e7a346 |
wrapper->notify = notify;
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_wrlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_add_tail (&wrapper->list, &svc->notify);
|
|
|
e7a346 |
svc->notify_count++;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = 0;
|
|
|
e7a346 |
out:
|
|
|
e7a346 |
@@ -1987,7 +1987,7 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t *program)
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_rdlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_for_each_entry (newprog, &svc->programs, program) {
|
|
|
e7a346 |
if ((newprog->prognum == program->prognum)
|
|
|
e7a346 |
@@ -1997,7 +1997,7 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t *program)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (already_registered) {
|
|
|
e7a346 |
ret = 0;
|
|
|
e7a346 |
@@ -2031,11 +2031,11 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t *program)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_wrlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_add_tail (&newprog->program, &svc->programs);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- pthread_rwlock_unlock (&svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&svc->rpclock);
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = 0;
|
|
|
e7a346 |
gf_log (GF_RPCSVC, GF_LOG_DEBUG, "New program registered: %s, Num: %d,"
|
|
|
e7a346 |
@@ -2077,7 +2077,7 @@ build_prog_details (rpcsvc_request_t *req, gf_dump_rsp *rsp)
|
|
|
e7a346 |
if (!req || !req->trans || !req->svc)
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_rdlock (&req->svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_lock (&req->svc->rpclock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
list_for_each_entry (program, &req->svc->programs, program) {
|
|
|
e7a346 |
prog = GF_CALLOC (1, sizeof (*prog), 0);
|
|
|
e7a346 |
@@ -2098,7 +2098,7 @@ build_prog_details (rpcsvc_request_t *req, gf_dump_rsp *rsp)
|
|
|
e7a346 |
ret = 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
unlock:
|
|
|
e7a346 |
- pthread_rwlock_unlock (&req->svc->rpclock);
|
|
|
e7a346 |
+ pthread_mutex_unlock (&req->svc->rpclock);
|
|
|
e7a346 |
out:
|
|
|
e7a346 |
return ret;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -2456,7 +2456,7 @@ rpcsvc_init (xlator_t *xl, glusterfs_ctx_t *ctx, dict_t *options,
|
|
|
e7a346 |
if (!svc)
|
|
|
e7a346 |
return NULL;
|
|
|
e7a346 |
|
|
|
e7a346 |
- pthread_rwlock_init (&svc->rpclock, NULL);
|
|
|
e7a346 |
+ pthread_mutex_init (&svc->rpclock, NULL);
|
|
|
e7a346 |
INIT_LIST_HEAD (&svc->authschemes);
|
|
|
e7a346 |
INIT_LIST_HEAD (&svc->notify);
|
|
|
e7a346 |
INIT_LIST_HEAD (&svc->listeners);
|
|
|
e7a346 |
--
|
|
|
e7a346 |
1.8.3.1
|
|
|
e7a346 |
|