Blob Blame History Raw
From 9fc6e38ec39cfeb58d1b0fa0c2878c608d49f8e8 Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Mon, 21 May 2018 19:04:37 +0530
Subject: [PATCH 281/282] Revert "program/GF-DUMP: Shield ping processing from
 traffic to Glusterfs"

This reverts commit 2e72b24707f1886833db0b09e48b3f48b8d68d37.

> Reviewed-on: https://review.gluster.org/17105

Change-Id: Iad5dc50d24f7ab2c8261d1d44afd04b67c24c96d
BUG: 1558989
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/139309
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 rpc/rpc-lib/src/rpcsvc.c                      | 89 +--------------------------
 rpc/rpc-lib/src/rpcsvc.h                      | 17 +----
 xlators/protocol/server/src/server-rpc-fops.c |  1 -
 3 files changed, 3 insertions(+), 104 deletions(-)

diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 68e27ab..9938b8f 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -303,7 +303,6 @@ rpcsvc_program_actor (rpcsvc_request_t *req)
                 goto err;
         }
 
-        req->ownthread = program->ownthread;
         req->synctask = program->synctask;
 
         err = SUCCESS;
@@ -426,7 +425,6 @@ rpcsvc_request_init (rpcsvc_t *svc, rpc_transport_t *trans,
         req->trans_private = msg->private;
 
         INIT_LIST_HEAD (&req->txlist);
-        INIT_LIST_HEAD (&req->request_list);
         req->payloadsize = 0;
 
         /* By this time, the data bytes for the auth scheme would have already
@@ -577,7 +575,7 @@ rpcsvc_handle_rpc_call (rpcsvc_t *svc, rpc_transport_t *trans,
         rpcsvc_request_t       *req            = NULL;
         int                     ret            = -1;
         uint16_t                port           = 0;
-        gf_boolean_t            is_unix        = _gf_false, empty = _gf_false;
+        gf_boolean_t            is_unix        = _gf_false;
         gf_boolean_t            unprivileged   = _gf_false;
         drc_cached_op_t        *reply          = NULL;
         rpcsvc_drc_globals_t   *drc            = NULL;
@@ -693,20 +691,6 @@ rpcsvc_handle_rpc_call (rpcsvc_t *svc, rpc_transport_t *trans,
                                             (synctask_fn_t) actor_fn,
                                             rpcsvc_check_and_reply_error, NULL,
                                             req);
-                } else if (req->ownthread) {
-                        pthread_mutex_lock (&req->prog->queue_lock);
-                        {
-                                empty = list_empty (&req->prog->request_queue);
-
-                                list_add_tail (&req->request_list,
-                                               &req->prog->request_queue);
-
-                                if (empty)
-                                        pthread_cond_signal (&req->prog->queue_cond);
-                        }
-                        pthread_mutex_unlock (&req->prog->queue_lock);
-
-                        ret = 0;
                 } else {
                         ret = actor_fn (req);
                 }
@@ -1586,12 +1570,6 @@ rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t *program)
                 " Ver: %d, Port: %d", prog->progname, prog->prognum,
                 prog->progver, prog->progport);
 
-        if (prog->ownthread) {
-                prog->alive = _gf_false;
-                ret = 0;
-                goto out;
-        }
-
         pthread_mutex_lock (&svc->rpclock);
         {
                 list_del_init (&prog->program);
@@ -1856,56 +1834,6 @@ out:
         return ret;
 }
 
-void *
-rpcsvc_request_handler (void *arg)
-{
-        rpcsvc_program_t *program = arg;
-        rpcsvc_request_t *req     = NULL;
-        rpcsvc_actor_t   *actor   = NULL;
-        gf_boolean_t      done    = _gf_false;
-        int               ret     = 0;
-
-        if (!program)
-                return NULL;
-
-        while (1) {
-                pthread_mutex_lock (&program->queue_lock);
-                {
-                        if (!program->alive
-                            && list_empty (&program->request_queue)) {
-                                done = 1;
-                                goto unlock;
-                        }
-
-                        while (list_empty (&program->request_queue))
-                                pthread_cond_wait (&program->queue_cond,
-                                                   &program->queue_lock);
-
-                        req = list_entry (program->request_queue.next,
-                                          typeof (*req), request_list);
-
-                        list_del_init (&req->request_list);
-                }
-        unlock:
-                pthread_mutex_unlock (&program->queue_lock);
-
-                if (done)
-                        break;
-
-                THIS = req->svc->xl;
-
-                actor = rpcsvc_program_actor (req);
-
-                ret = actor->actor (req);
-
-                if (ret != 0) {
-                        rpcsvc_check_and_reply_error (ret, NULL, req);
-                }
-        }
-
-        return NULL;
-}
-
 int
 rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t *program)
 {
@@ -1946,21 +1874,6 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t *program)
         memcpy (newprog, program, sizeof (*program));
 
         INIT_LIST_HEAD (&newprog->program);
-        INIT_LIST_HEAD (&newprog->request_queue);
-        pthread_mutex_init (&newprog->queue_lock, NULL);
-        pthread_cond_init (&newprog->queue_cond, NULL);
-
-        newprog->alive = _gf_true;
-
-        /* make sure synctask gets priority over ownthread */
-        if (newprog->synctask)
-                newprog->ownthread = _gf_false;
-
-        if (newprog->ownthread) {
-                gf_thread_create (&newprog->thread, NULL,
-                                  rpcsvc_request_handler,
-                                  newprog, "rpcsvcrh");
-        }
 
         pthread_mutex_lock (&svc->rpclock);
         {
diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h
index 73507b6..34429b4 100644
--- a/rpc/rpc-lib/src/rpcsvc.h
+++ b/rpc/rpc-lib/src/rpcsvc.h
@@ -233,9 +233,7 @@ struct rpcsvc_request {
          */
         rpcsvc_auth_data_t      verf;
 
-	/* Execute this request's actor function in ownthread of program?*/
-	gf_boolean_t            ownthread;
-
+	/* Execute this request's actor function as a synctask?*/
         gf_boolean_t            synctask;
         /* Container for a RPC program wanting to store a temp
          * request-specific item.
@@ -247,9 +245,6 @@ struct rpcsvc_request {
 
         /* pointer to cached reply for use in DRC */
         drc_cached_op_t         *reply;
-
-        /* request queue in rpcsvc */
-        struct list_head         request_list;
 };
 
 #define rpcsvc_request_program(req) ((rpcsvc_program_t *)((req)->prog))
@@ -400,18 +395,10 @@ struct rpcsvc_program {
          */
         int                     min_auth;
 
-	/* Execute actor function in program's own thread? This will reduce */
-        /* the workload on poller threads */
-	gf_boolean_t            ownthread;
-        gf_boolean_t            alive;
-
+	/* Execute actor function as a synctask? */
         gf_boolean_t            synctask;
         /* list member to link to list of registered services with rpcsvc */
         struct list_head        program;
-        struct list_head        request_queue;
-        pthread_mutex_t         queue_lock;
-        pthread_cond_t          queue_cond;
-        pthread_t               thread;
 };
 
 typedef struct rpcsvc_cbk_program {
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 91d5c03..0bf41d8 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -6160,5 +6160,4 @@ struct rpcsvc_program glusterfs3_3_fop_prog = {
         .progver   = GLUSTER_FOP_VERSION,
         .numactors = GLUSTER_FOP_PROCCNT,
         .actors    = glusterfs3_3_fop_actors,
-        .ownthread = _gf_true,
 };
-- 
1.8.3.1