[PATCH 2/2] Properly check result of coroipcc_dispatch_put

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When result of coroipcc_dispatch_put it can happen, that one message is
delivered to user application multiple times.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 lib/cfg.c        |   11 ++++++++---
 lib/confdb.c     |   11 ++++++++---
 lib/cpg.c        |   11 ++++++++---
 lib/evs.c        |   11 ++++++++---
 lib/quorum.c     |   11 ++++++++---
 lib/votequorum.c |   11 ++++++++---
 6 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/lib/cfg.c b/lib/cfg.c
index af3b675..be11a53 100644
--- a/lib/cfg.c
+++ b/lib/cfg.c
@@ -210,12 +210,17 @@ corosync_cfg_dispatch (
 			callbacks.corosync_cfg_shutdown_callback(cfg_handle, res_lib_cfg_testshutdown->flags);
 			break;
 		default:
-			coroipcc_dispatch_put (cfg_instance->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (cfg_instance->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (cfg_instance->handle);
+		error = coroipcc_dispatch_put (cfg_instance->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed
diff --git a/lib/confdb.c b/lib/confdb.c
index 7b045e3..5d3c536 100644
--- a/lib/confdb.c
+++ b/lib/confdb.c
@@ -416,12 +416,17 @@ cs_error_t confdb_dispatch (
 				break;
 
 			default:
-				coroipcc_dispatch_put (confdb_inst->handle);
-				error = CS_ERR_LIBRARY;
+				error = coroipcc_dispatch_put (confdb_inst->handle);
+				if (error == CS_OK) {
+					error = CS_ERR_LIBRARY;
+				}
 				goto error_put;
 				break;
 		}
-		coroipcc_dispatch_put (confdb_inst->handle);
+		error = coroipcc_dispatch_put (confdb_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed
diff --git a/lib/cpg.c b/lib/cpg.c
index 5e86fee..06137d4 100644
--- a/lib/cpg.c
+++ b/lib/cpg.c
@@ -451,14 +451,19 @@ cs_error_t cpg_dispatch (
 					totem_member_list);
 				break;
 			default:
-				coroipcc_dispatch_put (cpg_inst->handle);
-				error = CS_ERR_LIBRARY;
+				error = coroipcc_dispatch_put (cpg_inst->handle);
+				if (error == CS_OK) {
+					error = CS_ERR_LIBRARY;
+				}
 				goto error_put;
 				break;
 			} /* - switch (dispatch_data->id) */
 			break; /* case CPG_MODEL_V1 */
 		} /* - switch (cpg_inst_copy.model_data.model) */
-		coroipcc_dispatch_put (cpg_inst->handle);
+		error = coroipcc_dispatch_put (cpg_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed
diff --git a/lib/evs.c b/lib/evs.c
index 6d37ff7..b125dfd 100644
--- a/lib/evs.c
+++ b/lib/evs.c
@@ -308,12 +308,17 @@ evs_error_t evs_dispatch (
 			break;
 
 		default:
-			coroipcc_dispatch_put (evs_inst->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (evs_inst->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (evs_inst->handle);
+		error = coroipcc_dispatch_put (evs_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed
diff --git a/lib/quorum.c b/lib/quorum.c
index 136c563..0a4140f 100644
--- a/lib/quorum.c
+++ b/lib/quorum.c
@@ -399,12 +399,17 @@ cs_error_t quorum_dispatch (
 			break;
 
 		default:
-			coroipcc_dispatch_put (quorum_inst->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (quorum_inst->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (quorum_inst->handle);
+		error = coroipcc_dispatch_put (quorum_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed
diff --git a/lib/votequorum.c b/lib/votequorum.c
index e235a2d..e0a7eb7 100644
--- a/lib/votequorum.c
+++ b/lib/votequorum.c
@@ -766,12 +766,17 @@ cs_error_t votequorum_dispatch (
 			break;
 
 		default:
-			coroipcc_dispatch_put (votequorum_inst->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (votequorum_inst->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (votequorum_inst->handle);
+		error = coroipcc_dispatch_put (votequorum_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux