Patch attached to correct openais-cfgtool -r error.
Index: exec/ipc.c
===================================================================
--- exec/ipc.c (revision 1724)
+++ exec/ipc.c (working copy)
@@ -148,6 +148,19 @@
static void ipc_disconnect (struct conn_info *conn_info);
+static int ipc_conn_exiting (void *conn)
+{
+ struct conn_info *conn_info = (struct conn_info *)conn;
+
+ pthread_mutex_lock (&conn_info->mutex);
+ if (conn_info->destroyed || conn_info->disconnect_requested) {
+ pthread_mutex_unlock (&conn_info->mutex);
+ return (1);
+ }
+ pthread_mutex_unlock (&conn_info->mutex);
+ return (0);
+}
+
static inline int conn_info_destroy (struct conn_info *conn_info)
{
unsigned int res;
@@ -161,14 +174,9 @@
free (conn_info);
return (0);
}
- /*
- * Destroy shared memory segment and semaphore
- */
+
if (conn_info->destroyed == 0) {
openais_conn_refcount_dec (conn_info);
- shmdt (conn_info->mem);
- res = shmctl (conn_info->shmid, IPC_RMID, NULL);
- semctl (conn_info->semid, 0, IPC_RMID);
conn_info->destroyed = 1;
}
@@ -186,6 +194,12 @@
if (res == -1) {
return (-1);
}
+ /*
+ * Destroy shared memory segment and semaphore
+ */
+ shmdt (conn_info->mem);
+ res = shmctl (conn_info->shmid, IPC_RMID, NULL);
+ semctl (conn_info->semid, 0, IPC_RMID);
/*
* Free allocated data needed to retry exiting library IPC connection
@@ -250,17 +264,16 @@
sop.sem_op = -1;
sop.sem_flg = 0;
retry_semop:
+ if (ipc_conn_exiting (conn_info)) {
+ pthread_exit (0);
+ }
res = semop (conn_info->semid, &sop, 1);
if ((res == -1) && (errno == EINTR || errno == EAGAIN)) {
goto retry_semop;
} else
if ((res == -1) && (errno == EINVAL || errno == EIDRM)) {
- openais_conn_refcount_dec (conn);
- return (0);
+ pthread_exit (0);
}
- if (conn_info->destroyed || conn_info->disconnect_requested) {
- break;
- }
header = (mar_req_header_t *)conn_info->mem->req_buffer;
@@ -312,7 +325,7 @@
}
}
openais_conn_refcount_dec (conn);
- return (NULL);
+ pthread_exit (0);
}
static int
@@ -482,7 +495,7 @@
/*
* If an error occurs, try to exit if possible
*/
- if ((conn_info->disconnect_requested) || (revent & (POLLERR|POLLHUP))) {
+ if (ipc_conn_exiting (conn_info) || (revent & (POLLERR|POLLHUP))) {
return poll_handler_connection_destroy (conn_info);
}
@@ -521,7 +534,6 @@
conn_info->semid = semget (conn_info->semkey, 3, 0600);
conn_info->pending_semops = 0;
conn_info->refcount = 1;
- openais_conn_refcount_inc (conn_info);
conn_info->private_data = malloc (ais_service[conn_info->service]->private_data_size);
memset (conn_info->private_data, 0,
@@ -554,6 +566,7 @@
}
} else
if (revent & POLLIN) {
+ openais_conn_refcount_inc (conn_info);
res = recv (fd, &buf, 1, MSG_NOSIGNAL);
if (res == 1) {
switch (buf) {
@@ -569,6 +582,7 @@
res = 0;
break;
}
+ openais_conn_refcount_dec (conn_info);
}
#if defined(OPENAIS_SOLARIS) || defined(OPENAIS_BSD) || defined(OPENAIS_DARWIN)
/* On many OS poll never return POLLHUP or POLLERR.
@@ -580,6 +594,7 @@
#endif
}
+ openais_conn_refcount_inc (conn_info);
pthread_mutex_lock (&conn_info->mutex);
if ((conn_info->disconnect_requested == 0) && (revent & POLLOUT)) {
buf = !list_empty (&conn_info->outq_head);
@@ -607,6 +622,7 @@
}
}
pthread_mutex_unlock (&conn_info->mutex);
+ openais_conn_refcount_dec (conn_info);
return (0);
}
@@ -1039,12 +1055,9 @@
/*
* Exit transmission if the connection is dead
*/
- pthread_mutex_lock (&conn_info->mutex);
- if (conn_info->destroyed || conn_info->disconnect_requested) {
- pthread_mutex_unlock (&conn_info->mutex);
+ if (ipc_conn_exiting (conn)) {
return;
}
- pthread_mutex_unlock (&conn_info->mutex);
bytes_left = shared_mem_dispatch_bytes_left (conn_info);
for (i = 0; i < iov_len; i++) {
Index: exec/totemrrp.c
===================================================================
--- exec/totemrrp.c (revision 1723)
+++ exec/totemrrp.c (working copy)
@@ -1696,7 +1696,6 @@
int res = 0;
unsigned int i;
-printf ("totemrrp ring reenable\n");
res = hdb_handle_get (&totemrrp_instance_database, handle,
(void *)&instance);
if (res != 0) {
Index: lib/cfg.c
===================================================================
--- lib/cfg.c (revision 1723)
+++ lib/cfg.c (working copy)
@@ -112,7 +112,7 @@
}
error = openais_service_connect (CFG_SERVICE, &cfg_instance->ipc_ctx);
- if (error != 0) {
+ if (error != SA_AIS_OK) {
goto error_put_destroy;
}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais