diff --git a/daemons/attrd/attrd_ipc.c b/daemons/attrd/attrd_ipc.c index 4e32f4dc9a1..76e62621191 100644 --- a/daemons/attrd/attrd_ipc.c +++ b/daemons/attrd/attrd_ipc.c @@ -85,7 +85,7 @@ static xmlNode *build_query_reply(const char *attr, const char *host) return reply; } -xmlNode * +void attrd_client_clear_failure(pcmk__request_t *request) { xmlNode *xml = request->xml; @@ -97,7 +97,7 @@ attrd_client_clear_failure(pcmk__request_t *request) */ attrd_send_message(NULL, xml, false); pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL); - return NULL; + return; } rsc = pcmk__xe_get(xml, PCMK__XA_ATTR_RESOURCE); @@ -134,10 +134,10 @@ attrd_client_clear_failure(pcmk__request_t *request) pcmk__xe_remove_attr(xml, PCMK__XA_ATTR_NAME); pcmk__xe_remove_attr(xml, PCMK__XA_ATTR_VALUE); - return attrd_client_update(request); + attrd_client_update(request); } -xmlNode * +void attrd_client_peer_remove(pcmk__request_t *request) { xmlNode *xml = request->xml; @@ -181,7 +181,6 @@ attrd_client_peer_remove(pcmk__request_t *request) } pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL); - return NULL; } xmlNode * @@ -217,7 +216,7 @@ attrd_client_query(pcmk__request_t *request) return reply; } -xmlNode * +void attrd_client_refresh(pcmk__request_t *request) { crm_info("Updating all attributes"); @@ -226,7 +225,6 @@ attrd_client_refresh(pcmk__request_t *request) attrd_write_attributes(attrd_write_all|attrd_write_no_delay); pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL); - return NULL; } static void @@ -388,13 +386,13 @@ send_child_update(xmlNode *child, void *data) return pcmk_rc_ok; } -xmlNode * +void attrd_client_update(pcmk__request_t *request) { xmlNode *xml = NULL; const char *attr, *value, *regex; - CRM_CHECK((request != NULL) && (request->xml != NULL), return NULL); + CRM_CHECK((request != NULL) && (request->xml != NULL), return); xml = request->xml; @@ -421,7 +419,7 @@ attrd_client_update(pcmk__request_t *request) if (handle_value_expansion(&value, child, request->op, attr) == EINVAL) { pcmk__format_result(&request->result, CRM_EX_NOSUCH, PCMK_EXEC_ERROR, "Attribute %s does not exist", attr); - return NULL; + return; } } @@ -442,7 +440,7 @@ attrd_client_update(pcmk__request_t *request) request->xml = orig_xml; } - return NULL; + return; } attr = pcmk__xe_get(xml, PCMK__XA_ATTR_NAME); @@ -451,13 +449,16 @@ attrd_client_update(pcmk__request_t *request) if (handle_regexes(request) != pcmk_rc_ok) { /* Error handling was already dealt with in handle_regexes, so just return. */ - return NULL; - } else if (regex) { + return; + } + + if (regex != NULL) { /* Recursively call attrd_client_update on the new message with regexes * expanded. If supported by the attribute daemon, this means that all * matches can also be handled atomically. */ - return attrd_client_update(request); + attrd_client_update(request); + return; } handle_missing_host(xml); @@ -465,7 +466,7 @@ attrd_client_update(pcmk__request_t *request) if (handle_value_expansion(&value, xml, request->op, attr) == EINVAL) { pcmk__format_result(&request->result, CRM_EX_NOSUCH, PCMK_EXEC_ERROR, "Attribute %s does not exist", attr); - return NULL; + return; } crm_debug("Broadcasting %s[%s]=%s%s", @@ -474,7 +475,6 @@ attrd_client_update(pcmk__request_t *request) send_update_msg_to_cluster(request, xml); pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL); - return NULL; } /*! diff --git a/daemons/attrd/attrd_messages.c b/daemons/attrd/attrd_messages.c index 6f70acbbdde..dd1516a941c 100644 --- a/daemons/attrd/attrd_messages.c +++ b/daemons/attrd/attrd_messages.c @@ -74,30 +74,31 @@ handle_clear_failure_request(pcmk__request_t *request) attrd_peer_clear_failure(request); pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL); return NULL; - } else { - remove_unsupported_sync_points(request); - - if (attrd_request_has_sync_point(request->xml)) { - /* If this client supplied a sync point it wants to wait for, add it to - * the wait list. Clients on this list will not receive an ACK until - * their sync point is hit which will result in the client stalled there - * until it receives a response. - * - * All other clients will receive the expected response as normal. - */ - attrd_add_client_to_waitlist(request); + } - } else { - /* If the client doesn't want to wait for a sync point, go ahead and send - * the ACK immediately. Otherwise, we'll send the ACK when the appropriate - * sync point is reached. - */ - attrd_send_ack(request->ipc_client, request->ipc_id, - request->ipc_flags); - } + remove_unsupported_sync_points(request); - return attrd_client_clear_failure(request); + if (attrd_request_has_sync_point(request->xml)) { + /* If this client supplied a sync point it wants to wait for, add it to + * the wait list. Clients on this list will not receive an ACK until + * their sync point is hit which will result in the client stalled there + * until it receives a response. + * + * All other clients will receive the expected response as normal. + */ + attrd_add_client_to_waitlist(request); + + } else { + /* If the client doesn't want to wait for a sync point, go ahead and + * send the ACK immediately. Otherwise, we'll send the ACK when the + * appropriate sync point is reached. + */ + attrd_send_ack(request->ipc_client, request->ipc_id, + request->ipc_flags); } + + attrd_client_clear_failure(request); + return NULL; } static xmlNode * @@ -146,10 +147,12 @@ handle_remove_request(pcmk__request_t *request) } attrd_peer_remove(host, reap, request->peer); pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL); - return NULL; + } else { - return attrd_client_peer_remove(request); + attrd_client_peer_remove(request); } + + return NULL; } static xmlNode * @@ -157,9 +160,9 @@ handle_refresh_request(pcmk__request_t *request) { if (request->peer != NULL) { return handle_unknown_request(request); - } else { - return attrd_client_refresh(request); } + attrd_client_refresh(request); + return NULL; } static xmlNode * @@ -197,35 +200,35 @@ handle_update_request(pcmk__request_t *request) attrd_peer_update(peer, request->xml, host, false); pcmk__set_result(&request->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL); return NULL; + } - } else { - remove_unsupported_sync_points(request); - - if (attrd_request_has_sync_point(request->xml)) { - /* If this client supplied a sync point it wants to wait for, add it to - * the wait list. Clients on this list will not receive an ACK until - * their sync point is hit which will result in the client stalled there - * until it receives a response. - * - * All other clients will receive the expected response as normal. - */ - attrd_add_client_to_waitlist(request); + remove_unsupported_sync_points(request); - } else { - /* If the client doesn't want to wait for a sync point, go ahead and send - * the ACK immediately. Otherwise, we'll send the ACK when the appropriate - * sync point is reached. - * - * In the normal case, attrd_client_update can be called recursively which - * makes where to send the ACK tricky. Doing it here ensures the client - * only ever receives one. - */ - attrd_send_ack(request->ipc_client, request->ipc_id, - request->flags|crm_ipc_client_response); - } + if (attrd_request_has_sync_point(request->xml)) { + /* If this client supplied a sync point it wants to wait for, add it to + * the wait list. Clients on this list will not receive an ACK until + * their sync point is hit which will result in the client stalled there + * until it receives a response. + * + * All other clients will receive the expected response as normal. + */ + attrd_add_client_to_waitlist(request); - return attrd_client_update(request); + } else { + /* If the client doesn't want to wait for a sync point, go ahead and + * send the ACK immediately. Otherwise, we'll send the ACK when the + * appropriate sync point is reached. + * + * In the normal case, attrd_client_update() can be called recursively, + * which makes where to send the ACK tricky. Doing it here ensures that + * the client only ever receives one. + */ + attrd_send_ack(request->ipc_client, request->ipc_id, + request->flags|crm_ipc_client_response); } + + attrd_client_update(request); + return NULL; } static void diff --git a/daemons/attrd/pacemaker-attrd.h b/daemons/attrd/pacemaker-attrd.h index 189b00c0225..8ff6bd2c8b0 100644 --- a/daemons/attrd/pacemaker-attrd.h +++ b/daemons/attrd/pacemaker-attrd.h @@ -200,10 +200,10 @@ void attrd_peer_sync_response(const pcmk__node_status_t *peer, bool peer_won, xmlNode *xml); void attrd_send_protocol(const pcmk__node_status_t *peer); -xmlNode *attrd_client_peer_remove(pcmk__request_t *request); -xmlNode *attrd_client_clear_failure(pcmk__request_t *request); -xmlNode *attrd_client_update(pcmk__request_t *request); -xmlNode *attrd_client_refresh(pcmk__request_t *request); +void attrd_client_peer_remove(pcmk__request_t *request); +void attrd_client_clear_failure(pcmk__request_t *request); +void attrd_client_update(pcmk__request_t *request); +void attrd_client_refresh(pcmk__request_t *request); xmlNode *attrd_client_query(pcmk__request_t *request); gboolean attrd_send_message(const pcmk__node_status_t *node, xmlNode *data, bool confirm);