21ab4e
From 3fdcdc960f8479be6216cc3f53b1972724fa0724 Mon Sep 17 00:00:00 2001
21ab4e
From: Jeff Darcy <jdarcy@redhat.com>
21ab4e
Date: Wed, 8 Feb 2017 10:48:55 -0500
21ab4e
Subject: [PATCH 327/361] trash: fix problem with trash feature under
21ab4e
 multiplexing
21ab4e
21ab4e
With multiplexing, the trash translator gets a reconfigure call before
21ab4e
a notify(CHILD_UP).  In this case, priv->trash_itable was not yet
21ab4e
initialized, so the reconfigure would get a SEGV.  Moving the itable
21ab4e
allocation to init seems to fix it, so trash can be reenabled.
21ab4e
21ab4e
mainline:
21ab4e
> BUG: 1420434
21ab4e
> Reviewed-on: https://review.gluster.org/16567
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Anoop C S <anoopcs@redhat.com>
21ab4e
> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
21ab4e
> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
21ab4e
(cherry picked from commit 077db9dbc551877cbd32b50c4491ba99c8ec5032)
21ab4e
21ab4e
BUG: 1417815
21ab4e
Change-Id: I21ac2d7fc66bac1bc4ec70fbc8bae306d73ac565
21ab4e
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/101308
21ab4e
Tested-by: Milind Changire <mchangir@redhat.com>
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 tests/basic/multiplex.t                     | 4 +++-
21ab4e
 xlators/features/trash/src/trash.c          | 6 +++---
21ab4e
 xlators/mgmt/glusterd/src/glusterd-volgen.c | 6 ------
21ab4e
 3 files changed, 6 insertions(+), 10 deletions(-)
21ab4e
21ab4e
diff --git a/tests/basic/multiplex.t b/tests/basic/multiplex.t
21ab4e
index bff3efb..819ff40 100644
21ab4e
--- a/tests/basic/multiplex.t
21ab4e
+++ b/tests/basic/multiplex.t
21ab4e
@@ -14,10 +14,12 @@ function count_brick_pids {
21ab4e
 }
21ab4e
 
21ab4e
 TEST glusterd
21ab4e
-TEST $CLI volume set all cluster.brick-multiplex yes
21ab4e
+TEST $CLI volume set all cluster.brick-multiplex on
21ab4e
 push_trapfunc "$CLI volume set all cluster.brick-multiplex off"
21ab4e
 push_trapfunc "cleanup"
21ab4e
+
21ab4e
 TEST $CLI volume create $V0 $H0:$B0/brick{0,1}
21ab4e
+TEST $CLI volume set $V0 features.trash enable
21ab4e
 
21ab4e
 TEST $CLI volume start $V0
21ab4e
 # Without multiplexing, there would be two.
21ab4e
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
21ab4e
index fd5507f..0e8cf79 100644
21ab4e
--- a/xlators/features/trash/src/trash.c
21ab4e
+++ b/xlators/features/trash/src/trash.c
21ab4e
@@ -2170,9 +2170,8 @@ notify (xlator_t *this, int event, void *data, ...)
21ab4e
                         goto out;
21ab4e
                 }
21ab4e
 
21ab4e
-                dict = dict_new ();
21ab4e
-                if (!dict) {
21ab4e
-                        ret = ENOMEM;
21ab4e
+                if (!priv->state) {
21ab4e
+                        gf_log (this->name, GF_LOG_DEBUG, "trash xlator is off");
21ab4e
                         goto out;
21ab4e
                 }
21ab4e
                 priv->trash_itable = inode_table_new (0, this);
21ab4e
@@ -2473,6 +2472,7 @@ init (xlator_t *this)
21ab4e
                 goto out;
21ab4e
         }
21ab4e
 
21ab4e
+        priv->trash_itable = inode_table_new (0, this);
21ab4e
         gf_log (this->name, GF_LOG_DEBUG, "brick path is%s", priv->brick_path);
21ab4e
 
21ab4e
         this->private = (void *)priv;
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
21ab4e
index 3f35eae..f661b8d 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
21ab4e
@@ -1506,7 +1506,6 @@ out:
21ab4e
         return ret;
21ab4e
 }
21ab4e
 
21ab4e
-#if 0
21ab4e
 static int
21ab4e
 brick_graph_add_trash (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
21ab4e
                         dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
21ab4e
@@ -1529,7 +1528,6 @@ brick_graph_add_trash (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
21ab4e
 out:
21ab4e
         return ret;
21ab4e
 }
21ab4e
-#endif
21ab4e
 
21ab4e
 static int
21ab4e
 brick_graph_add_decompounder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
21ab4e
@@ -2346,11 +2344,7 @@ static volgen_brick_xlator_t server_graph_table[] = {
21ab4e
         {brick_graph_add_changetimerecorder, "changetimerecorder"},
21ab4e
 #endif
21ab4e
         {brick_graph_add_bd, "bd"},
21ab4e
-        /*
21ab4e
-         * TBD: Figure out why trash breaks multiplexing.  AFAICT it should fail
21ab4e
-         * the same way already.
21ab4e
         {brick_graph_add_trash, "trash"},
21ab4e
-         */
21ab4e
         {brick_graph_add_arbiter, "arbiter"},
21ab4e
         {brick_graph_add_posix, "posix"},
21ab4e
 };
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e