cluster: STABLE3 - rgmanager: Fix multiple event processing w/ EVENT_USER

Lon Hohberger lon at fedoraproject.org
Tue Oct 6 20:02:58 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4be8562fc103f2496ab5ed60caeddda5db2980d3
Commit:        4be8562fc103f2496ab5ed60caeddda5db2980d3
Parent:        156544eef7f19e934a0dbb2d6271c831151c82ff
Author:        Lon Hohberger <lhh at redhat.com>
AuthorDate:    Tue Oct 6 16:00:47 2009 -0400
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Tue Oct 6 16:02:20 2009 -0400

rgmanager: Fix multiple event processing w/ EVENT_USER

We were trying to send responses to each event, which
could cause a crash.

Resolves: bz527239

Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
 rgmanager/src/daemons/slang_event.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/rgmanager/src/daemons/slang_event.c b/rgmanager/src/daemons/slang_event.c
index 70a1a6e..de8aa61 100644
--- a/rgmanager/src/daemons/slang_event.c
+++ b/rgmanager/src/daemons/slang_event.c
@@ -1135,7 +1135,7 @@ S_service_event(const char *file, const char *script, char *name,
 
 static int
 S_user_event(const char *file, const char *script, char *name,
-	     int request, int arg1, int arg2, int target, msgctx_t *ctx)
+	     int request, int arg1, int arg2, int target, msgctx_t **ctx)
 {
 	int ret = RG_SUCCESS;
 
@@ -1159,20 +1159,21 @@ S_user_event(const char *file, const char *script, char *name,
 
 	/* XXX Send response code to caller - that 0 should be the
 	   new service owner, if there is one  */
-	if (ctx) {
+	if (*ctx) {
 		if (_user_return > 0) {
 			/* sl_start_service() squashes return code and
 			   node ID into one value.  <0 = error, >0 =
 			   success, return-value == node id running
 			   service */
-			send_ret(ctx, name, 0, request, _user_return);
+			send_ret(*ctx, name, 0, request, _user_return);
 		} else {
 			/* return value < 0 ... pass directly back;
 			   don't transpose */
-			send_ret(ctx, name, _user_return, request, 0);
+			send_ret(*ctx, name, _user_return, request, 0);
 		}
-		msg_close(ctx);
-		msg_free_ctx(ctx);
+		msg_close(*ctx);
+		msg_free_ctx(*ctx);
+		*ctx = NULL;
 	}
 	_user_return = 0;
 	return ret;
@@ -1213,7 +1214,7 @@ slang_do_script(event_t *pattern, event_t *ev)
 				ev->ev.user.u_arg1,
 				ev->ev.user.u_arg2,
 				ev->ev.user.u_target,
-				ev->ev.user.u_ctx);
+				&ev->ev.user.u_ctx);
 		break;
 	default:
 		break;


More information about the cluster-commits mailing list