Просмотр исходного кода

ipcc: Fix ERR_LIBRARY error if finalise called inside dispatch

In some instances it's possible for cpg_dispatch() to return
CS_ERR_LIBRARY if cpg_finalise() is called from the callback routine.
The error isn't a problem but it can cause calling applications to log
an error where there is no actual problem (this has been seen in
cmirrord)

The trouble is caused because control_buffer->ipc_closed is (correctly)
set in this situation which causes ipc_sem_wait() to return
CS_ERR_LIBRARY.

My solution is to check for control_buffer->ipc_closed in coroipcc_put()
and instead of simply passing CS_ERR_LIBRARY up the stack, change it to
a benign CS_OK as it is quite reasonable behaviour when shutting down.

Signed-Off-By: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 11 лет назад
Родитель
Сommit
83bf77e6f4
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      lib/coroipcc.c

+ 7 - 0
lib/coroipcc.c

@@ -957,6 +957,13 @@ coroipcc_dispatch_put (hdb_handle_t handle)
 retry_ipc_sem_wait:
 	res = ipc_sem_wait (ipc_instance->control_buffer, SEMAPHORE_DISPATCH, ipc_instance->fd);
 	if (res != CS_OK) {
+	        /*
+		 * IPC was closed earlier in dispatch, return OK
+		 */
+	        if (ipc_instance->control_buffer->ipc_closed) {
+		        res = CS_OK;
+			goto error_exit;
+		}
 		if (res == CS_ERR_TRY_AGAIN) {
 			priv_change_send (ipc_instance);
 			goto retry_ipc_sem_wait;