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