Re: [Openais] [PATCH 7/7] lib/msg.c: Handle error codes from coroipc and similar functions
ACK. On Wed, May 06, 2009 at 06:29:22PM +0200, Jan Friesse wrote: > --- > trunk/lib/msg.c | 75 -- > 1 files changed, 61 insertions(+), 14 deletions(-) > > diff --git a/trunk/lib/msg.c b/trunk/lib/msg.c > index cc0a9b5..2c688f9 100644 > --- a/trunk/lib/msg.c > +++ b/trunk/lib/msg.c > @@ -665,6 +665,9 @@ saMsgQueueClose ( > 1, > &res_lib_msg_queueclose, > sizeof (struct res_lib_msg_queueclose)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queueclose.header.error != SA_AIS_OK) { > error = res_lib_msg_queueclose.header.error; > @@ -721,8 +724,9 @@ saMsgQueueStatusGet ( > 1, > &res_lib_msg_queuestatusget, > sizeof (struct res_lib_msg_queuestatusget)); > - > - /* if (error != SA_AIS_OK) */ > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queuestatusget.header.error != SA_AIS_OK) { > error = res_lib_msg_queuestatusget.header.error; > @@ -782,6 +786,9 @@ saMsgQueueRetentionTimeSet ( > 1, > &res_lib_msg_queueretentiontimeset, > sizeof (struct res_lib_msg_queueretentiontimeset)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queueretentiontimeset.header.error != SA_AIS_OK) { > error = res_lib_msg_queueretentiontimeset.header.error; > @@ -837,6 +844,9 @@ saMsgQueueUnlink ( > 1, > &res_lib_msg_queueunlink, > sizeof (struct res_lib_msg_queueunlink)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queueunlink.header.error != SA_AIS_OK) { > error = res_lib_msg_queueunlink.header.error; > @@ -895,6 +905,9 @@ saMsgQueueGroupCreate ( > 1, > &res_lib_msg_queuegroupcreate, > sizeof (struct res_lib_msg_queuegroupcreate)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queuegroupcreate.header.error != SA_AIS_OK) { > error = res_lib_msg_queuegroupcreate.header.error; > @@ -953,6 +966,9 @@ saMsgQueueGroupInsert ( > 1, > &res_lib_msg_queuegroupinsert, > sizeof (struct res_lib_msg_queuegroupinsert)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queuegroupinsert.header.error != SA_AIS_OK) { > error = res_lib_msg_queuegroupinsert.header.error; > @@ -1012,6 +1028,10 @@ saMsgQueueGroupRemove ( > &res_lib_msg_queuegroupremove, > sizeof (struct res_lib_msg_queuegroupremove)); > > + if (error != SA_AIS_OK) { > + goto error_put; > + } > + > if (res_lib_msg_queuegroupremove.header.error != SA_AIS_OK) { > error = res_lib_msg_queuegroupremove.header.error; > goto error_put; /* ! */ > @@ -1066,6 +1086,9 @@ saMsgQueueGroupDelete ( > 1, > &res_lib_msg_queuegroupdelete, > sizeof (struct res_lib_msg_queuegroupdelete)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queuegroupdelete.header.error != SA_AIS_OK) { > error = res_lib_msg_queuegroupdelete.header.error; > @@ -1152,6 +1175,9 @@ saMsgQueueGroupTrack ( > &iov, > 1, > &buffer); > + if (error != SA_AIS_OK) { > + goto error_unlock; > + } > > res_lib_msg_queuegrouptrack = buffer; > > @@ -1227,6 +1253,9 @@ saMsgQueueGroupTrackStop ( > 1, > &res_lib_msg_queuegrouptrackstop, > sizeof (struct res_lib_msg_queuegrouptrackstop)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queuegrouptrackstop.header.error != SA_AIS_OK) { > error = res_lib_msg_queuegrouptrackstop.header.error; > @@ -1274,6 +1303,9 @@ saMsgQueueGroupNotificationFree ( > 1, > &res_lib_msg_queuegroupnotificationfree, > sizeof (struct res_lib_msg_queuegroupnotificationfree)); > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_queuegroupnotificationfree.header.error != SA_AIS_OK) { > error = res_lib_msg_queuegroupnotificationfree.header.error; > @@ -1348,8 +1380,9 @@ saMsgMessageSend ( > 2, > &res_lib_msg_messagesend, > sizeof (struct res_lib_msg_messagesend)); > - > - /* if (error != SA_AIS_OK) */ > + if (error != SA_AIS_OK) { > + goto error_put; > + } > > if (res_lib_msg_messagesend.header.error != SA_AIS_OK) { > error = res_lib_msg_messa
Re: [Openais] [PATCH 6/7] service/msg.c: Return SA_AIS_ERR_NOT_EXIST as specification says
Same as before. I don't think we care about retentionTime. On Wed, May 06, 2009 at 06:29:21PM +0200, Jan Friesse wrote: > See P35 1-2 > --- > trunk/services/msg.c | 98 +++-- > 1 files changed, 54 insertions(+), 44 deletions(-) > > diff --git a/trunk/services/msg.c b/trunk/services/msg.c > index 12ea394..486fe9e 100644 > --- a/trunk/services/msg.c > +++ b/trunk/services/msg.c > @@ -2483,6 +2483,31 @@ static void message_handler_req_exec_msg_queueopen ( > log_printf (LOGSYS_LEVEL_DEBUG, "\t queue = %s\n", > (char *)(req_exec_msg_queueopen->queue_name.value)); > > + queue = msg_find_queue (&queue_list_head, > + &req_exec_msg_queueopen->queue_name); > + > + /* Make some tests*/ > + if (queue == NULL) { > + if ((req_exec_msg_queueopen->create_attrs_flag == 0) || > + (req_exec_msg_queueopen->open_flags & SA_MSG_QUEUE_CREATE) > == 0) > + { > + error = SA_AIS_ERR_NOT_EXIST; > + goto error_exit; > + } > + } else { > + /* Test, if flags are same as creation flags*/ > + if ((req_exec_msg_queueopen->create_attrs.creationFlags != > queue->create_attrs.creationFlags) || > + (req_exec_msg_queueopen->create_attrs.retentionTime != > queue->create_attrs.retentionTime) || > + (memcmp (req_exec_msg_queueopen->create_attrs.size, > + queue->create_attrs.size, > + sizeof (queue->create_attrs.size)) != 0)) { > + /*Return error*/ > + error = SA_AIS_ERR_EXIST; > + > + goto error_exit; > + } > + } > + > for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= > SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) { > if (req_exec_msg_queueopen->create_attrs.size[i] > > MAX_PRIORITY_AREA_SIZE) { > error = SA_AIS_ERR_TOO_BIG; > @@ -2507,17 +2532,8 @@ static void message_handler_req_exec_msg_queueopen ( > goto error_exit; > } > > - queue = msg_find_queue (&queue_list_head, > - &req_exec_msg_queueopen->queue_name); > > if (queue == NULL) { > - if ((req_exec_msg_queueopen->create_attrs_flag == 0) || > - (req_exec_msg_queueopen->open_flags & SA_MSG_QUEUE_CREATE) > == 0) > - { > - error = SA_AIS_ERR_NOT_EXIST; > - goto error_exit; > - } > - > queue = malloc (sizeof (struct queue_entry)); > if (queue == NULL) { > error = SA_AIS_ERR_NO_MEMORY; > @@ -2552,17 +2568,6 @@ static void message_handler_req_exec_msg_queueopen ( > queue->refcount = 0; > } > else { > - /* Test, if flags are same as creation flags*/ > - if ((req_exec_msg_queueopen->create_attrs.creationFlags != > queue->create_attrs.creationFlags) || > - (req_exec_msg_queueopen->create_attrs.retentionTime != > queue->create_attrs.retentionTime) || > - (memcmp (req_exec_msg_queueopen->create_attrs.size, > - queue->create_attrs.size, > - sizeof (queue->create_attrs.size)) != 0)) { > - /*Return error*/ > - error = SA_AIS_ERR_EXIST; > - > - goto error_exit; > - } > if (queue->timer_handle != 0) { > api->timer_delete (queue->timer_handle); > } > @@ -2609,7 +2614,8 @@ error_exit: > list_add_tail (&cleanup->list, > &msg_pd->queue_cleanup_list); > } > else { > - free (cleanup); > + if (cleanup) > + free (cleanup); > } > > api->ipc_response_send ( > @@ -2643,6 +2649,31 @@ static void > message_handler_req_exec_msg_queueopenasync ( > log_printf (LOGSYS_LEVEL_DEBUG, "\t queue = %s\n", > (char *)(req_exec_msg_queueopenasync->queue_name.value)); > > + queue = msg_find_queue (&queue_list_head, > + &req_exec_msg_queueopenasync->queue_name); > + > + /* Make some tests*/ > + if (queue == NULL) { > + if ((req_exec_msg_queueopenasync->create_attrs_flag == 0) || > + (req_exec_msg_queueopenasync->open_flags & > SA_MSG_QUEUE_CREATE) == 0) > + { > + error = SA_AIS_ERR_NOT_EXIST; > + goto error_exit; > + } > + } else { > + /* Test, if flags are same as creation flags*/ > + if ((req_exec_msg_queueopenasync->create_attrs.creationFlags != > queue->create_attrs.creationFlags) || > + (req_exec_msg_queueopenasync->create_attrs.retentionTime != > queue->creat
Re: [Openais] [PATCH 5/7] lib/msg.c: Handle creationFlags and coroipcc_msg_send_reply_receive errors
ACK. On Wed, May 06, 2009 at 06:29:20PM +0200, Jan Friesse wrote: > --- > trunk/lib/msg.c | 49 ++--- > 1 files changed, 42 insertions(+), 7 deletions(-) > > diff --git a/trunk/lib/msg.c b/trunk/lib/msg.c > index b12eb2b..cc0a9b5 100644 > --- a/trunk/lib/msg.c > +++ b/trunk/lib/msg.c > @@ -385,6 +385,24 @@ saMsgQueueOpen ( > goto error_exit; > } > > + if ((!(openFlags & SA_MSG_QUEUE_CREATE)) && creationAttributes != NULL) > { > + error = SA_AIS_ERR_INVALID_PARAM; > + goto error_exit; > + } > + > + if (openFlags & SA_MSG_QUEUE_CREATE) { > + if (creationAttributes == NULL) { > + error = SA_AIS_ERR_INVALID_PARAM; > + goto error_put; > + } > + > + if ((creationAttributes->creationFlags != 0) && > + (creationAttributes->creationFlags != SA_MSG_QUEUE_PERSISTENT)) > { > + error = SA_AIS_ERR_BAD_FLAGS; > + goto error_exit; > + } > + } > + > error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase, > msgHandle, (void *)&msgInstance)); > if (error != SA_AIS_OK) { > @@ -447,7 +465,9 @@ saMsgQueueOpen ( > &res_lib_msg_queueopen, > sizeof (struct res_lib_msg_queueopen)); > > - /* if (error != SA_AIS_OK) */ > + if (error != SA_AIS_OK) { > + goto error_put_destroy; > + } > > if (res_lib_msg_queueopen.header.error != SA_AIS_OK) { > error = res_lib_msg_queueopen.header.error; > @@ -496,17 +516,30 @@ saMsgQueueOpenAsync ( > goto error_exit; > } > > - error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase, > - msgHandle, (void *)&msgInstance)); > - if (error != SA_AIS_OK) { > + if ((!(openFlags & SA_MSG_QUEUE_CREATE)) && creationAttributes != NULL) > { > + error = SA_AIS_ERR_INVALID_PARAM; > goto error_exit; > } > > - if ((openFlags & SA_MSG_QUEUE_CREATE) && > - (creationAttributes == NULL)) { > + if (openFlags & SA_MSG_QUEUE_CREATE) { > + if (creationAttributes == NULL) { > error = SA_AIS_ERR_INVALID_PARAM; > goto error_put; > + } > + > + if ((creationAttributes->creationFlags != 0) && > + (creationAttributes->creationFlags != SA_MSG_QUEUE_PERSISTENT)) > { > + error = SA_AIS_ERR_BAD_FLAGS; > + goto error_exit; > + } > + } > + > + error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase, > + msgHandle, (void *)&msgInstance)); > + if (error != SA_AIS_OK) { > + goto error_exit; > } > + > if ((openFlags & SA_MSG_QUEUE_RECEIVE_CALLBACK) && > (msgInstance->callbacks.saMsgMessageReceivedCallback == NULL)) { > error = SA_AIS_ERR_INIT; > @@ -567,7 +600,9 @@ saMsgQueueOpenAsync ( > &res_lib_msg_queueopenasync, > sizeof (struct res_lib_msg_queueopenasync)); > > - /* if (error != SA_AIS_OK) */ > + if (error != SA_AIS_OK) { > + goto error_put_destroy; > + } > > if (res_lib_msg_queueopenasync.header.error != SA_AIS_OK) { > error = res_lib_msg_queueopenasync.header.error; > -- > 1.5.5.6 > > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH 1/7] lib/msg.c: queueHandle should'n be NULL
ACK. On Wed, May 06, 2009 at 06:29:16PM +0200, Jan Friesse wrote: > --- > trunk/lib/msg.c |4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/trunk/lib/msg.c b/trunk/lib/msg.c > index eaabdf2..b12eb2b 100644 > --- a/trunk/lib/msg.c > +++ b/trunk/lib/msg.c > @@ -380,7 +380,7 @@ saMsgQueueOpen ( > /* DEBUG */ > printf ("[DEBUG]: saMsgQueueOpen\n"); > > - if (queueName == NULL) { > + if (queueName == NULL || queueHandle == NULL) { > error = SA_AIS_ERR_INVALID_PARAM; > goto error_exit; > } > @@ -395,7 +395,7 @@ saMsgQueueOpen ( > (msgInstance->callbacks.saMsgMessageReceivedCallback == NULL)) > { > error = SA_AIS_ERR_INIT; > - goto error_exit; > + goto error_put; > } > > error = hdb_error_to_sa (hdb_handle_create (&queueHandleDatabase, > -- > 1.5.5.6 > > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH 4/7] service/msg.c: Handle opening existing queue with different attributes
This is one of the problems with open I was referring to yesterday. Note that a recent patch I committed to trunk puts the creation attributes in the queueInstance, so I think this check could be moved to the library. Also, I *think* that you do not want to compare retentionTime. I believe the spec states that all creation attributes should match with the exception of retentionTime, which is ignored. Ryan On Wed, May 06, 2009 at 06:29:19PM +0200, Jan Friesse wrote: > See P33-13:P33-14 > --- > trunk/services/msg.c | 23 +++ > 1 files changed, 23 insertions(+), 0 deletions(-) > > diff --git a/trunk/services/msg.c b/trunk/services/msg.c > index 4e91202..12ea394 100644 > --- a/trunk/services/msg.c > +++ b/trunk/services/msg.c > @@ -2552,6 +2552,17 @@ static void message_handler_req_exec_msg_queueopen ( > queue->refcount = 0; > } > else { > + /* Test, if flags are same as creation flags*/ > + if ((req_exec_msg_queueopen->create_attrs.creationFlags != > queue->create_attrs.creationFlags) || > + (req_exec_msg_queueopen->create_attrs.retentionTime != > queue->create_attrs.retentionTime) || > + (memcmp (req_exec_msg_queueopen->create_attrs.size, > + queue->create_attrs.size, > + sizeof (queue->create_attrs.size)) != 0)) { > + /*Return error*/ > + error = SA_AIS_ERR_EXIST; > + > + goto error_exit; > + } > if (queue->timer_handle != 0) { > api->timer_delete (queue->timer_handle); > } > @@ -2701,6 +2712,18 @@ static void > message_handler_req_exec_msg_queueopenasync ( > queue->refcount = 0; > } > else { > + /* Test, if flags are same as creation flags*/ > + if ((req_exec_msg_queueopenasync->create_attrs.creationFlags != > queue->create_attrs.creationFlags) || > + (req_exec_msg_queueopenasync->create_attrs.retentionTime != > queue->create_attrs.retentionTime) || > + (memcmp (req_exec_msg_queueopenasync->create_attrs.size, > + queue->create_attrs.size, > + sizeof (queue->create_attrs.size)) != 0)) { > + /*Return error*/ > + error = SA_AIS_ERR_EXIST; > + > + goto error_exit; > + } > + > if (queue->timer_handle != 0) { > api->timer_delete (queue->timer_handle); > } > -- > 1.5.5.6 > > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH] corosync/trunk: fix logsys format oversight
Hi, while doing integration with cluster I missed 2 bits to be compliant with the agreed cluster logging format. The patch in attachment address the 2 remaining issues. current format: May 6 14:03:48 [subsys] message correct format: May 06 14:14:02 daemon_name [subsys] message add correct date padding (makes it easier to use same regexp to grep across logs) and daemon_name (important when logging all to the same file). Fabio Index: exec/logsys.c === --- exec/logsys.c (revision 2171) +++ exec/logsys.c (working copy) @@ -368,7 +368,7 @@ case 't': gettimeofday (&tv, NULL); - (void)strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S", localtime ((time_t *)&tv.tv_sec)); + (void)strftime (char_time, sizeof (char_time), "%b %d %T", localtime ((time_t *)&tv.tv_sec)); len = strcpy_cutoff (&output_buffer[output_buffer_idx], char_time, cutoff); output_buffer_idx += len; break; Index: exec/main.c === --- exec/main.c (revision 2171) +++ exec/main.c (working copy) @@ -92,7 +92,7 @@ LOG_DAEMON, LOG_INFO, 0, - NULL, + "corosync [%6s] %b", 100); LOGSYS_DECLARE_SUBSYS ("MAIN"); ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] saCkptSectionIterationNext() error
I think we may have lost something in transit between irc/email/svn, Mar 26 16:10:20confchg, node1 create ckpt, node2 open ckpt, node2 read ckpt -> fail Mar 26 16:10:46nodeid 1 creates the ckpt Mar 26 16:13:42saCkptCheckpointOpen() works, saCkptSectionIterationInitialize() works, then saCkptSectionIterationNext() fails Mar 26 16:30:34 wow iteration fails straight up single node Mar 26 16:30:39 that was working like 1 week ago or less Mar 26 16:52:30 dct found problem Mar 26 16:52:32 patch coming to list now This looks like the patch, but I don't see it in svn https://lists.linux-foundation.org/pipermail/openais/2009-March/011048.html And I'm still getting error 9 (BAD_HANDLE) from saCkptSectionIterationNext(). Dave ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] Results of SAFTest for msg service after patches
nice improvements so far. regards -steve On Wed, 2009-05-06 at 18:20 +0200, Jan Friesse wrote: > Only for information. After apply all patches I send, you should get > something like: > SA Forum AIS Function NamePassing Tests Passing Percentage > saMsgQueueUnlink 19 of 19100.0% > saMsgQueueOpenAsync 27 of 3675.0% > saMsgQueueClose 10 of 1471.4% > saMsgQueueOpenCallback7 of 7 100.0% > saMsgQueueStatusGet 10 of 1283.3% > saMsgQueueOpen37 of 3897.4% > saMsgMessageSendReceive 7 of 35 20.0% > saMsgMessageDeliveredCallback 4 of 10 40.0% > saMsgMessageReceivedCallback 4 of 5 80.0% > saMsgMessageCancel3 of 10 30.0% > saMsgMessageReply 5 of 23 21.7% > saMsgMessageReplyAsync5 of 23 21.7% > saMsgMessageSendAsync 20 of 2969.0% > saMsgMessageGet 21 of 2777.8% > saMsgMessageSend 16 of 2272.7% > saMsgQueueGroupDelete 11 of 1291.7% > saMsgQueueGroupInsert 17 of 17100.0% > saMsgQueueGroupTrackCallback 3 of 10 30.0% > saMsgQueueGroupRemove 17 of 17100.0% > saMsgQueueGroupTrackStop 10 of 1283.3% > saMsgQueueGroupTrack 21 of 2680.8% > saMsgQueueGroupCreate 11 of 1291.7% > saMsgFinalize 9 of 9 100.0% > saMsgInitialize 15 of 15100.0% > saMsgDispatch 10 of 1190.9% > saMsgSelectionObjectGet 10 of 10100.0% > > Not so bad, isn't it? > > Regards, > Honza > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] detecting cpg joiners
On Wed, May 06, 2009 at 02:10:27PM -0700, Steven Dake wrote: > On Wed, 2009-05-06 at 15:04 -0500, David Teigland wrote: > > On Mon, Apr 13, 2009 at 02:17:00PM -0500, David Teigland wrote: > > > On Mon, Apr 13, 2009 at 12:10:33PM -0700, Steven Dake wrote: > > > > On Mon, 2009-04-13 at 13:35 -0500, David Teigland wrote: > > > > > 0. configure token timeout to some long time that is longer than all > > > > > the > > > > >following steps take > > > > > > > > > > 1. cluster members are nodeid's: 1,2,3,4 > > > > > > > > > > 2. cpg foo has the following members: > > > > >nodeid 1, pid 10 > > > > >nodeid 2, pid 20 > > > > >nodeid 3, pid 30 > > > > >nodeid 4, pid 40 > > > > > > > > > > 3. nodeid 4: ifdown eth0, kill corosync, kill pid 40 > > > > >(optionally reboot this node now) > > > > > > > > > > 4. nodeid 4: ifup eth0, start corosync > > > > > > > > > > 5. members of cpg foo (1:10, 2:20, 3:30) all get a confchg > > > > >showing that 4:40 is not a member > > > > > > > > > > 6. nodeid 4: start process pid 41 that joins cpg foo > > > > > > > > > > 7. members of cpg foo (1:10, 2:20, 3:30, 4:41) all get a confchg > > > > >showing that 4:41 is a member > > > > > > > > > > (Steps 6 and 7 should work the same even if the process started in > > > > > step 6 > > > > > has pid 40 instead of pid 41.) > > > > > > > 100% agree that is how it should work. If it doesn't, we will fix it. > > > > The only thing that may be strange is if pid in step 6 is the same pid > > > > as 40. Are you certain the test case which fails has a differing pid at > > > > step 6? > > > > > > If you fix step 5, then I suspect steps 6,7 will "just work". After the > > > test > > > failed at step 5 I didn't pay too much attention to 6,7... but I'm sure > > > that > > > the pid in step 6 was different (I didn't reboot the node). > > > > It's not clear what the plan was for this, any recent related changes I > > should > > try? > > Dave > > > > I haven't tried corosync with this test case, but it should work now. > Did you try latest corosync on this case? If it still fails Jan can > address before 1.0. Just tried it, and I get the same behavior as before. Dave ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] detecting cpg joiners
On Wed, 2009-05-06 at 15:04 -0500, David Teigland wrote: > On Mon, Apr 13, 2009 at 02:17:00PM -0500, David Teigland wrote: > > On Mon, Apr 13, 2009 at 12:10:33PM -0700, Steven Dake wrote: > > > On Mon, 2009-04-13 at 13:35 -0500, David Teigland wrote: > > > > 0. configure token timeout to some long time that is longer than all the > > > >following steps take > > > > > > > > 1. cluster members are nodeid's: 1,2,3,4 > > > > > > > > 2. cpg foo has the following members: > > > >nodeid 1, pid 10 > > > >nodeid 2, pid 20 > > > >nodeid 3, pid 30 > > > >nodeid 4, pid 40 > > > > > > > > 3. nodeid 4: ifdown eth0, kill corosync, kill pid 40 > > > >(optionally reboot this node now) > > > > > > > > 4. nodeid 4: ifup eth0, start corosync > > > > > > > > 5. members of cpg foo (1:10, 2:20, 3:30) all get a confchg > > > >showing that 4:40 is not a member > > > > > > > > 6. nodeid 4: start process pid 41 that joins cpg foo > > > > > > > > 7. members of cpg foo (1:10, 2:20, 3:30, 4:41) all get a confchg > > > >showing that 4:41 is a member > > > > > > > > (Steps 6 and 7 should work the same even if the process started in step > > > > 6 > > > > has pid 40 instead of pid 41.) > > > > > 100% agree that is how it should work. If it doesn't, we will fix it. > > > The only thing that may be strange is if pid in step 6 is the same pid > > > as 40. Are you certain the test case which fails has a differing pid at > > > step 6? > > > > If you fix step 5, then I suspect steps 6,7 will "just work". After the > > test > > failed at step 5 I didn't pay too much attention to 6,7... but I'm sure that > > the pid in step 6 was different (I didn't reboot the node). > > It's not clear what the plan was for this, any recent related changes I should > try? > Dave > I haven't tried corosync with this test case, but it should work now. Did you try latest corosync on this case? If it still fails Jan can address before 1.0. Regards -steve > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] detecting cpg joiners
On Mon, Apr 13, 2009 at 02:17:00PM -0500, David Teigland wrote: > On Mon, Apr 13, 2009 at 12:10:33PM -0700, Steven Dake wrote: > > On Mon, 2009-04-13 at 13:35 -0500, David Teigland wrote: > > > 0. configure token timeout to some long time that is longer than all the > > >following steps take > > > > > > 1. cluster members are nodeid's: 1,2,3,4 > > > > > > 2. cpg foo has the following members: > > >nodeid 1, pid 10 > > >nodeid 2, pid 20 > > >nodeid 3, pid 30 > > >nodeid 4, pid 40 > > > > > > 3. nodeid 4: ifdown eth0, kill corosync, kill pid 40 > > >(optionally reboot this node now) > > > > > > 4. nodeid 4: ifup eth0, start corosync > > > > > > 5. members of cpg foo (1:10, 2:20, 3:30) all get a confchg > > >showing that 4:40 is not a member > > > > > > 6. nodeid 4: start process pid 41 that joins cpg foo > > > > > > 7. members of cpg foo (1:10, 2:20, 3:30, 4:41) all get a confchg > > >showing that 4:41 is a member > > > > > > (Steps 6 and 7 should work the same even if the process started in step 6 > > > has pid 40 instead of pid 41.) > > > 100% agree that is how it should work. If it doesn't, we will fix it. > > The only thing that may be strange is if pid in step 6 is the same pid > > as 40. Are you certain the test case which fails has a differing pid at > > step 6? > > If you fix step 5, then I suspect steps 6,7 will "just work". After the test > failed at step 5 I didn't pay too much attention to 6,7... but I'm sure that > the pid in step 6 was different (I didn't reboot the node). It's not clear what the plan was for this, any recent related changes I should try? Dave ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH 3/7] service/msg.c: message_handler_req_exec_msg_messageget test if msg is NULL
ACK. On Wed, May 06, 2009 at 06:29:18PM +0200, Jan Friesse wrote: > This solves another segfault in msg service (and corosync). > --- > trunk/services/msg.c | 10 +- > 1 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/trunk/services/msg.c b/trunk/services/msg.c > index 00f339d..4e91202 100644 > --- a/trunk/services/msg.c > +++ b/trunk/services/msg.c > @@ -3821,7 +3821,7 @@ static void message_handler_req_exec_msg_messageget ( > &req_exec_msg_messageget->queue_name, > req_exec_msg_messageget->queue_id); > if (queue == NULL) { > - error = SA_AIS_ERR_NOT_EXIST; > + error = SA_AIS_ERR_BAD_HANDLE; > goto error_exit; > } > > @@ -3887,9 +3887,6 @@ error_exit: > MESSAGE_RES_MSG_MESSAGEGET; > res_lib_msg_messageget.header.error = error; > > - memcpy (&res_lib_msg_messageget.message, &msg->message, > - sizeof (SaMsgMessageT)); /* ? */ > - > iov[0].iov_base = &res_lib_msg_messageget; > iov[0].iov_len = sizeof (struct res_lib_msg_messageget); > > @@ -3897,6 +3894,8 @@ error_exit: > iov[1].iov_base = msg->message.data; > iov[1].iov_len = msg->message.size; > > + memcpy (&res_lib_msg_messageget.message, &msg->message, > + sizeof (SaMsgMessageT)); /* ? */ > api->ipc_response_iov_send > (req_exec_msg_messageget->source.conn, iov, 2); > } > else { > @@ -3904,7 +3903,8 @@ error_exit: > } > } > > - free (msg); > + if (msg != NULL) > + free (msg); > } > > static void message_handler_req_exec_msg_messagedatafree ( > -- > 1.5.5.6 > > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH 2/7] services/msg.c: message_handler_req_exec_msg_messagesendasync - test error and then queue
ACK. Nice job finding this one. On Wed, May 06, 2009 at 06:29:17PM +0200, Jan Friesse wrote: > This solves one of segfaults of msg service (and whole corosync) > --- > trunk/services/msg.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/trunk/services/msg.c b/trunk/services/msg.c > index 17a50f9..00f339d 100644 > --- a/trunk/services/msg.c > +++ b/trunk/services/msg.c > @@ -3769,7 +3769,7 @@ error_exit: > &res_lib_msg_messagedelivered_callback, > sizeof (struct res_lib_msg_messagedelivered_callback)); > > - if ((queue->open_flags & SA_MSG_QUEUE_RECEIVE_CALLBACK) && > (error == SA_AIS_OK)) > + if ((error == SA_AIS_OK) && (queue->open_flags & > SA_MSG_QUEUE_RECEIVE_CALLBACK)) > { > res_lib_msg_messagereceived_callback.header.size = > sizeof (struct > res_lib_msg_messagereceived_callback); > -- > 1.5.5.6 > > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH 6/7] service/msg.c: Return SA_AIS_ERR_NOT_EXIST as specification says
See P35 1-2 --- trunk/services/msg.c | 98 +++-- 1 files changed, 54 insertions(+), 44 deletions(-) diff --git a/trunk/services/msg.c b/trunk/services/msg.c index 12ea394..486fe9e 100644 --- a/trunk/services/msg.c +++ b/trunk/services/msg.c @@ -2483,6 +2483,31 @@ static void message_handler_req_exec_msg_queueopen ( log_printf (LOGSYS_LEVEL_DEBUG, "\t queue = %s\n", (char *)(req_exec_msg_queueopen->queue_name.value)); + queue = msg_find_queue (&queue_list_head, + &req_exec_msg_queueopen->queue_name); + + /* Make some tests*/ + if (queue == NULL) { + if ((req_exec_msg_queueopen->create_attrs_flag == 0) || + (req_exec_msg_queueopen->open_flags & SA_MSG_QUEUE_CREATE) == 0) + { + error = SA_AIS_ERR_NOT_EXIST; + goto error_exit; + } + } else { + /* Test, if flags are same as creation flags*/ + if ((req_exec_msg_queueopen->create_attrs.creationFlags != queue->create_attrs.creationFlags) || + (req_exec_msg_queueopen->create_attrs.retentionTime != queue->create_attrs.retentionTime) || + (memcmp (req_exec_msg_queueopen->create_attrs.size, + queue->create_attrs.size, + sizeof (queue->create_attrs.size)) != 0)) { + /*Return error*/ + error = SA_AIS_ERR_EXIST; + + goto error_exit; + } + } + for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) { if (req_exec_msg_queueopen->create_attrs.size[i] > MAX_PRIORITY_AREA_SIZE) { error = SA_AIS_ERR_TOO_BIG; @@ -2507,17 +2532,8 @@ static void message_handler_req_exec_msg_queueopen ( goto error_exit; } - queue = msg_find_queue (&queue_list_head, - &req_exec_msg_queueopen->queue_name); if (queue == NULL) { - if ((req_exec_msg_queueopen->create_attrs_flag == 0) || - (req_exec_msg_queueopen->open_flags & SA_MSG_QUEUE_CREATE) == 0) - { - error = SA_AIS_ERR_NOT_EXIST; - goto error_exit; - } - queue = malloc (sizeof (struct queue_entry)); if (queue == NULL) { error = SA_AIS_ERR_NO_MEMORY; @@ -2552,17 +2568,6 @@ static void message_handler_req_exec_msg_queueopen ( queue->refcount = 0; } else { - /* Test, if flags are same as creation flags*/ - if ((req_exec_msg_queueopen->create_attrs.creationFlags != queue->create_attrs.creationFlags) || - (req_exec_msg_queueopen->create_attrs.retentionTime != queue->create_attrs.retentionTime) || - (memcmp (req_exec_msg_queueopen->create_attrs.size, - queue->create_attrs.size, - sizeof (queue->create_attrs.size)) != 0)) { - /*Return error*/ - error = SA_AIS_ERR_EXIST; - - goto error_exit; - } if (queue->timer_handle != 0) { api->timer_delete (queue->timer_handle); } @@ -2609,7 +2614,8 @@ error_exit: list_add_tail (&cleanup->list, &msg_pd->queue_cleanup_list); } else { - free (cleanup); + if (cleanup) + free (cleanup); } api->ipc_response_send ( @@ -2643,6 +2649,31 @@ static void message_handler_req_exec_msg_queueopenasync ( log_printf (LOGSYS_LEVEL_DEBUG, "\t queue = %s\n", (char *)(req_exec_msg_queueopenasync->queue_name.value)); + queue = msg_find_queue (&queue_list_head, + &req_exec_msg_queueopenasync->queue_name); + + /* Make some tests*/ + if (queue == NULL) { + if ((req_exec_msg_queueopenasync->create_attrs_flag == 0) || + (req_exec_msg_queueopenasync->open_flags & SA_MSG_QUEUE_CREATE) == 0) + { + error = SA_AIS_ERR_NOT_EXIST; + goto error_exit; + } + } else { + /* Test, if flags are same as creation flags*/ + if ((req_exec_msg_queueopenasync->create_attrs.creationFlags != queue->create_attrs.creationFlags) || + (req_exec_msg_queueopenasync->create_attrs.retentionTime != queue->create_attrs.retentionTime) || + (memcmp (req_exec_msg_queueopenasync->create_attrs.size, + queue->create_attrs.size, + sizeof (queue-
[Openais] [PATCH 7/7] lib/msg.c: Handle error codes from coroipc and similar functions
--- trunk/lib/msg.c | 75 -- 1 files changed, 61 insertions(+), 14 deletions(-) diff --git a/trunk/lib/msg.c b/trunk/lib/msg.c index cc0a9b5..2c688f9 100644 --- a/trunk/lib/msg.c +++ b/trunk/lib/msg.c @@ -665,6 +665,9 @@ saMsgQueueClose ( 1, &res_lib_msg_queueclose, sizeof (struct res_lib_msg_queueclose)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queueclose.header.error != SA_AIS_OK) { error = res_lib_msg_queueclose.header.error; @@ -721,8 +724,9 @@ saMsgQueueStatusGet ( 1, &res_lib_msg_queuestatusget, sizeof (struct res_lib_msg_queuestatusget)); - - /* if (error != SA_AIS_OK) */ + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queuestatusget.header.error != SA_AIS_OK) { error = res_lib_msg_queuestatusget.header.error; @@ -782,6 +786,9 @@ saMsgQueueRetentionTimeSet ( 1, &res_lib_msg_queueretentiontimeset, sizeof (struct res_lib_msg_queueretentiontimeset)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queueretentiontimeset.header.error != SA_AIS_OK) { error = res_lib_msg_queueretentiontimeset.header.error; @@ -837,6 +844,9 @@ saMsgQueueUnlink ( 1, &res_lib_msg_queueunlink, sizeof (struct res_lib_msg_queueunlink)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queueunlink.header.error != SA_AIS_OK) { error = res_lib_msg_queueunlink.header.error; @@ -895,6 +905,9 @@ saMsgQueueGroupCreate ( 1, &res_lib_msg_queuegroupcreate, sizeof (struct res_lib_msg_queuegroupcreate)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queuegroupcreate.header.error != SA_AIS_OK) { error = res_lib_msg_queuegroupcreate.header.error; @@ -953,6 +966,9 @@ saMsgQueueGroupInsert ( 1, &res_lib_msg_queuegroupinsert, sizeof (struct res_lib_msg_queuegroupinsert)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queuegroupinsert.header.error != SA_AIS_OK) { error = res_lib_msg_queuegroupinsert.header.error; @@ -1012,6 +1028,10 @@ saMsgQueueGroupRemove ( &res_lib_msg_queuegroupremove, sizeof (struct res_lib_msg_queuegroupremove)); + if (error != SA_AIS_OK) { + goto error_put; + } + if (res_lib_msg_queuegroupremove.header.error != SA_AIS_OK) { error = res_lib_msg_queuegroupremove.header.error; goto error_put; /* ! */ @@ -1066,6 +1086,9 @@ saMsgQueueGroupDelete ( 1, &res_lib_msg_queuegroupdelete, sizeof (struct res_lib_msg_queuegroupdelete)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queuegroupdelete.header.error != SA_AIS_OK) { error = res_lib_msg_queuegroupdelete.header.error; @@ -1152,6 +1175,9 @@ saMsgQueueGroupTrack ( &iov, 1, &buffer); + if (error != SA_AIS_OK) { + goto error_unlock; + } res_lib_msg_queuegrouptrack = buffer; @@ -1227,6 +1253,9 @@ saMsgQueueGroupTrackStop ( 1, &res_lib_msg_queuegrouptrackstop, sizeof (struct res_lib_msg_queuegrouptrackstop)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queuegrouptrackstop.header.error != SA_AIS_OK) { error = res_lib_msg_queuegrouptrackstop.header.error; @@ -1274,6 +1303,9 @@ saMsgQueueGroupNotificationFree ( 1, &res_lib_msg_queuegroupnotificationfree, sizeof (struct res_lib_msg_queuegroupnotificationfree)); + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_queuegroupnotificationfree.header.error != SA_AIS_OK) { error = res_lib_msg_queuegroupnotificationfree.header.error; @@ -1348,8 +1380,9 @@ saMsgMessageSend ( 2, &res_lib_msg_messagesend, sizeof (struct res_lib_msg_messagesend)); - - /* if (error != SA_AIS_OK) */ + if (error != SA_AIS_OK) { + goto error_put; + } if (res_lib_msg_messagesend.header.error != SA_AIS_OK) { error = res_lib_msg_messagesend.header.error; @@ -1426,8 +1459,9 @@ saMsgMessageSendAsync ( 2, &res_lib_msg_messagesendasync,
[Openais] [PATCH 5/7] lib/msg.c: Handle creationFlags and coroipcc_msg_send_reply_receive errors
--- trunk/lib/msg.c | 49 ++--- 1 files changed, 42 insertions(+), 7 deletions(-) diff --git a/trunk/lib/msg.c b/trunk/lib/msg.c index b12eb2b..cc0a9b5 100644 --- a/trunk/lib/msg.c +++ b/trunk/lib/msg.c @@ -385,6 +385,24 @@ saMsgQueueOpen ( goto error_exit; } + if ((!(openFlags & SA_MSG_QUEUE_CREATE)) && creationAttributes != NULL) { + error = SA_AIS_ERR_INVALID_PARAM; + goto error_exit; + } + + if (openFlags & SA_MSG_QUEUE_CREATE) { + if (creationAttributes == NULL) { + error = SA_AIS_ERR_INVALID_PARAM; + goto error_put; + } + + if ((creationAttributes->creationFlags != 0) && + (creationAttributes->creationFlags != SA_MSG_QUEUE_PERSISTENT)) { + error = SA_AIS_ERR_BAD_FLAGS; + goto error_exit; + } + } + error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase, msgHandle, (void *)&msgInstance)); if (error != SA_AIS_OK) { @@ -447,7 +465,9 @@ saMsgQueueOpen ( &res_lib_msg_queueopen, sizeof (struct res_lib_msg_queueopen)); - /* if (error != SA_AIS_OK) */ + if (error != SA_AIS_OK) { + goto error_put_destroy; + } if (res_lib_msg_queueopen.header.error != SA_AIS_OK) { error = res_lib_msg_queueopen.header.error; @@ -496,17 +516,30 @@ saMsgQueueOpenAsync ( goto error_exit; } - error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase, - msgHandle, (void *)&msgInstance)); - if (error != SA_AIS_OK) { + if ((!(openFlags & SA_MSG_QUEUE_CREATE)) && creationAttributes != NULL) { + error = SA_AIS_ERR_INVALID_PARAM; goto error_exit; } - if ((openFlags & SA_MSG_QUEUE_CREATE) && - (creationAttributes == NULL)) { + if (openFlags & SA_MSG_QUEUE_CREATE) { + if (creationAttributes == NULL) { error = SA_AIS_ERR_INVALID_PARAM; goto error_put; + } + + if ((creationAttributes->creationFlags != 0) && + (creationAttributes->creationFlags != SA_MSG_QUEUE_PERSISTENT)) { + error = SA_AIS_ERR_BAD_FLAGS; + goto error_exit; + } + } + + error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase, + msgHandle, (void *)&msgInstance)); + if (error != SA_AIS_OK) { + goto error_exit; } + if ((openFlags & SA_MSG_QUEUE_RECEIVE_CALLBACK) && (msgInstance->callbacks.saMsgMessageReceivedCallback == NULL)) { error = SA_AIS_ERR_INIT; @@ -567,7 +600,9 @@ saMsgQueueOpenAsync ( &res_lib_msg_queueopenasync, sizeof (struct res_lib_msg_queueopenasync)); - /* if (error != SA_AIS_OK) */ + if (error != SA_AIS_OK) { + goto error_put_destroy; + } if (res_lib_msg_queueopenasync.header.error != SA_AIS_OK) { error = res_lib_msg_queueopenasync.header.error; -- 1.5.5.6 ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH 2/7] services/msg.c: message_handler_req_exec_msg_messagesendasync - test error and then queue
This solves one of segfaults of msg service (and whole corosync) --- trunk/services/msg.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/trunk/services/msg.c b/trunk/services/msg.c index 17a50f9..00f339d 100644 --- a/trunk/services/msg.c +++ b/trunk/services/msg.c @@ -3769,7 +3769,7 @@ error_exit: &res_lib_msg_messagedelivered_callback, sizeof (struct res_lib_msg_messagedelivered_callback)); - if ((queue->open_flags & SA_MSG_QUEUE_RECEIVE_CALLBACK) && (error == SA_AIS_OK)) + if ((error == SA_AIS_OK) && (queue->open_flags & SA_MSG_QUEUE_RECEIVE_CALLBACK)) { res_lib_msg_messagereceived_callback.header.size = sizeof (struct res_lib_msg_messagereceived_callback); -- 1.5.5.6 ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH 4/7] service/msg.c: Handle opening existing queue with different attributes
See P33-13:P33-14 --- trunk/services/msg.c | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/trunk/services/msg.c b/trunk/services/msg.c index 4e91202..12ea394 100644 --- a/trunk/services/msg.c +++ b/trunk/services/msg.c @@ -2552,6 +2552,17 @@ static void message_handler_req_exec_msg_queueopen ( queue->refcount = 0; } else { + /* Test, if flags are same as creation flags*/ + if ((req_exec_msg_queueopen->create_attrs.creationFlags != queue->create_attrs.creationFlags) || + (req_exec_msg_queueopen->create_attrs.retentionTime != queue->create_attrs.retentionTime) || + (memcmp (req_exec_msg_queueopen->create_attrs.size, + queue->create_attrs.size, + sizeof (queue->create_attrs.size)) != 0)) { + /*Return error*/ + error = SA_AIS_ERR_EXIST; + + goto error_exit; + } if (queue->timer_handle != 0) { api->timer_delete (queue->timer_handle); } @@ -2701,6 +2712,18 @@ static void message_handler_req_exec_msg_queueopenasync ( queue->refcount = 0; } else { + /* Test, if flags are same as creation flags*/ + if ((req_exec_msg_queueopenasync->create_attrs.creationFlags != queue->create_attrs.creationFlags) || + (req_exec_msg_queueopenasync->create_attrs.retentionTime != queue->create_attrs.retentionTime) || + (memcmp (req_exec_msg_queueopenasync->create_attrs.size, + queue->create_attrs.size, + sizeof (queue->create_attrs.size)) != 0)) { + /*Return error*/ + error = SA_AIS_ERR_EXIST; + + goto error_exit; + } + if (queue->timer_handle != 0) { api->timer_delete (queue->timer_handle); } -- 1.5.5.6 ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH 3/7] service/msg.c: message_handler_req_exec_msg_messageget test if msg is NULL
This solves another segfault in msg service (and corosync). --- trunk/services/msg.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/trunk/services/msg.c b/trunk/services/msg.c index 00f339d..4e91202 100644 --- a/trunk/services/msg.c +++ b/trunk/services/msg.c @@ -3821,7 +3821,7 @@ static void message_handler_req_exec_msg_messageget ( &req_exec_msg_messageget->queue_name, req_exec_msg_messageget->queue_id); if (queue == NULL) { - error = SA_AIS_ERR_NOT_EXIST; + error = SA_AIS_ERR_BAD_HANDLE; goto error_exit; } @@ -3887,9 +3887,6 @@ error_exit: MESSAGE_RES_MSG_MESSAGEGET; res_lib_msg_messageget.header.error = error; - memcpy (&res_lib_msg_messageget.message, &msg->message, - sizeof (SaMsgMessageT)); /* ? */ - iov[0].iov_base = &res_lib_msg_messageget; iov[0].iov_len = sizeof (struct res_lib_msg_messageget); @@ -3897,6 +3894,8 @@ error_exit: iov[1].iov_base = msg->message.data; iov[1].iov_len = msg->message.size; + memcpy (&res_lib_msg_messageget.message, &msg->message, + sizeof (SaMsgMessageT)); /* ? */ api->ipc_response_iov_send (req_exec_msg_messageget->source.conn, iov, 2); } else { @@ -3904,7 +3903,8 @@ error_exit: } } - free (msg); + if (msg != NULL) + free (msg); } static void message_handler_req_exec_msg_messagedatafree ( -- 1.5.5.6 ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH 1/7] lib/msg.c: queueHandle should'n be NULL
--- trunk/lib/msg.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/trunk/lib/msg.c b/trunk/lib/msg.c index eaabdf2..b12eb2b 100644 --- a/trunk/lib/msg.c +++ b/trunk/lib/msg.c @@ -380,7 +380,7 @@ saMsgQueueOpen ( /* DEBUG */ printf ("[DEBUG]: saMsgQueueOpen\n"); - if (queueName == NULL) { + if (queueName == NULL || queueHandle == NULL) { error = SA_AIS_ERR_INVALID_PARAM; goto error_exit; } @@ -395,7 +395,7 @@ saMsgQueueOpen ( (msgInstance->callbacks.saMsgMessageReceivedCallback == NULL)) { error = SA_AIS_ERR_INIT; - goto error_exit; + goto error_put; } error = hdb_error_to_sa (hdb_handle_create (&queueHandleDatabase, -- 1.5.5.6 ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] Results of SAFTest for msg service after patches
Only for information. After apply all patches I send, you should get something like: SA Forum AIS Function Name Passing Tests Passing Percentage saMsgQueueUnlink19 of 19100.0% saMsgQueueOpenAsync 27 of 3675.0% saMsgQueueClose 10 of 1471.4% saMsgQueueOpenCallback 7 of 7 100.0% saMsgQueueStatusGet 10 of 1283.3% saMsgQueueOpen 37 of 3897.4% saMsgMessageSendReceive 7 of 35 20.0% saMsgMessageDeliveredCallback 4 of 10 40.0% saMsgMessageReceivedCallback4 of 5 80.0% saMsgMessageCancel 3 of 10 30.0% saMsgMessageReply 5 of 23 21.7% saMsgMessageReplyAsync 5 of 23 21.7% saMsgMessageSendAsync 20 of 2969.0% saMsgMessageGet 21 of 2777.8% saMsgMessageSend16 of 2272.7% saMsgQueueGroupDelete 11 of 1291.7% saMsgQueueGroupInsert 17 of 17100.0% saMsgQueueGroupTrackCallback3 of 10 30.0% saMsgQueueGroupRemove 17 of 17100.0% saMsgQueueGroupTrackStop10 of 1283.3% saMsgQueueGroupTrack21 of 2680.8% saMsgQueueGroupCreate 11 of 1291.7% saMsgFinalize 9 of 9 100.0% saMsgInitialize 15 of 15100.0% saMsgDispatch 10 of 1190.9% saMsgSelectionObjectGet 10 of 10100.0% Not so bad, isn't it? Regards, Honza ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH]: openais/trunk: Sync capacity thresholds in saMsg service
This patch includes capacity thresholds in the queue synchronization code. Ryan Index: services/msg.c === --- services/msg.c (revision 1888) +++ services/msg.c (working copy) @@ -944,6 +944,8 @@ SaNameT queue_name; SaUint32T queue_id; SaTimeT close_time; + SaSizeT capacity_available[SA_MSG_MESSAGE_LOWEST_PRIORITY+1]; + SaSizeT capacity_reached[SA_MSG_MESSAGE_LOWEST_PRIORITY+1]; SaUint8T unlink_flag; SaMsgQueueOpenFlagsT open_flags; SaMsgQueueGroupChangesT change_flag; @@ -1921,6 +1923,8 @@ struct req_exec_msg_sync_queue req_exec_msg_sync_queue; struct iovec iov; + int i; + /* DEBUG */ log_printf (LOGSYS_LEVEL_DEBUG, "[DEBUG]: msg_sync_queue_transmit { queue=%s id=%u }\n", (char *)(queue->queue_name.value), @@ -1946,6 +1950,14 @@ req_exec_msg_sync_queue.unlink_flag = queue->unlink_flag; req_exec_msg_sync_queue.open_flags = queue->open_flags; req_exec_msg_sync_queue.change_flag = queue->change_flag; + + for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) + { + req_exec_msg_sync_queue.capacity_available[i] = + queue->priority[i].capacity_available; + req_exec_msg_sync_queue.capacity_reached[i] = + queue->priority[i].capacity_reached; + } iov.iov_base = (char *)&req_exec_msg_sync_queue; iov.iov_len = sizeof (struct req_exec_msg_sync_queue); @@ -2533,10 +2545,12 @@ queue->open_flags = req_exec_msg_queueopen->open_flags; - for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) { + for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) + { queue->priority[i].queue_size = queue->create_attrs.size[i]; queue->priority[i].capacity_reached = queue->create_attrs.size[i]; queue->priority[i].capacity_available = 0; + list_init (&queue->priority[i].message_head); } @@ -2682,10 +2696,12 @@ queue->open_flags = req_exec_msg_queueopenasync->open_flags; - for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) { + for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) + { queue->priority[i].queue_size = queue->create_attrs.size[i]; queue->priority[i].capacity_reached = queue->create_attrs.size[i]; queue->priority[i].capacity_available = 0; + list_init (&queue->priority[i].message_head); } @@ -4491,8 +4507,15 @@ queue->open_flags = req_exec_msg_sync_queue->open_flags; queue->change_flag = req_exec_msg_sync_queue->change_flag; - for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) { - queue->priority[i].queue_size = queue->create_attrs.size[i]; + for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <= SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) + { + queue->priority[i].queue_size = + queue->create_attrs.size[i]; + queue->priority[i].capacity_available = + req_exec_msg_sync_queue->capacity_available[i]; + queue->priority[i].capacity_reached = + req_exec_msg_sync_queue->capacity_reached[i]; + list_init (&queue->priority[i].message_head); } ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH] pkgconfig/Makefile.am: missing dep fix; generate-read-only
Steven Dake wrote: > As long as it passes make distcheck, then good for commit It does, so I've committed it. ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH] pkgconfig/Makefile.am: missing dep fix; generate-read-only
As long as it passes make distcheck, then good for commit regards -steve On Wed, 2009-05-06 at 09:54 +0200, Jim Meyering wrote: > This makes openais' pkgconfig/Makefile.am > a lot like the one in corosync. This fixes a few problems > that were already fixed in corosync and makes one more: > don't remove all *.pc files, but only those that are generated. > > From 8102f3df1e46a69eaab18eefa6e7ef447ff40567 Mon Sep 17 00:00:00 2001 > From: Jim Meyering > Date: Wed, 6 May 2009 09:08:59 +0200 > Subject: [PATCH] pkgconfig/Makefile.am: missing dep fix; generate-read-only > > * pkgconfig/Makefile.am: Merge fixes from corosync. > (clean-local): Remove rule. Assign to CLEANFILES instead. > --- > pkgconfig/Makefile.am | 24 > 1 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am > index b06ed74..a2eaf39 100644 > --- a/pkgconfig/Makefile.am > +++ b/pkgconfig/Makefile.am > @@ -30,30 +30,30 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -LIBS = saAmf saCkpt saClm saEvt saLck saMsg saTmr > +EXTRA_DIST = libtemplate.pc.in > > -pkgconf_LIBS = $(LIBS:%=lib%) > +LIBS = saAmf saCkpt saClm saEvt saLck saMsg saTmr > > target_LIBS = $(LIBS:%=lib%.pc) > +CLEANFILES = $(target_LIBS) > > -lib%: > - cat $(srcdir)/libtemplate.pc.in | sed \ > +lib%.pc: libtemplate.pc.in Makefile > + rm -f $...@-t $@ > + sed \ > -e 's...@prefix@#$(exec_prefix)#g' \ > -e 's...@libdir@#$(libdir)#g' \ > -e 's...@libversion@#$(VERSION)#g' \ > - -e 's...@lib@#'$(@:lib%=%)'#g' \ > - > $...@.pc; > - touch $@ > + -e 's...@lib@#'$(*:lib%=%)'#g' \ > + $< > $...@-t > + chmod a-w $...@-t > + mv $...@-t $@ > > -all-local: $(pkgconf_LIBS) > +all-local: $(target_LIBS) > > -install-exec-local: > +install-exec-local: $(target_LIBS) > install -d $(DESTDIR)/$(libdir)/pkgconfig > install -m 644 $(target_LIBS) $(DESTDIR)/$(libdir)/pkgconfig > > uninstall-local: > cd $(DESTDIR)/$(libdir)/pkgconfig && rm -f $(target_LIBS) > rmdir $(DESTDIR)/$(libdir)/pkgconfig 2> /dev/null || : > - > -clean-local: > - rm -f *.pc $(pkgconf_LIBS) > -- > 1.6.3.rc4.206.g03e16 > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [Corosync] Patch - Decouple shutdown ordering from objdb position
We will address this patch in the next release. I really prefer the idea of allowing plugins to specify their order as we discussed on irc rather then relying on objdb ordering which could change with the effects of plugin load/unloading. Regards -steve On Wed, 2009-05-06 at 09:55 +0200, Andrew Beekhof wrote: > On Tue, May 5, 2009 at 11:26 AM, Chrissie Caulfield > wrote: > > David Teigland wrote: > >> On Wed, Apr 29, 2009 at 02:28:05PM +0200, Andrew Beekhof wrote: > >>> At the moment, startup and shutdown ordering is controlled by the > >>> plugin's position in an objdb list. > >>> > >>> This is particularly problematic for cluster resource managers which > >>> must be unloaded/stopped first. > >>> The reason for this is that they (or the resources they control) need > >>> access to at least some of the other services provided by Corosync. > >>> > >>> Based on input from Steve, this patch resolves the shutdown side of > >>> the equation and if its acceptable I'll work on the startup side of > >>> things. > >> > >> I wonder if the recent cfg shutdown api from chrissie would be relevant to > >> this? > >> > >> It also brings up the question of whether corosync should have a program to > >> start/stop the corosync daemon? > > Personally I'd favor the corosync daemon itself having the smarts to do this. > I don't have a problem with the current method of sending it a signal > and it unloading service engines. > > My only gripe is the order :-) > > >> "corosync_tool join" to set a config method and start corosync > >> > >> "corosync_tool leave" to stop corosync if it's not being used by apps > >> (would use the cfg api) > >> > > > > > > I think this would be nice. One thing that would also be helpful, I > > think, would be to notify plugins of the shutdown. Currently only cfg > > library users get these notifications which seems a little wrong maybe. > > It depends what you mean here. > Plugins already get the opportunity to do something before corosync > exits, but they only find out once the plugins before it have been > notified and unloaded. > > Pacemaker relies on this behavior and I believe it was largely my > moaning that convinced Steve to add it :-) > The problem this patch was attempting to solve was the order in which > the notification/unloading happened. > > > The problem with that is that it would change the corosync API, and I > > don't particularly fancy a horses head on my pillow just at the moment, > > it might frighten the cats. > > > > A tidy shutdown of corosync is on my "to do" list so I'm open to > > suggestions. > > > > Chrissie > > ___ > > Openais mailing list > > Openais@lists.linux-foundation.org > > https://lists.linux-foundation.org/mailman/listinfo/openais > > > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH] pkgconfig/Makefile.am: missing dep fix; generate-read-only
This makes openais' pkgconfig/Makefile.am a lot like the one in corosync. This fixes a few problems that were already fixed in corosync and makes one more: don't remove all *.pc files, but only those that are generated. >From 8102f3df1e46a69eaab18eefa6e7ef447ff40567 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 6 May 2009 09:08:59 +0200 Subject: [PATCH] pkgconfig/Makefile.am: missing dep fix; generate-read-only * pkgconfig/Makefile.am: Merge fixes from corosync. (clean-local): Remove rule. Assign to CLEANFILES instead. --- pkgconfig/Makefile.am | 24 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am index b06ed74..a2eaf39 100644 --- a/pkgconfig/Makefile.am +++ b/pkgconfig/Makefile.am @@ -30,30 +30,30 @@ MAINTAINERCLEANFILES = Makefile.in -LIBS = saAmf saCkpt saClm saEvt saLck saMsg saTmr +EXTRA_DIST = libtemplate.pc.in -pkgconf_LIBS = $(LIBS:%=lib%) +LIBS = saAmf saCkpt saClm saEvt saLck saMsg saTmr target_LIBS = $(LIBS:%=lib%.pc) +CLEANFILES = $(target_LIBS) -lib%: - cat $(srcdir)/libtemplate.pc.in | sed \ +lib%.pc: libtemplate.pc.in Makefile + rm -f $...@-t $@ + sed \ -e 's...@prefix@#$(exec_prefix)#g' \ -e 's...@libdir@#$(libdir)#g' \ -e 's...@libversion@#$(VERSION)#g' \ - -e 's...@lib@#'$(@:lib%=%)'#g' \ - > $...@.pc; - touch $@ + -e 's...@lib@#'$(*:lib%=%)'#g' \ + $< > $...@-t + chmod a-w $...@-t + mv $...@-t $@ -all-local: $(pkgconf_LIBS) +all-local: $(target_LIBS) -install-exec-local: +install-exec-local: $(target_LIBS) install -d $(DESTDIR)/$(libdir)/pkgconfig install -m 644 $(target_LIBS) $(DESTDIR)/$(libdir)/pkgconfig uninstall-local: cd $(DESTDIR)/$(libdir)/pkgconfig && rm -f $(target_LIBS) rmdir $(DESTDIR)/$(libdir)/pkgconfig 2> /dev/null || : - -clean-local: - rm -f *.pc $(pkgconf_LIBS) -- 1.6.3.rc4.206.g03e16 ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [Corosync] Patch - Decouple shutdown ordering from objdb position
On Tue, May 5, 2009 at 11:26 AM, Chrissie Caulfield wrote: > David Teigland wrote: >> On Wed, Apr 29, 2009 at 02:28:05PM +0200, Andrew Beekhof wrote: >>> At the moment, startup and shutdown ordering is controlled by the >>> plugin's position in an objdb list. >>> >>> This is particularly problematic for cluster resource managers which >>> must be unloaded/stopped first. >>> The reason for this is that they (or the resources they control) need >>> access to at least some of the other services provided by Corosync. >>> >>> Based on input from Steve, this patch resolves the shutdown side of >>> the equation and if its acceptable I'll work on the startup side of >>> things. >> >> I wonder if the recent cfg shutdown api from chrissie would be relevant to >> this? >> >> It also brings up the question of whether corosync should have a program to >> start/stop the corosync daemon? Personally I'd favor the corosync daemon itself having the smarts to do this. I don't have a problem with the current method of sending it a signal and it unloading service engines. My only gripe is the order :-) >> "corosync_tool join" to set a config method and start corosync >> >> "corosync_tool leave" to stop corosync if it's not being used by apps >> (would use the cfg api) >> > > > I think this would be nice. One thing that would also be helpful, I > think, would be to notify plugins of the shutdown. Currently only cfg > library users get these notifications which seems a little wrong maybe. It depends what you mean here. Plugins already get the opportunity to do something before corosync exits, but they only find out once the plugins before it have been notified and unloaded. Pacemaker relies on this behavior and I believe it was largely my moaning that convinced Steve to add it :-) The problem this patch was attempting to solve was the order in which the notification/unloading happened. > The problem with that is that it would change the corosync API, and I > don't particularly fancy a horses head on my pillow just at the moment, > it might frighten the cats. > > A tidy shutdown of corosync is on my "to do" list so I'm open to > suggestions. > > Chrissie > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais > ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH] lib/msg.c: fix typo: s/= open_flags/= openFlags/
Steven Dake wrote: > good for merge thanks. committed ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
Re: [Openais] [PATCH] lib/msg.c: fix typo: s/= open_flags/= openFlags/
good for merge On Wed, 2009-05-06 at 09:34 +0200, Jim Meyering wrote: > openais' trunk currently doesn't compile due to a typo: > > msg.c:409: error: ‘open_flags’ undeclared (first use in this function) > > This appears to be what was intended: > > From 7f8725f931ecd99f9dc62f96f393cd97988804b0 Mon Sep 17 00:00:00 2001 > From: Jim Meyering > Date: Wed, 6 May 2009 09:32:59 +0200 > Subject: [PATCH] lib/msg.c: fix typo: s/= open_flags/= openFlags/ > > * lib/msg.c (saMsgQueueOpen): Fix typo in previous change. > (saMsgQueueOpenAsync): Likewise. > --- > lib/msg.c |4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/msg.c b/lib/msg.c > index f8ed751..d32f50d 100644 > --- a/lib/msg.c > +++ b/lib/msg.c > @@ -406,7 +406,7 @@ saMsgQueueOpen ( > } > > queueInstance->ipc_handle = msgInstance->ipc_handle; > - queueInstance->open_flags = open_flags; > + queueInstance->open_flags = openFlags; > > req_lib_msg_queueopen.header.size = > sizeof (struct req_lib_msg_queueopen); > @@ -516,7 +516,7 @@ saMsgQueueOpenAsync ( > } > > queueInstance->ipc_handle = msgInstance->ipc_handle; > - queueInstance->open_flags = open_flags; > + queueInstance->open_flags = openFlags; > > req_lib_msg_queueopenasync.header.size = > sizeof (struct req_lib_msg_queueopenasync); > -- > 1.6.3.rc4.206.g03e16 > ___ > Openais mailing list > Openais@lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/openais ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais
[Openais] [PATCH] lib/msg.c: fix typo: s/= open_flags/= openFlags/
openais' trunk currently doesn't compile due to a typo: msg.c:409: error: ‘open_flags’ undeclared (first use in this function) This appears to be what was intended: From 7f8725f931ecd99f9dc62f96f393cd97988804b0 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 6 May 2009 09:32:59 +0200 Subject: [PATCH] lib/msg.c: fix typo: s/= open_flags/= openFlags/ * lib/msg.c (saMsgQueueOpen): Fix typo in previous change. (saMsgQueueOpenAsync): Likewise. --- lib/msg.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/msg.c b/lib/msg.c index f8ed751..d32f50d 100644 --- a/lib/msg.c +++ b/lib/msg.c @@ -406,7 +406,7 @@ saMsgQueueOpen ( } queueInstance->ipc_handle = msgInstance->ipc_handle; - queueInstance->open_flags = open_flags; + queueInstance->open_flags = openFlags; req_lib_msg_queueopen.header.size = sizeof (struct req_lib_msg_queueopen); @@ -516,7 +516,7 @@ saMsgQueueOpenAsync ( } queueInstance->ipc_handle = msgInstance->ipc_handle; - queueInstance->open_flags = open_flags; + queueInstance->open_flags = openFlags; req_lib_msg_queueopenasync.header.size = sizeof (struct req_lib_msg_queueopenasync); -- 1.6.3.rc4.206.g03e16 ___ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais