cb8e9e
From 1619231c0313666282b4145db9e1c1ceb40d708f Mon Sep 17 00:00:00 2001
cb8e9e
From: anand <anekkunt@redhat.com>
cb8e9e
Date: Wed, 17 Jun 2015 16:11:48 +0530
cb8e9e
Subject: [PATCH 211/212] glusterd: Removing sync lock and unlock inside rcu read critical section
cb8e9e
cb8e9e
Issue : Glsuterd was crashing during peer probe.
cb8e9e
cb8e9e
RCA :  In glusterd, we are using big lock which is implemented based on sync
cb8e9e
task frame work for thread synchronization, sync task frame work swap the threads
cb8e9e
if there is no worker pool threads available. Due to this rcu lock and rcu unlock
cb8e9e
was happening  in different threads (urcu-bp will not allow this), resulting into
cb8e9e
glusterd crash.
cb8e9e
cb8e9e
fix : Removing sync lock and unlock inside rcu read critical section, which was left out by
cb8e9e
http://review.gluster.org/#/c/10285/ patch.
cb8e9e
Backport of:
cb8e9e
>Change-Id: Id358dfcc797335bcd3b491c3129017b2caa826eb
cb8e9e
>BUG: 1232693
cb8e9e
>Signed-off-by: anand <anekkunt@redhat.com>
cb8e9e
>Reviewed-on: http://review.gluster.org/11276
cb8e9e
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
>Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
cb8e9e
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
cb8e9e
cb8e9e
Change-Id: I8489d915b2f21442e49230e82096a12900d889ef
cb8e9e
BUG: 1231635
cb8e9e
Signed-off-by: anand <anekkunt@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/52439
cb8e9e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
Tested-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
---
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-rpc-ops.c |    3 +-
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-utils.c   |   28 +++----------------------
cb8e9e
 2 files changed, 5 insertions(+), 26 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
cb8e9e
index e380e43..0a144b9 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
cb8e9e
@@ -1637,13 +1637,12 @@ glusterd_rpc_friend_remove (call_frame_t *frame, xlator_t *this,
cb8e9e
         req.hostname = gf_strdup (peerinfo->hostname);
cb8e9e
         req.port = peerinfo->port;
cb8e9e
 
cb8e9e
-        rcu_read_unlock ();
cb8e9e
-
cb8e9e
         ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->peer,
cb8e9e
                                        GLUSTERD_FRIEND_REMOVE, NULL,
cb8e9e
                                        this, glusterd_friend_remove_cbk,
cb8e9e
                                        (xdrproc_t)xdr_gd1_mgmt_friend_req);
cb8e9e
 
cb8e9e
+        rcu_read_unlock ();
cb8e9e
 out:
cb8e9e
         GF_FREE (req.hostname);
cb8e9e
 
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
index 3bb72b1..7347fb2 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
@@ -241,11 +241,10 @@ glusterd_get_uuid (uuid_t *uuid)
cb8e9e
 }
cb8e9e
 
cb8e9e
 int
cb8e9e
-glusterd_submit_request_unlocked (struct rpc_clnt *rpc, void *req,
cb8e9e
-                                  call_frame_t *frame, rpc_clnt_prog_t *prog,
cb8e9e
-                                  int procnum, struct iobref *iobref,
cb8e9e
-                                  xlator_t *this, fop_cbk_fn_t cbkfn,
cb8e9e
-                                  xdrproc_t xdrproc)
cb8e9e
+glusterd_submit_request (struct rpc_clnt *rpc, void *req,
cb8e9e
+                         call_frame_t *frame, rpc_clnt_prog_t *prog,
cb8e9e
+                         int procnum, struct iobref *iobref,
cb8e9e
+                         xlator_t *this, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc)
cb8e9e
 {
cb8e9e
         char                    new_iobref  = 0;
cb8e9e
         int                     ret         = -1;
cb8e9e
@@ -309,25 +308,6 @@ out:
cb8e9e
 }
cb8e9e
 
cb8e9e
 
cb8e9e
-int
cb8e9e
-glusterd_submit_request (struct rpc_clnt *rpc, void *req,
cb8e9e
-                         call_frame_t *frame, rpc_clnt_prog_t *prog,
cb8e9e
-                         int procnum, struct iobref *iobref,
cb8e9e
-                         xlator_t *this, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc)
cb8e9e
-{
cb8e9e
-        glusterd_conf_t         *priv = THIS->private;
cb8e9e
-        int ret = -1;
cb8e9e
-
cb8e9e
-        synclock_unlock (&priv->big_lock);
cb8e9e
-        {
cb8e9e
-                ret = glusterd_submit_request_unlocked (rpc, req, frame, prog,
cb8e9e
-                                                        procnum, iobref, this,
cb8e9e
-                                                        cbkfn, xdrproc);
cb8e9e
-        }
cb8e9e
-        synclock_lock (&priv->big_lock);
cb8e9e
-
cb8e9e
-        return ret;
cb8e9e
-}
cb8e9e
 
cb8e9e
 
cb8e9e
 struct iobuf *
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e