From 9c9f3f368c693b1cf5f67f3d8d4e599d4ba61383 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Thu, 19 Mar 2015 10:09:04 +0530 Subject: libgfchangelog: Fix faulty reference to xlator context Problem: libgfchangelog initializes global xlator on library load (via constructor: _ctor) and mangles it's xlator context thereby messing with certain important members of the command structure. On receiving an RPC disconnection event, if the point-of-execution was in libgfchangelogs context, accessing ->cmd_args during RPC notify resulted in a segfault. Fix: Since the libarary needs to be able to work with processes that have a notion of an xlator (THIS in particular) and without it, care needs to be taken to allocate the global xlator when needed. Moreover, the actual fix is to use the correct xlator context in both cases. A new API is introduces when needs to be invoked by the conusmer (although this could have been done during register() call, keeping it a separate API makes thing flexible and easy). Test: The issue is observed when a brick process goes offline. This is triggered when test cases (.t's) are run in bulk, since each test essestially spawns bricks processes (on volume start) and terminates them (volume stop). Since bitrot daemon, as of now, spawns upon volume start, the issue is much observed when the volume is taken offline at the end of each test case. With this fix, running the basic and core test cases along with building the linux kernel has passed without daemon segfaults. Thanks to Johnny (rabhat@) for helping in debugging the issue (and with the fix :)). Change-Id: I8d3022bf749590b2ee816504ed9b1dfccc65559a BUG: 1170075 Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/9953 Reviewed-by: Vijay Bellur Tested-by: Vijay Bellur --- xlators/features/changelog/lib/examples/c/get-changes-multi.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'xlators/features/changelog/lib/examples/c') diff --git a/xlators/features/changelog/lib/examples/c/get-changes-multi.c b/xlators/features/changelog/lib/examples/c/get-changes-multi.c index 8f23c81c2a0..ae404bc7ad6 100644 --- a/xlators/features/changelog/lib/examples/c/get-changes-multi.c +++ b/xlators/features/changelog/lib/examples/c/get-changes-multi.c @@ -70,6 +70,10 @@ main (int argc, char **argv) brick++; fill_brick_spec (brick, "/export/z2/zwoop"); + ret = gf_changelog_init (NULL); + if (ret) + goto error_return; + ret = gf_changelog_register_generic ((struct gf_brick_spec *)bricks, 2, 1, "/tmp/multi-changes.log", 9, NULL); -- cgit