[PATCH 02/11] votequorum: Check result of exec_send_qdevice_reg

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

 



Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/votequorum.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/exec/votequorum.c b/exec/votequorum.c
index 4c3532c..84206c0 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -1924,8 +1924,16 @@ static int votequorum_sync_process (void)
 	votequorum_exec_send_nodeinfo(us->node_id);
 	votequorum_exec_send_nodeinfo(VOTEQUORUM_QDEVICE_NODEID);
 	if (strlen(qdevice_name)) {
-		votequorum_exec_send_qdevice_reg(VOTEQUORUM_QDEVICE_OPERATION_REGISTER,
-						 qdevice_name);
+		if (votequorum_exec_send_qdevice_reg(VOTEQUORUM_QDEVICE_OPERATION_REGISTER,
+						 qdevice_name) != 0) {
+			/*
+			 * There is no easy way how to handle
+			 * votequorum_exec_send_qdevice_reg failure in sync_process, but
+			 * user should be at least informed.
+			 */
+			log_printf(LOGSYS_LEVEL_WARNING,
+				   "Unable to send qdevice registration request to cluster");
+		}
 	}
 	return 0;
 }
@@ -2357,17 +2365,22 @@ static void message_handler_req_lib_votequorum_qdevice_unregister (void *conn,
 			error = CS_ERR_INVALID_PARAM;
 			goto out;
 		}
-		if (qdevice_timer_set) {
-			corosync_api->timer_delete(qdevice_timer);
-			qdevice_timer_set = 0;
-		}
-		us->flags &= ~NODE_FLAGS_QDEVICE_REGISTERED;
-		us->flags &= ~NODE_FLAGS_QDEVICE_ALIVE;
-		us->flags &= ~NODE_FLAGS_QDEVICE_CAST_VOTE;
-		us->flags &= ~NODE_FLAGS_QDEVICE_MASTER_WINS;
 		votequorum_exec_send_nodeinfo(us->node_id);
-		votequorum_exec_send_qdevice_reg(VOTEQUORUM_QDEVICE_OPERATION_UNREGISTER,
-						 req_lib_votequorum_qdevice_unregister->name);
+		if (votequorum_exec_send_qdevice_reg(VOTEQUORUM_QDEVICE_OPERATION_UNREGISTER,
+						 req_lib_votequorum_qdevice_unregister->name) != 0) {
+			log_printf(LOGSYS_LEVEL_WARNING,
+				   "Unable to send qdevice unregistration request to cluster");
+			error = CS_ERR_TRY_AGAIN;
+		} else {
+			if (qdevice_timer_set) {
+				corosync_api->timer_delete(qdevice_timer);
+				qdevice_timer_set = 0;
+			}
+			us->flags &= ~NODE_FLAGS_QDEVICE_REGISTERED;
+			us->flags &= ~NODE_FLAGS_QDEVICE_ALIVE;
+			us->flags &= ~NODE_FLAGS_QDEVICE_CAST_VOTE;
+			us->flags &= ~NODE_FLAGS_QDEVICE_MASTER_WINS;
+		}
 	} else {
 		error = CS_ERR_NOT_EXIST;
 	}
-- 
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