mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
merge from ronnie
(This used to be ctdb commit e7b57d38cf7255be823a223cf15b7526285b4f1c)
This commit is contained in:
parent
9d6ac0cf55
commit
f6e53f433b
@ -45,7 +45,7 @@ struct ctdb_req_header *_ctdbd_allocate_pkt(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
hdr = (struct ctdb_req_header *)talloc_size(mem_ctx, size);
|
hdr = (struct ctdb_req_header *)talloc_size(mem_ctx, size);
|
||||||
if (hdr == NULL) {
|
if (hdr == NULL) {
|
||||||
DEBUG(0,("Unable to allocate packet for operation %u of length %u\n",
|
DEBUG(DEBUG_ERR,("Unable to allocate packet for operation %u of length %u\n",
|
||||||
operation, (unsigned)length));
|
operation, (unsigned)length));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -160,13 +160,13 @@ static void ctdb_client_reply_call(struct ctdb_context *ctdb, struct ctdb_req_he
|
|||||||
|
|
||||||
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_call_state);
|
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_call_state);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,(__location__ " reqid %u not found\n", hdr->reqid));
|
DEBUG(DEBUG_ERR,(__location__ " reqid %u not found\n", hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->reqid != state->reqid) {
|
if (hdr->reqid != state->reqid) {
|
||||||
/* we found a record but it was the wrong one */
|
/* we found a record but it was the wrong one */
|
||||||
DEBUG(0, ("Dropped client call reply with reqid:%u\n",hdr->reqid));
|
DEBUG(DEBUG_ERR, ("Dropped client call reply with reqid:%u\n",hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ static void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cnt < sizeof(*hdr)) {
|
if (cnt < sizeof(*hdr)) {
|
||||||
DEBUG(0,("Bad packet length %u in client\n", (unsigned)cnt));
|
DEBUG(DEBUG_CRIT,("Bad packet length %u in client\n", (unsigned)cnt));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (cnt != hdr->length) {
|
if (cnt != hdr->length) {
|
||||||
@ -240,7 +240,7 @@ static void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG(0,("bogus operation code:%u\n",hdr->operation));
|
DEBUG(DEBUG_CRIT,("bogus operation code:%u\n",hdr->operation));
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@ -303,7 +303,7 @@ int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call)
|
|||||||
event_loop_once(state->ctdb_db->ctdb->ev);
|
event_loop_once(state->ctdb_db->ctdb->ev);
|
||||||
}
|
}
|
||||||
if (state->state != CTDB_CALL_DONE) {
|
if (state->state != CTDB_CALL_DONE) {
|
||||||
DEBUG(0,(__location__ " ctdb_call_recv failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_call_recv failed\n"));
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
|
|||||||
|
|
||||||
ret = ctdb_ltdb_lock(ctdb_db, call->key);
|
ret = ctdb_ltdb_lock(ctdb_db, call->key);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to get chainlock\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get chainlock\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,14 +406,14 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
|
|||||||
|
|
||||||
state = talloc_zero(ctdb_db, struct ctdb_client_call_state);
|
state = talloc_zero(ctdb_db, struct ctdb_client_call_state);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0, (__location__ " failed to allocate state\n"));
|
DEBUG(DEBUG_ERR, (__location__ " failed to allocate state\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = offsetof(struct ctdb_req_call, data) + call->key.dsize + call->call_data.dsize;
|
len = offsetof(struct ctdb_req_call, data) + call->key.dsize + call->call_data.dsize;
|
||||||
c = ctdbd_allocate_pkt(ctdb, state, CTDB_REQ_CALL, len, struct ctdb_req_call);
|
c = ctdbd_allocate_pkt(ctdb, state, CTDB_REQ_CALL, len, struct ctdb_req_call);
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
DEBUG(0, (__location__ " failed to allocate packet\n"));
|
DEBUG(DEBUG_ERR, (__location__ " failed to allocate packet\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
|||||||
res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_REGISTER_SRVID, 0,
|
res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_REGISTER_SRVID, 0,
|
||||||
tdb_null, NULL, NULL, &status, NULL, NULL);
|
tdb_null, NULL, NULL, &status, NULL, NULL);
|
||||||
if (res != 0 || status != 0) {
|
if (res != 0 || status != 0) {
|
||||||
DEBUG(0,("Failed to register srvid %llu\n", (unsigned long long)srvid));
|
DEBUG(DEBUG_ERR,("Failed to register srvid %llu\n", (unsigned long long)srvid));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ int ctdb_remove_message_handler(struct ctdb_context *ctdb, uint64_t srvid, void
|
|||||||
res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_DEREGISTER_SRVID, 0,
|
res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_DEREGISTER_SRVID, 0,
|
||||||
tdb_null, NULL, NULL, &status, NULL, NULL);
|
tdb_null, NULL, NULL, &status, NULL, NULL);
|
||||||
if (res != 0 || status != 0) {
|
if (res != 0 || status != 0) {
|
||||||
DEBUG(0,("Failed to deregister srvid %llu\n", (unsigned long long)srvid));
|
DEBUG(DEBUG_ERR,("Failed to deregister srvid %llu\n", (unsigned long long)srvid));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,7 +592,7 @@ again:
|
|||||||
/* step 1 - get the chain lock */
|
/* step 1 - get the chain lock */
|
||||||
ret = ctdb_ltdb_lock(ctdb_db, key);
|
ret = ctdb_ltdb_lock(ctdb_db, key);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, (__location__ " failed to lock ltdb record\n"));
|
DEBUG(DEBUG_ERR, (__location__ " failed to lock ltdb record\n"));
|
||||||
talloc_free(h);
|
talloc_free(h);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -653,7 +653,7 @@ int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data)
|
|||||||
|
|
||||||
rec = ctdb_marshall_record(h, h->ctdb_db->db_id, h->key, &h->header, data);
|
rec = ctdb_marshall_record(h, h->ctdb_db->db_id, h->key, &h->header, data);
|
||||||
if (rec == NULL) {
|
if (rec == NULL) {
|
||||||
DEBUG(0,("Unable to marshall record in ctdb_record_store\n"));
|
DEBUG(DEBUG_ERR,("Unable to marshall record in ctdb_record_store\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,7 +667,7 @@ int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data)
|
|||||||
talloc_free(rec);
|
talloc_free(rec);
|
||||||
|
|
||||||
if (ret != 0 || status != 0) {
|
if (ret != 0 || status != 0) {
|
||||||
DEBUG(0,("Failed persistent store in ctdb_record_store\n"));
|
DEBUG(DEBUG_ERR,("Failed persistent store in ctdb_record_store\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,13 +735,13 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_control_state);
|
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_control_state);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,(__location__ " reqid %u not found\n", hdr->reqid));
|
DEBUG(DEBUG_ERR,(__location__ " reqid %u not found\n", hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->reqid != state->reqid) {
|
if (hdr->reqid != state->reqid) {
|
||||||
/* we found a record but it was the wrong one */
|
/* we found a record but it was the wrong one */
|
||||||
DEBUG(0, ("Dropped orphaned reply control with reqid:%u\n",hdr->reqid));
|
DEBUG(DEBUG_ERR, ("Dropped orphaned reply control with reqid:%u\n",hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ static void control_timeout_func(struct event_context *ev, struct timed_event *t
|
|||||||
{
|
{
|
||||||
struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
|
struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
|
||||||
|
|
||||||
DEBUG(0,("control timed out. reqid:%d opcode:%d dstnode:%d\n", state->reqid, state->c->opcode, state->c->hdr.destnode));
|
DEBUG(DEBUG_ERR,("control timed out. reqid:%d opcode:%d dstnode:%d\n", state->reqid, state->c->opcode, state->c->hdr.destnode));
|
||||||
|
|
||||||
state->state = CTDB_CONTROL_TIMEOUT;
|
state->state = CTDB_CONTROL_TIMEOUT;
|
||||||
|
|
||||||
@ -891,7 +891,7 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state->state != CTDB_CONTROL_DONE) {
|
if (state->state != CTDB_CONTROL_DONE) {
|
||||||
DEBUG(0,(__location__ " ctdb_control_recv failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control_recv failed\n"));
|
||||||
if (state->async.fn) {
|
if (state->async.fn) {
|
||||||
state->async.fn(state);
|
state->async.fn(state);
|
||||||
}
|
}
|
||||||
@ -900,7 +900,7 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state->errormsg) {
|
if (state->errormsg) {
|
||||||
DEBUG(0,("ctdb_control error: '%s'\n", state->errormsg));
|
DEBUG(DEBUG_ERR,("ctdb_control error: '%s'\n", state->errormsg));
|
||||||
if (errormsg) {
|
if (errormsg) {
|
||||||
(*errormsg) = talloc_move(mem_ctx, &state->errormsg);
|
(*errormsg) = talloc_move(mem_ctx, &state->errormsg);
|
||||||
}
|
}
|
||||||
@ -969,7 +969,7 @@ int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t
|
|||||||
CTDB_CONTROL_PROCESS_EXISTS, 0, data,
|
CTDB_CONTROL_PROCESS_EXISTS, 0, data,
|
||||||
NULL, NULL, &status, NULL, NULL);
|
NULL, NULL, &status, NULL, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for process_exists failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for process_exists failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,12 +989,12 @@ int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ct
|
|||||||
CTDB_CONTROL_STATISTICS, 0, tdb_null,
|
CTDB_CONTROL_STATISTICS, 0, tdb_null,
|
||||||
ctdb, &data, &res, NULL, NULL);
|
ctdb, &data, &res, NULL, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for statistics failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for statistics failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.dsize != sizeof(struct ctdb_statistics)) {
|
if (data.dsize != sizeof(struct ctdb_statistics)) {
|
||||||
DEBUG(0,(__location__ " Wrong statistics size %u - expected %u\n",
|
DEBUG(DEBUG_ERR,(__location__ " Wrong statistics size %u - expected %u\n",
|
||||||
(unsigned)data.dsize, (unsigned)sizeof(struct ctdb_statistics)));
|
(unsigned)data.dsize, (unsigned)sizeof(struct ctdb_statistics)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1016,7 +1016,7 @@ int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32
|
|||||||
CTDB_CONTROL_SHUTDOWN, 0, tdb_null,
|
CTDB_CONTROL_SHUTDOWN, 0, tdb_null,
|
||||||
NULL, &timeout, NULL);
|
NULL, &timeout, NULL);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for shutdown failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for shutdown failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1037,14 +1037,14 @@ int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb, struct timeval timeout, uint3
|
|||||||
CTDB_CONTROL_GETVNNMAP, 0, tdb_null,
|
CTDB_CONTROL_GETVNNMAP, 0, tdb_null,
|
||||||
mem_ctx, &outdata, &res, &timeout, NULL);
|
mem_ctx, &outdata, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for getvnnmap failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getvnnmap failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
map = (struct ctdb_vnn_map_wire *)outdata.dptr;
|
map = (struct ctdb_vnn_map_wire *)outdata.dptr;
|
||||||
if (outdata.dsize < offsetof(struct ctdb_vnn_map_wire, map) ||
|
if (outdata.dsize < offsetof(struct ctdb_vnn_map_wire, map) ||
|
||||||
outdata.dsize != map->size*sizeof(uint32_t) + offsetof(struct ctdb_vnn_map_wire, map)) {
|
outdata.dsize != map->size*sizeof(uint32_t) + offsetof(struct ctdb_vnn_map_wire, map)) {
|
||||||
DEBUG(0,("Bad vnn map size received in ctdb_ctrl_getvnnmap\n"));
|
DEBUG(DEBUG_ERR,("Bad vnn map size received in ctdb_ctrl_getvnnmap\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,7 +1080,7 @@ int ctdb_ctrl_getrecmode_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, st
|
|||||||
|
|
||||||
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
|
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_ctrl_getrecmode_recv failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_getrecmode_recv failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,7 +1118,7 @@ int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout, uint
|
|||||||
CTDB_CONTROL_SET_RECMODE, 0, data,
|
CTDB_CONTROL_SET_RECMODE, 0, data,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for setrecmode failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setrecmode failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1146,7 +1146,7 @@ int ctdb_ctrl_getrecmaster_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
|
|||||||
|
|
||||||
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
|
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_ctrl_getrecmaster_recv failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_getrecmaster_recv failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1183,7 +1183,7 @@ int ctdb_ctrl_setrecmaster(struct ctdb_context *ctdb, struct timeval timeout, ui
|
|||||||
CTDB_CONTROL_SET_RECMASTER, 0, data,
|
CTDB_CONTROL_SET_RECMASTER, 0, data,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for setrecmaster failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setrecmaster failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,7 +1205,7 @@ int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32
|
|||||||
CTDB_CONTROL_GET_DBMAP, 0, tdb_null,
|
CTDB_CONTROL_GET_DBMAP, 0, tdb_null,
|
||||||
mem_ctx, &outdata, &res, &timeout, NULL);
|
mem_ctx, &outdata, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for getdbmap failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1231,7 +1231,7 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
|
|||||||
CTDB_CONTROL_GET_NODEMAP, 0, tdb_null,
|
CTDB_CONTROL_GET_NODEMAP, 0, tdb_null,
|
||||||
mem_ctx, &outdata, &res, &timeout, NULL);
|
mem_ctx, &outdata, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0 || outdata.dsize == 0) {
|
if (ret != 0 || res != 0 || outdata.dsize == 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for getnodes failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1268,7 +1268,7 @@ int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb, struct timeval timeout, uint3
|
|||||||
CTDB_CONTROL_SETVNNMAP, 0, data,
|
CTDB_CONTROL_SETVNNMAP, 0, data,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for setvnnmap failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setvnnmap failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1319,7 +1319,7 @@ int ctdb_ctrl_pulldb_recv(
|
|||||||
|
|
||||||
ret = ctdb_control_recv(ctdb, state, mem_ctx, outdata, &res, NULL);
|
ret = ctdb_control_recv(ctdb, state, mem_ctx, outdata, &res, NULL);
|
||||||
if ( (ret != 0) || (res != 0) ){
|
if ( (ret != 0) || (res != 0) ){
|
||||||
DEBUG(0,(__location__ " ctdb_ctrl_pulldb_recv failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_pulldb_recv failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1363,7 +1363,7 @@ int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb, struct timeval timeout, uint
|
|||||||
CTDB_CONTROL_SET_DMASTER, 0, indata,
|
CTDB_CONTROL_SET_DMASTER, 0, indata,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for setdmaster failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setdmaster failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1486,7 +1486,7 @@ int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, uint3
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (data.dsize != sizeof(uint32_t)) {
|
if (data.dsize != sizeof(uint32_t)) {
|
||||||
DEBUG(0,("Bad control reply size in ctdb_get_debuglevel (got %u)\n",
|
DEBUG(DEBUG_ERR,("Bad control reply size in ctdb_get_debuglevel (got %u)\n",
|
||||||
(unsigned)data.dsize));
|
(unsigned)data.dsize));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1563,7 +1563,7 @@ int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode)
|
|||||||
CTDB_CONTROL_STATISTICS_RESET, 0, tdb_null,
|
CTDB_CONTROL_STATISTICS_RESET, 0, tdb_null,
|
||||||
NULL, NULL, &res, NULL, NULL);
|
NULL, NULL, &res, NULL, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for reset statistics failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for reset statistics failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1616,7 +1616,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
|
|||||||
persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH,
|
persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH,
|
||||||
0, data, ctdb_db, &data, &res, NULL, NULL);
|
0, data, ctdb_db, &data, &res, NULL, NULL);
|
||||||
if (ret != 0 || res != 0 || data.dsize != sizeof(uint32_t)) {
|
if (ret != 0 || res != 0 || data.dsize != sizeof(uint32_t)) {
|
||||||
DEBUG(0,("Failed to attach to database '%s'\n", name));
|
DEBUG(DEBUG_ERR,("Failed to attach to database '%s'\n", name));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1626,7 +1626,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getdbpath(ctdb, timeval_current_ofs(2, 0), CTDB_CURRENT_NODE, ctdb_db->db_id, ctdb_db, &ctdb_db->db_path);
|
ret = ctdb_ctrl_getdbpath(ctdb, timeval_current_ofs(2, 0), CTDB_CURRENT_NODE, ctdb_db->db_id, ctdb_db, &ctdb_db->db_path);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to get dbpath for database '%s'\n", name));
|
DEBUG(DEBUG_ERR,("Failed to get dbpath for database '%s'\n", name));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1674,7 +1674,7 @@ int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id)
|
|||||||
ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_SET_CALL, 0,
|
ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_SET_CALL, 0,
|
||||||
data, NULL, NULL, &status, NULL, NULL);
|
data, NULL, NULL, &status, NULL, NULL);
|
||||||
if (ret != 0 || status != 0) {
|
if (ret != 0 || status != 0) {
|
||||||
DEBUG(0,("ctdb_set_call failed for call %u\n", id));
|
DEBUG(DEBUG_ERR,("ctdb_set_call failed for call %u\n", id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1707,7 +1707,7 @@ static void traverse_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA
|
|||||||
|
|
||||||
if (data.dsize < sizeof(uint32_t) ||
|
if (data.dsize < sizeof(uint32_t) ||
|
||||||
d->length != data.dsize) {
|
d->length != data.dsize) {
|
||||||
DEBUG(0,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
|
DEBUG(DEBUG_ERR,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
|
||||||
state->done = True;
|
state->done = True;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1751,7 +1751,7 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
|
|||||||
|
|
||||||
ret = ctdb_set_message_handler(ctdb_db->ctdb, srvid, traverse_handler, &state);
|
ret = ctdb_set_message_handler(ctdb_db->ctdb, srvid, traverse_handler, &state);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to setup traverse handler\n"));
|
DEBUG(DEBUG_ERR,("Failed to setup traverse handler\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1765,7 +1765,7 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
|
|||||||
ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_TRAVERSE_START, 0,
|
ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_TRAVERSE_START, 0,
|
||||||
data, NULL, NULL, &status, NULL, NULL);
|
data, NULL, NULL, &status, NULL, NULL);
|
||||||
if (ret != 0 || status != 0) {
|
if (ret != 0 || status != 0) {
|
||||||
DEBUG(0,("ctdb_traverse_all failed\n"));
|
DEBUG(DEBUG_ERR,("ctdb_traverse_all failed\n"));
|
||||||
ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
|
ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1776,7 +1776,7 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
|
|||||||
|
|
||||||
ret = ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
|
ret = ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to remove ctdb_traverse handler\n"));
|
DEBUG(DEBUG_ERR,("Failed to remove ctdb_traverse handler\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1824,7 +1824,7 @@ int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout, uint32_t
|
|||||||
CTDB_CONTROL_GET_PID, 0, tdb_null,
|
CTDB_CONTROL_GET_PID, 0, tdb_null,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for getpid failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpid failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1855,7 +1855,7 @@ int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct
|
|||||||
|
|
||||||
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
|
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
|
||||||
if ( (ret != 0) || (res != 0) ){
|
if ( (ret != 0) || (res != 0) ){
|
||||||
DEBUG(0,(__location__ " ctdb_ctrl_freeze_recv failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_freeze_recv failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1890,7 +1890,7 @@ int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t d
|
|||||||
CTDB_CONTROL_THAW, 0, tdb_null,
|
CTDB_CONTROL_THAW, 0, tdb_null,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control thaw failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control thaw failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1909,7 +1909,7 @@ int ctdb_ctrl_getpnn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t
|
|||||||
CTDB_CONTROL_GET_PNN, 0, tdb_null,
|
CTDB_CONTROL_GET_PNN, 0, tdb_null,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for getpnn failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpnn failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1928,7 +1928,7 @@ int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint
|
|||||||
CTDB_CONTROL_GET_MONMODE, 0, tdb_null,
|
CTDB_CONTROL_GET_MONMODE, 0, tdb_null,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for getrecmode failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getrecmode failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1954,7 +1954,7 @@ int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
|
|||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
|
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for takeover_ip failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for takeover_ip failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1979,7 +1979,7 @@ int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
|
|||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
|
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for release_ip failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for release_ip failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2012,12 +2012,12 @@ int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb,
|
|||||||
&outdata, &res, &timeout, NULL);
|
&outdata, &res, &timeout, NULL);
|
||||||
talloc_free(data.dptr);
|
talloc_free(data.dptr);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for get_tunable failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_tunable failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outdata.dsize != sizeof(uint32_t)) {
|
if (outdata.dsize != sizeof(uint32_t)) {
|
||||||
DEBUG(0,("Invalid return data in get_tunable\n"));
|
DEBUG(DEBUG_ERR,("Invalid return data in get_tunable\n"));
|
||||||
talloc_free(outdata.dptr);
|
talloc_free(outdata.dptr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2054,7 +2054,7 @@ int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
|
|||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
talloc_free(data.dptr);
|
talloc_free(data.dptr);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for set_tunable failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for set_tunable failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2079,14 +2079,14 @@ int ctdb_ctrl_list_tunables(struct ctdb_context *ctdb,
|
|||||||
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_LIST_TUNABLES, 0, tdb_null,
|
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_LIST_TUNABLES, 0, tdb_null,
|
||||||
mem_ctx, &outdata, &res, &timeout, NULL);
|
mem_ctx, &outdata, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for list_tunables failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for list_tunables failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = (struct ctdb_control_list_tunable *)outdata.dptr;
|
t = (struct ctdb_control_list_tunable *)outdata.dptr;
|
||||||
if (outdata.dsize < offsetof(struct ctdb_control_list_tunable, data) ||
|
if (outdata.dsize < offsetof(struct ctdb_control_list_tunable, data) ||
|
||||||
t->length > outdata.dsize-offsetof(struct ctdb_control_list_tunable, data)) {
|
t->length > outdata.dsize-offsetof(struct ctdb_control_list_tunable, data)) {
|
||||||
DEBUG(0,("Invalid data in list_tunables reply\n"));
|
DEBUG(DEBUG_ERR,("Invalid data in list_tunables reply\n"));
|
||||||
talloc_free(outdata.dptr);
|
talloc_free(outdata.dptr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2125,7 +2125,7 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
|
|||||||
CTDB_CONTROL_GET_PUBLIC_IPS, 0, tdb_null,
|
CTDB_CONTROL_GET_PUBLIC_IPS, 0, tdb_null,
|
||||||
mem_ctx, &outdata, &res, &timeout, NULL);
|
mem_ctx, &outdata, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for getpublicips failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2156,7 +2156,7 @@ int ctdb_ctrl_modflags(struct ctdb_context *ctdb, struct timeval timeout, uint32
|
|||||||
CTDB_CONTROL_MODIFY_FLAGS, 0, data,
|
CTDB_CONTROL_MODIFY_FLAGS, 0, data,
|
||||||
NULL, NULL, &res, &timeout, NULL);
|
NULL, NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for modflags failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for modflags failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2179,12 +2179,12 @@ int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
|
|||||||
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_ALL_TUNABLES, 0, tdb_null, ctdb,
|
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_ALL_TUNABLES, 0, tdb_null, ctdb,
|
||||||
&outdata, &res, &timeout, NULL);
|
&outdata, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for get all tunables failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get all tunables failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outdata.dsize != sizeof(*tunables)) {
|
if (outdata.dsize != sizeof(*tunables)) {
|
||||||
DEBUG(0,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
|
DEBUG(DEBUG_ERR,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
|
||||||
(unsigned)outdata.dsize, (unsigned)sizeof(*tunables)));
|
(unsigned)outdata.dsize, (unsigned)sizeof(*tunables)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2213,7 +2213,7 @@ int ctdb_ctrl_killtcp(struct ctdb_context *ctdb,
|
|||||||
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_KILL_TCP, 0, data, NULL,
|
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_KILL_TCP, 0, data, NULL,
|
||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for killtcp failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for killtcp failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2252,7 +2252,7 @@ int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb,
|
|||||||
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SEND_GRATIOUS_ARP, 0, data, NULL,
|
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SEND_GRATIOUS_ARP, 0, data, NULL,
|
||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for gratious_arp failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for gratious_arp failed\n"));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2281,7 +2281,7 @@ int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb,
|
|||||||
CTDB_CONTROL_GET_TCP_TICKLE_LIST, 0, data,
|
CTDB_CONTROL_GET_TCP_TICKLE_LIST, 0, data,
|
||||||
mem_ctx, &outdata, &status, NULL, NULL);
|
mem_ctx, &outdata, &status, NULL, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for get tcp tickles failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get tcp tickles failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2309,7 +2309,7 @@ int ctdb_ctrl_register_server_id(struct ctdb_context *ctdb,
|
|||||||
0, data, NULL,
|
0, data, NULL,
|
||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for register server id failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for register server id failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2335,7 +2335,7 @@ int ctdb_ctrl_unregister_server_id(struct ctdb_context *ctdb,
|
|||||||
0, data, NULL,
|
0, data, NULL,
|
||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for unregister server id failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for unregister server id failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2365,7 +2365,7 @@ int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
|
|||||||
0, data, NULL,
|
0, data, NULL,
|
||||||
NULL, &res, &timeout, NULL);
|
NULL, &res, &timeout, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for check server id failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for check server id failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2394,7 +2394,7 @@ int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
|
|||||||
CTDB_CONTROL_GET_SERVER_ID_LIST, 0, tdb_null,
|
CTDB_CONTROL_GET_SERVER_ID_LIST, 0, tdb_null,
|
||||||
mem_ctx, &outdata, &res, &timeout, NULL);
|
mem_ctx, &outdata, &res, &timeout, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for get_server_id_list failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_server_id_list failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2469,7 +2469,7 @@ int ctdb_ctrl_uptime_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct
|
|||||||
|
|
||||||
ret = ctdb_control_recv(ctdb, state, mem_ctx, &outdata, &res, NULL);
|
ret = ctdb_control_recv(ctdb, state, mem_ctx, &outdata, &res, NULL);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_ctrl_uptime_recv failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_uptime_recv failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2498,7 +2498,7 @@ int ctdb_ctrl_end_recovery(struct ctdb_context *ctdb, struct timeval timeout, ui
|
|||||||
CTDB_CONTROL_END_RECOVERY, 0, tdb_null,
|
CTDB_CONTROL_END_RECOVERY, 0, tdb_null,
|
||||||
NULL, NULL, &status, &timeout, NULL);
|
NULL, NULL, &status, &timeout, NULL);
|
||||||
if (ret != 0 || status != 0) {
|
if (ret != 0 || status != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for end_recovery failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for end_recovery failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2523,7 +2523,7 @@ static void async_callback(struct ctdb_client_control_state *state)
|
|||||||
*/
|
*/
|
||||||
if (state->state != CTDB_CONTROL_DONE) {
|
if (state->state != CTDB_CONTROL_DONE) {
|
||||||
if ( !data->dont_log_errors) {
|
if ( !data->dont_log_errors) {
|
||||||
DEBUG(0,("Async operation failed with state %d\n", state->state));
|
DEBUG(DEBUG_ERR,("Async operation failed with state %d\n", state->state));
|
||||||
}
|
}
|
||||||
data->fail_count++;
|
data->fail_count++;
|
||||||
return;
|
return;
|
||||||
@ -2534,7 +2534,7 @@ static void async_callback(struct ctdb_client_control_state *state)
|
|||||||
ret = ctdb_control_recv(state->ctdb, state, data, NULL, &res, NULL);
|
ret = ctdb_control_recv(state->ctdb, state, data, NULL, &res, NULL);
|
||||||
if ((ret != 0) || (res != 0)) {
|
if ((ret != 0) || (res != 0)) {
|
||||||
if ( !data->dont_log_errors) {
|
if ( !data->dont_log_errors) {
|
||||||
DEBUG(0,("Async operation failed with ret=%d res=%d\n", ret, (int)res));
|
DEBUG(DEBUG_ERR,("Async operation failed with ret=%d res=%d\n", ret, (int)res));
|
||||||
}
|
}
|
||||||
data->fail_count++;
|
data->fail_count++;
|
||||||
}
|
}
|
||||||
@ -2562,7 +2562,7 @@ int ctdb_client_async_wait(struct ctdb_context *ctdb, struct client_async_data *
|
|||||||
}
|
}
|
||||||
if (data->fail_count != 0) {
|
if (data->fail_count != 0) {
|
||||||
if (!data->dont_log_errors) {
|
if (!data->dont_log_errors) {
|
||||||
DEBUG(0,("Async wait failed - fail_count=%u\n",
|
DEBUG(DEBUG_ERR,("Async wait failed - fail_count=%u\n",
|
||||||
data->fail_count));
|
data->fail_count));
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -2599,7 +2599,7 @@ int ctdb_client_async_control(struct ctdb_context *ctdb,
|
|||||||
state = ctdb_control_send(ctdb, pnn, 0, opcode,
|
state = ctdb_control_send(ctdb, pnn, 0, opcode,
|
||||||
0, data, async_data, &timeout, NULL);
|
0, data, async_data, &timeout, NULL);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to call async control %u\n", (unsigned)opcode));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to call async control %u\n", (unsigned)opcode));
|
||||||
talloc_free(async_data);
|
talloc_free(async_data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
|
|||||||
/* get our pnn */
|
/* get our pnn */
|
||||||
ctdb->pnn = ctdb_ctrl_getpnn(ctdb, timeval_current_ofs(3, 0), CTDB_CURRENT_NODE);
|
ctdb->pnn = ctdb_ctrl_getpnn(ctdb, timeval_current_ofs(3, 0), CTDB_CURRENT_NODE);
|
||||||
if (ctdb->pnn == (uint32_t)-1) {
|
if (ctdb->pnn == (uint32_t)-1) {
|
||||||
DEBUG(0,(__location__ " Failed to get ctdb pnn\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " Failed to get ctdb pnn\n"));
|
||||||
talloc_free(ctdb);
|
talloc_free(ctdb);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -77,14 +77,14 @@ static void queue_io_read(struct ctdb_queue *queue)
|
|||||||
num_ready + queue->partial.length);
|
num_ready + queue->partial.length);
|
||||||
|
|
||||||
if (queue->partial.data == NULL) {
|
if (queue->partial.data == NULL) {
|
||||||
DEBUG(0,("read error alloc failed for %u\n",
|
DEBUG(DEBUG_ERR,("read error alloc failed for %u\n",
|
||||||
num_ready + queue->partial.length));
|
num_ready + queue->partial.length));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
nread = read(queue->fd, queue->partial.data + queue->partial.length, num_ready);
|
nread = read(queue->fd, queue->partial.data + queue->partial.length, num_ready);
|
||||||
if (nread <= 0) {
|
if (nread <= 0) {
|
||||||
DEBUG(0,("read error nread=%d\n", (int)nread));
|
DEBUG(DEBUG_ERR,("read error nread=%d\n", (int)nread));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,12 +111,12 @@ static void queue_io_read(struct ctdb_queue *queue)
|
|||||||
len = *(uint32_t *)data;
|
len = *(uint32_t *)data;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
/* bad packet! treat as EOF */
|
/* bad packet! treat as EOF */
|
||||||
DEBUG(0,("Invalid packet of length 0\n"));
|
DEBUG(DEBUG_CRIT,("Invalid packet of length 0\n"));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
d2 = talloc_memdup(queue, data, len);
|
d2 = talloc_memdup(queue, data, len);
|
||||||
if (d2 == NULL) {
|
if (d2 == NULL) {
|
||||||
DEBUG(0,("read error memdup failed for %u\n", len));
|
DEBUG(DEBUG_ERR,("read error memdup failed for %u\n", len));
|
||||||
/* sigh */
|
/* sigh */
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ static void queue_io_read(struct ctdb_queue *queue)
|
|||||||
} else {
|
} else {
|
||||||
queue->partial.data = talloc_memdup(queue, data, nread);
|
queue->partial.data = talloc_memdup(queue, data, nread);
|
||||||
if (queue->partial.data == NULL) {
|
if (queue->partial.data == NULL) {
|
||||||
DEBUG(0,("read error memdup partial failed for %u\n",
|
DEBUG(DEBUG_ERR,("read error memdup partial failed for %u\n",
|
||||||
(unsigned)nread));
|
(unsigned)nread));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
|
|||||||
rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
|
rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
|
||||||
h2 = (struct ctdb_ltdb_header *)rec.dptr;
|
h2 = (struct ctdb_ltdb_header *)rec.dptr;
|
||||||
if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
|
if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
|
||||||
DEBUG(0,("RSN regression! %llu %llu\n",
|
DEBUG(DEBUG_CRIT,("RSN regression! %llu %llu\n",
|
||||||
(unsigned long long)h2->rsn, (unsigned long long)header->rsn));
|
(unsigned long long)h2->rsn, (unsigned long long)header->rsn));
|
||||||
}
|
}
|
||||||
if (rec.dptr) free(rec.dptr);
|
if (rec.dptr) free(rec.dptr);
|
||||||
@ -172,7 +172,7 @@ int ctdb_ltdb_unlock(struct ctdb_db_context *ctdb_db, TDB_DATA key)
|
|||||||
{
|
{
|
||||||
int ret = tdb_chainunlock(ctdb_db->ltdb->tdb, key);
|
int ret = tdb_chainunlock(ctdb_db->ltdb->tdb, key);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("tdb_chainunlock failed\n"));
|
DEBUG(DEBUG_ERR,("tdb_chainunlock failed\n"));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...)
|
|||||||
talloc_free(ctdb->err_msg);
|
talloc_free(ctdb->err_msg);
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ctdb->err_msg = talloc_vasprintf(ctdb, fmt, ap);
|
ctdb->err_msg = talloc_vasprintf(ctdb, fmt, ap);
|
||||||
DEBUG(0,("ctdb error: %s\n", ctdb->err_msg));
|
DEBUG(DEBUG_ERR,("ctdb error: %s\n", ctdb->err_msg));
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ static void *_idr_find_type(struct idr_context *idp, int id, const char *type, c
|
|||||||
{
|
{
|
||||||
void *p = idr_find(idp, id);
|
void *p = idr_find(idp, id);
|
||||||
if (p && talloc_check_name(p, type) == NULL) {
|
if (p && talloc_check_name(p, type) == NULL) {
|
||||||
DEBUG(0,("%s idr_find_type expected type %s but got %s\n",
|
DEBUG(DEBUG_ERR,("%s idr_find_type expected type %s but got %s\n",
|
||||||
location, type, talloc_get_name(p)));
|
location, type, talloc_get_name(p)));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ void *_ctdb_reqid_find(struct ctdb_context *ctdb, uint32_t reqid, const char *ty
|
|||||||
|
|
||||||
p = _idr_find_type(ctdb->idr, (reqid>>16)&0xFFFF, type, location);
|
p = _idr_find_type(ctdb->idr, (reqid>>16)&0xFFFF, type, location);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
DEBUG(0, ("Could not find idr:%u\n",reqid));
|
DEBUG(DEBUG_ERR, ("Could not find idr:%u\n",reqid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
@ -160,7 +160,7 @@ void ctdb_reqid_remove(struct ctdb_context *ctdb, uint32_t reqid)
|
|||||||
|
|
||||||
ret = idr_remove(ctdb->idr, (reqid>>16)&0xFFFF);
|
ret = idr_remove(ctdb->idr, (reqid>>16)&0xFFFF);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Removing idr that does not exist\n"));
|
DEBUG(DEBUG_ERR, ("Removing idr that does not exist\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ void ctdb_set_scheduler(struct ctdb_context *ctdb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sched_getparam(0, (struct sched_param *)ctdb->saved_scheduler_param) == -1) {
|
if (sched_getparam(0, (struct sched_param *)ctdb->saved_scheduler_param) == -1) {
|
||||||
DEBUG(0,("Unable to get old scheduler params\n"));
|
DEBUG(DEBUG_ERR,("Unable to get old scheduler params\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ void ctdb_set_scheduler(struct ctdb_context *ctdb)
|
|||||||
p.sched_priority = 1;
|
p.sched_priority = 1;
|
||||||
|
|
||||||
if (sched_setscheduler(0, SCHED_FIFO, &p) == -1) {
|
if (sched_setscheduler(0, SCHED_FIFO, &p) == -1) {
|
||||||
DEBUG(0,("Unable to set scheduler to SCHED_FIFO (%s)\n",
|
DEBUG(DEBUG_CRIT,("Unable to set scheduler to SCHED_FIFO (%s)\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
} else {
|
} else {
|
||||||
DEBUG(DEBUG_NOTICE,("Set scheduler to SCHED_FIFO\n"));
|
DEBUG(DEBUG_NOTICE,("Set scheduler to SCHED_FIFO\n"));
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "rb_tree.h"
|
#include "rb_tree.h"
|
||||||
|
|
||||||
#define NO_MEMORY_FATAL(p) do { if (!(p)) { \
|
#define NO_MEMORY_FATAL(p) do { if (!(p)) { \
|
||||||
DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
|
DEBUG(DEBUG_CRIT,("Out of memory for %s at %s\n", #p, __location__)); \
|
||||||
exit(10); \
|
exit(10); \
|
||||||
}} while (0)
|
}} while (0)
|
||||||
|
|
||||||
|
@ -41,14 +41,14 @@ int ctdb_sys_open_sending_socket(void)
|
|||||||
|
|
||||||
s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
|
s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
DEBUG(0,(" failed to open raw socket (%s)\n",
|
DEBUG(DEBUG_CRIT,(" failed to open raw socket (%s)\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = setsockopt(s, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one));
|
ret = setsockopt(s, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(" failed to setup IP headers (%s)\n",
|
DEBUG(DEBUG_CRIT, (" failed to setup IP headers (%s)\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
@ -123,7 +123,7 @@ int ctdb_sys_send_tcp(int s,
|
|||||||
|
|
||||||
/* for now, we only handle AF_INET addresses */
|
/* for now, we only handle AF_INET addresses */
|
||||||
if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
|
if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
|
||||||
DEBUG(0,(__location__ " not an ipv4 address\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ int ctdb_sys_send_tcp(int s,
|
|||||||
|
|
||||||
ret = sendto(s, &pkt, sizeof(pkt), 0, (struct sockaddr *)dest, sizeof(*dest));
|
ret = sendto(s, &pkt, sizeof(pkt), 0, (struct sockaddr *)dest, sizeof(*dest));
|
||||||
if (ret != sizeof(pkt)) {
|
if (ret != sizeof(pkt)) {
|
||||||
DEBUG(0,(__location__ " failed sendto (%s)\n", strerror(errno)));
|
DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
|
|||||||
|
|
||||||
pt=pcap_open_live(iface, 100, 0, 0, NULL);
|
pt=pcap_open_live(iface, 100, 0, 0, NULL);
|
||||||
if (pt == NULL) {
|
if (pt == NULL) {
|
||||||
DEBUG(0,("Failed to open capture device %s\n", iface));
|
DEBUG(DEBUG_CRIT,("Failed to open capture device %s\n", iface));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*((pcap_t **)private_data) = pt;
|
*((pcap_t **)private_data) = pt;
|
||||||
|
@ -49,13 +49,13 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
|
|||||||
|
|
||||||
/* for now, we only handle AF_INET addresses */
|
/* for now, we only handle AF_INET addresses */
|
||||||
if (saddr->sin_family != AF_INET) {
|
if (saddr->sin_family != AF_INET) {
|
||||||
DEBUG(0,(__location__ " not an ipv4 address (family is %u)\n", saddr->sin_family));
|
DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address (family is %u)\n", saddr->sin_family));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_ARP));
|
s = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_ARP));
|
||||||
if (s == -1){
|
if (s == -1){
|
||||||
DEBUG(0,(__location__ " failed to open raw socket\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
|
|||||||
ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
|
ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
|
||||||
if ( ret < 0 ) {
|
if ( ret < 0 ) {
|
||||||
close(s);
|
close(s);
|
||||||
DEBUG(0,(__location__ " ioctl failed\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " ioctl failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ARPHRD_LOOPBACK == if_hwaddr.ifr_hwaddr.sa_family) {
|
if (ARPHRD_LOOPBACK == if_hwaddr.ifr_hwaddr.sa_family) {
|
||||||
@ -75,7 +75,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
|
|||||||
if (if_hwaddr.ifr_hwaddr.sa_family != AF_LOCAL) {
|
if (if_hwaddr.ifr_hwaddr.sa_family != AF_LOCAL) {
|
||||||
close(s);
|
close(s);
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
DEBUG(0,(__location__ " not an ethernet address family (0x%x)\n",
|
DEBUG(DEBUG_CRIT,(__location__ " not an ethernet address family (0x%x)\n",
|
||||||
if_hwaddr.ifr_hwaddr.sa_family));
|
if_hwaddr.ifr_hwaddr.sa_family));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
|
|||||||
ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
|
ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
|
||||||
if (ret < 0 ){
|
if (ret < 0 ){
|
||||||
close(s);
|
close(s);
|
||||||
DEBUG(0,(__location__ " failed sendto\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
|
|||||||
strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
|
strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
|
||||||
ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
|
ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
|
||||||
if (ret < 0 ){
|
if (ret < 0 ){
|
||||||
DEBUG(0,(__location__ " failed sendto\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ int ctdb_sys_send_tcp(int s,
|
|||||||
|
|
||||||
/* for now, we only handle AF_INET addresses */
|
/* for now, we only handle AF_INET addresses */
|
||||||
if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
|
if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
|
||||||
DEBUG(0,(__location__ " not an ipv4 address\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ int ctdb_sys_send_tcp(int s,
|
|||||||
|
|
||||||
ret = sendto(s, &pkt, sizeof(pkt), 0, dest, sizeof(*dest));
|
ret = sendto(s, &pkt, sizeof(pkt), 0, dest, sizeof(*dest));
|
||||||
if (ret != sizeof(pkt)) {
|
if (ret != sizeof(pkt)) {
|
||||||
DEBUG(0,(__location__ " failed sendto (%s)\n", strerror(errno)));
|
DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
|
|||||||
/* Open a socket to capture all traffic */
|
/* Open a socket to capture all traffic */
|
||||||
s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
|
s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
DEBUG(0,(__location__ " failed to open raw socket\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,14 +300,14 @@ int ctdb_sys_open_sending_socket(void)
|
|||||||
|
|
||||||
s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
|
s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
DEBUG(0,(__location__ " failed to open raw socket (%s)\n",
|
DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = setsockopt(s, SOL_IP, IP_HDRINCL, &one, sizeof(one));
|
ret = setsockopt(s, SOL_IP, IP_HDRINCL, &one, sizeof(one));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " failed to setup IP headers (%s)\n",
|
DEBUG(DEBUG_CRIT,(__location__ " failed to setup IP headers (%s)\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -56,13 +56,13 @@ int ctdb_ibw_node_connect(struct ctdb_node *node)
|
|||||||
sock_out.sin_port = htons(node->address.port);
|
sock_out.sin_port = htons(node->address.port);
|
||||||
sock_out.sin_family = PF_INET;
|
sock_out.sin_family = PF_INET;
|
||||||
if (ctdb_ibw_get_address(node->ctdb, node->address.address, &sock_out.sin_addr)) {
|
if (ctdb_ibw_get_address(node->ctdb, node->address.address, &sock_out.sin_addr)) {
|
||||||
DEBUG(0, ("ctdb_ibw_node_connect failed\n"));
|
DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ibw_connect(cn->conn, &sock_out, node);
|
rc = ibw_connect(cn->conn, &sock_out, node);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DEBUG(0, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
|
DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
|
||||||
/* try again once a second */
|
/* try again once a second */
|
||||||
event_add_timed(node->ctdb->ev, node, timeval_current_ofs(1, 0),
|
event_add_timed(node->ctdb->ev, node, timeval_current_ofs(1, 0),
|
||||||
ctdb_ibw_node_connect_event, node);
|
ctdb_ibw_node_connect_event, node);
|
||||||
@ -92,7 +92,7 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
|
|||||||
case IBWS_CONNECT_REQUEST: /* after [IBWS_READY + incoming request] */
|
case IBWS_CONNECT_REQUEST: /* after [IBWS_READY + incoming request] */
|
||||||
/* => [(ibw_accept)IBWS_READY | (ibw_disconnect)STOPPED | ERROR] */
|
/* => [(ibw_accept)IBWS_READY | (ibw_disconnect)STOPPED | ERROR] */
|
||||||
if (ibw_accept(ctx, conn, NULL)) {
|
if (ibw_accept(ctx, conn, NULL)) {
|
||||||
DEBUG(0, ("connstate_handler/ibw_accept failed\n"));
|
DEBUG(DEBUG_ERR, ("connstate_handler/ibw_accept failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
} /* else continue in IBWC_CONNECTED */
|
} /* else continue in IBWC_CONNECTED */
|
||||||
break;
|
break;
|
||||||
|
@ -41,12 +41,12 @@ static int ctdb_ibw_listen(struct ctdb_context *ctdb, int backlog)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (ibw_bind(ictx, &my_addr)) {
|
if (ibw_bind(ictx, &my_addr)) {
|
||||||
DEBUG(0, ("ctdb_ibw_listen: ibw_bind failed\n"));
|
DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_bind failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ibw_listen(ictx, backlog)) {
|
if (ibw_listen(ictx, backlog)) {
|
||||||
DEBUG(0, ("ctdb_ibw_listen: ibw_listen failed\n"));
|
DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_listen failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ static int ctdb_ibw_initialise(struct ctdb_context *ctdb)
|
|||||||
|
|
||||||
for (i=0; i<ctdb->num_nodes; i++) {
|
for (i=0; i<ctdb->num_nodes; i++) {
|
||||||
if (ctdb_ibw_add_node(ctdb->nodes[i]) != 0) {
|
if (ctdb_ibw_add_node(ctdb->nodes[i]) != 0) {
|
||||||
DEBUG(0, ("methods->add_node failed at %d\n", i));
|
DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ static int ctdb_ibw_send_pkt(struct ibw_conn *conn, uint8_t *data, uint32_t leng
|
|||||||
void *buf, *key;
|
void *buf, *key;
|
||||||
|
|
||||||
if (ibw_alloc_send_buf(conn, &buf, &key, length)) {
|
if (ibw_alloc_send_buf(conn, &buf, &key, length)) {
|
||||||
DEBUG(0, ("queue_pkt/ibw_alloc_send_buf failed\n"));
|
DEBUG(DEBUG_ERR, ("queue_pkt/ibw_alloc_send_buf failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
|
|||||||
assert(cn!=NULL);
|
assert(cn!=NULL);
|
||||||
|
|
||||||
if (cn->conn==NULL) {
|
if (cn->conn==NULL) {
|
||||||
DEBUG(0, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
|
DEBUG(DEBUG_ERR, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
|
|||||||
static void ctdb_ibw_restart(struct ctdb_node *node)
|
static void ctdb_ibw_restart(struct ctdb_node *node)
|
||||||
{
|
{
|
||||||
/* TODO: implement this method for IB */
|
/* TODO: implement this method for IB */
|
||||||
DEBUG(0,("WARNING: method restart is not yet implemented for IB\n"));
|
DEBUG(DEBUG_ALERT,("WARNING: method restart is not yet implemented for IB\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -232,7 +232,7 @@ int ctdb_ibw_init(struct ctdb_context *ctdb)
|
|||||||
ctdb->ev);
|
ctdb->ev);
|
||||||
|
|
||||||
if (ictx==NULL) {
|
if (ictx==NULL) {
|
||||||
DEBUG(0, ("ctdb_ibw_init: ibw_init failed\n"));
|
DEBUG(DEBUG_CRIT, ("ctdb_ibw_init: ibw_init failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ static int ibw_refill_cq_recv(struct ibw_conn *conn)
|
|||||||
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
|
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sprintf(ibw_lasterr, "refill/ibv_post_recv failed with %d\n", rc);
|
sprintf(ibw_lasterr, "refill/ibv_post_recv failed with %d\n", rc);
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ static int ibw_fill_cq(struct ibw_conn *conn)
|
|||||||
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
|
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sprintf(ibw_lasterr, "fill/ibv_post_recv failed with %d\n", rc);
|
sprintf(ibw_lasterr, "fill/ibv_post_recv failed with %d\n", rc);
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
|
|||||||
if (!pconn->is_accepted) {
|
if (!pconn->is_accepted) {
|
||||||
rc = rdma_reject(cma_id, NULL, 0);
|
rc = rdma_reject(cma_id, NULL, 0);
|
||||||
if (rc)
|
if (rc)
|
||||||
DEBUG(0, ("rdma_reject failed with rc=%d\n", rc));
|
DEBUG(DEBUG_ERR, ("rdma_reject failed with rc=%d\n", rc));
|
||||||
talloc_free(conn);
|
talloc_free(conn);
|
||||||
DEBUG(DEBUG_DEBUG, ("pconn->cm_id %p wasn't accepted\n", pconn->cm_id));
|
DEBUG(DEBUG_DEBUG, ("pconn->cm_id %p wasn't accepted\n", pconn->cm_id));
|
||||||
}
|
}
|
||||||
@ -523,7 +523,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
|
|||||||
if (conn) {
|
if (conn) {
|
||||||
/* must be done BEFORE connstate */
|
/* must be done BEFORE connstate */
|
||||||
if ((rc=rdma_ack_cm_event(event)))
|
if ((rc=rdma_ack_cm_event(event)))
|
||||||
DEBUG(0, ("reject/rdma_ack_cm_event failed with %d\n", rc));
|
DEBUG(DEBUG_ERR, ("reject/rdma_ack_cm_event failed with %d\n", rc));
|
||||||
event = NULL; /* not to touch cma_id or conn */
|
event = NULL; /* not to touch cma_id or conn */
|
||||||
conn->state = IBWC_ERROR;
|
conn->state = IBWC_ERROR;
|
||||||
/* it should free the conn */
|
/* it should free the conn */
|
||||||
@ -534,11 +534,11 @@ static void ibw_event_handler_cm(struct event_context *ev,
|
|||||||
case RDMA_CM_EVENT_DISCONNECTED:
|
case RDMA_CM_EVENT_DISCONNECTED:
|
||||||
DEBUG(DEBUG_DEBUG, ("RDMA_CM_EVENT_DISCONNECTED\n"));
|
DEBUG(DEBUG_DEBUG, ("RDMA_CM_EVENT_DISCONNECTED\n"));
|
||||||
if ((rc=rdma_ack_cm_event(event)))
|
if ((rc=rdma_ack_cm_event(event)))
|
||||||
DEBUG(0, ("disc/rdma_ack_cm_event failed with %d\n", rc));
|
DEBUG(DEBUG_ERR, ("disc/rdma_ack_cm_event failed with %d\n", rc));
|
||||||
event = NULL; /* don't ack more */
|
event = NULL; /* don't ack more */
|
||||||
|
|
||||||
if (cma_id!=pctx->cm_id) {
|
if (cma_id!=pctx->cm_id) {
|
||||||
DEBUG(0, ("client DISCONNECT event cm_id=%p\n", cma_id));
|
DEBUG(DEBUG_ERR, ("client DISCONNECT event cm_id=%p\n", cma_id));
|
||||||
conn = talloc_get_type(cma_id->context, struct ibw_conn);
|
conn = talloc_get_type(cma_id->context, struct ibw_conn);
|
||||||
conn->state = IBWC_DISCONNECTED;
|
conn->state = IBWC_DISCONNECTED;
|
||||||
pctx->connstate_func(NULL, conn);
|
pctx->connstate_func(NULL, conn);
|
||||||
@ -561,7 +561,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
DEBUG(0, ("cm event handler: %s", ibw_lasterr));
|
DEBUG(DEBUG_ERR, ("cm event handler: %s", ibw_lasterr));
|
||||||
|
|
||||||
if (event!=NULL) {
|
if (event!=NULL) {
|
||||||
if (cma_id!=NULL && cma_id!=pctx->cm_id) {
|
if (cma_id!=NULL && cma_id!=pctx->cm_id) {
|
||||||
@ -576,7 +576,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rc=rdma_ack_cm_event(event))!=0) {
|
if ((rc=rdma_ack_cm_event(event))!=0) {
|
||||||
DEBUG(0, ("rdma_ack_cm_event failed with %d\n", rc));
|
DEBUG(DEBUG_ERR, ("rdma_ack_cm_event failed with %d\n", rc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,7 +657,7 @@ static void ibw_event_handler_verbs(struct event_context *ev,
|
|||||||
error:
|
error:
|
||||||
ibv_ack_cq_events(pconn->cq, 1);
|
ibv_ack_cq_events(pconn->cq, 1);
|
||||||
|
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
|
|
||||||
if (conn->state!=IBWC_ERROR) {
|
if (conn->state!=IBWC_ERROR) {
|
||||||
conn->state = IBWC_ERROR;
|
conn->state = IBWC_ERROR;
|
||||||
@ -895,7 +895,7 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
DEBUG(0, ("ibw_wc_recv error: %s", ibw_lasterr));
|
DEBUG(DEBUG_ERR, ("ibw_wc_recv error: %s", ibw_lasterr));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -993,7 +993,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
|
|||||||
return ctx;
|
return ctx;
|
||||||
/* don't put code here */
|
/* don't put code here */
|
||||||
cleanup:
|
cleanup:
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
|
|
||||||
if (ctx)
|
if (ctx)
|
||||||
talloc_free(ctx);
|
talloc_free(ctx);
|
||||||
@ -1031,7 +1031,7 @@ int ibw_bind(struct ibw_ctx *ctx, struct sockaddr_in *my_addr)
|
|||||||
rc = rdma_bind_addr(pctx->cm_id, (struct sockaddr *) my_addr);
|
rc = rdma_bind_addr(pctx->cm_id, (struct sockaddr *) my_addr);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sprintf(ibw_lasterr, "rdma_bind_addr error %d\n", rc);
|
sprintf(ibw_lasterr, "rdma_bind_addr error %d\n", rc);
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
DEBUG(DEBUG_DEBUG, ("rdma_bind_addr successful\n"));
|
DEBUG(DEBUG_DEBUG, ("rdma_bind_addr successful\n"));
|
||||||
@ -1048,7 +1048,7 @@ int ibw_listen(struct ibw_ctx *ctx, int backlog)
|
|||||||
rc = rdma_listen(pctx->cm_id, backlog);
|
rc = rdma_listen(pctx->cm_id, backlog);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sprintf(ibw_lasterr, "rdma_listen failed: %d\n", rc);
|
sprintf(ibw_lasterr, "rdma_listen failed: %d\n", rc);
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,7 +1070,7 @@ int ibw_accept(struct ibw_ctx *ctx, struct ibw_conn *conn, void *conn_userdata)
|
|||||||
rc = rdma_accept(pconn->cm_id, &conn_param);
|
rc = rdma_accept(pconn->cm_id, &conn_param);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sprintf(ibw_lasterr, "rdma_accept failed %d\n", rc);
|
sprintf(ibw_lasterr, "rdma_accept failed %d\n", rc);
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
return -1;;
|
return -1;;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1096,7 +1096,7 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn
|
|||||||
|
|
||||||
/* clean previous - probably half - initialization */
|
/* clean previous - probably half - initialization */
|
||||||
if (ibw_conn_priv_destruct(pconn)) {
|
if (ibw_conn_priv_destruct(pconn)) {
|
||||||
DEBUG(0, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
|
DEBUG(DEBUG_ERR, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1117,7 +1117,7 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn
|
|||||||
rc = rdma_resolve_addr(pconn->cm_id, NULL, (struct sockaddr *) serv_addr, 2000);
|
rc = rdma_resolve_addr(pconn->cm_id, NULL, (struct sockaddr *) serv_addr, 2000);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sprintf(ibw_lasterr, "rdma_resolve_addr error %d\n", rc);
|
sprintf(ibw_lasterr, "rdma_resolve_addr error %d\n", rc);
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
talloc_free(conn);
|
talloc_free(conn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1144,7 +1144,7 @@ int ibw_disconnect(struct ibw_conn *conn)
|
|||||||
rc = rdma_disconnect(pconn->cm_id);
|
rc = rdma_disconnect(pconn->cm_id);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sprintf(ibw_lasterr, "ibw_disconnect failed with %d\n", rc);
|
sprintf(ibw_lasterr, "ibw_disconnect failed with %d\n", rc);
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1194,9 +1194,9 @@ int ibw_alloc_send_buf(struct ibw_conn *conn, void **buf, void **key, uint32_t l
|
|||||||
pconn->extra_max++;
|
pconn->extra_max++;
|
||||||
switch(pconn->extra_max) {
|
switch(pconn->extra_max) {
|
||||||
case 1: DEBUG(DEBUG_INFO, ("warning: queue performed\n")); break;
|
case 1: DEBUG(DEBUG_INFO, ("warning: queue performed\n")); break;
|
||||||
case 10: DEBUG(0, ("warning: queue reached 10\n")); break;
|
case 10: DEBUG(DEBUG_INFO, ("warning: queue reached 10\n")); break;
|
||||||
case 100: DEBUG(0, ("warning: queue reached 100\n")); break;
|
case 100: DEBUG(DEBUG_INFO, ("warning: queue reached 100\n")); break;
|
||||||
case 1000: DEBUG(0, ("warning: queue reached 1000\n")); break;
|
case 1000: DEBUG(DEBUG_INFO, ("warning: queue reached 1000\n")); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1218,7 +1218,7 @@ int ibw_alloc_send_buf(struct ibw_conn *conn, void **buf, void **key, uint32_t l
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
DEBUG(0, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
|
DEBUG(DEBUG_ERR, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1282,7 +1282,7 @@ static int ibw_send_packet(struct ibw_conn *conn, void *buf, struct ibw_wr *p, u
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
DEBUG(0, (ibw_lasterr));
|
DEBUG(DEBUG_ERR, (ibw_lasterr));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ int ibwtest_send_id(struct ibw_conn *conn)
|
|||||||
DEBUG(DEBUG_DEBUG, ("ibwtest_send_id\n"));
|
DEBUG(DEBUG_DEBUG, ("ibwtest_send_id\n"));
|
||||||
len = sizeof(uint32_t)+strlen(tcx->id)+2;
|
len = sizeof(uint32_t)+strlen(tcx->id)+2;
|
||||||
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
|
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
|
||||||
DEBUG(0, ("send_id: ibw_alloc_send_buf failed\n"));
|
DEBUG(DEBUG_ERR, ("send_id: ibw_alloc_send_buf failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ int ibwtest_send_id(struct ibw_conn *conn)
|
|||||||
strcpy(buf+sizeof(uint32_t)+1, tcx->id);
|
strcpy(buf+sizeof(uint32_t)+1, tcx->id);
|
||||||
|
|
||||||
if (ibw_send(conn, buf, key, len)) {
|
if (ibw_send(conn, buf, key, len)) {
|
||||||
DEBUG(0, ("send_id: ibw_send error\n"));
|
DEBUG(DEBUG_ERR, ("send_id: ibw_send error\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tcx->nsent++;
|
tcx->nsent++;
|
||||||
@ -147,7 +147,7 @@ int ibwtest_send_test_msg(struct ibwtest_ctx *tcx, struct ibw_conn *conn, const
|
|||||||
strcpy(p, msg);
|
strcpy(p, msg);
|
||||||
|
|
||||||
if (ibw_send(conn, buf, key, len)) {
|
if (ibw_send(conn, buf, key, len)) {
|
||||||
DEBUG(0, ("send_test_msg: ibw_send error\n"));
|
DEBUG(DEBUG_ERR, ("send_test_msg: ibw_send error\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tcx->nsent++;
|
tcx->nsent++;
|
||||||
@ -190,7 +190,7 @@ int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_co
|
|||||||
|
|
||||||
len = sizeof(uint32_t) + 1 + size + 1;
|
len = sizeof(uint32_t) + 1 + size + 1;
|
||||||
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
|
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
|
||||||
DEBUG(0, ("varsize/ibw_alloc_send_buf failed\n"));
|
DEBUG(DEBUG_ERR, ("varsize/ibw_alloc_send_buf failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*((uint32_t *)buf) = len;
|
*((uint32_t *)buf) = len;
|
||||||
@ -198,7 +198,7 @@ int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_co
|
|||||||
sum = ibwtest_fill_random(buf + sizeof(uint32_t) + 1, size);
|
sum = ibwtest_fill_random(buf + sizeof(uint32_t) + 1, size);
|
||||||
buf[sizeof(uint32_t) + 1 + size] = sum;
|
buf[sizeof(uint32_t) + 1 + size] = sum;
|
||||||
if (ibw_send(conn, buf, key, len)) {
|
if (ibw_send(conn, buf, key, len)) {
|
||||||
DEBUG(0, ("varsize/ibw_send failed\n"));
|
DEBUG(DEBUG_ERR, ("varsize/ibw_send failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tcx->nsent++;
|
tcx->nsent++;
|
||||||
@ -254,7 +254,7 @@ int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
|
|||||||
DEBUG(DEBUG_DEBUG, ("test IBWS_CONNECT_REQUEST\n"));
|
DEBUG(DEBUG_DEBUG, ("test IBWS_CONNECT_REQUEST\n"));
|
||||||
tconn = talloc_zero(conn, struct ibwtest_conn);
|
tconn = talloc_zero(conn, struct ibwtest_conn);
|
||||||
if (ibw_accept(ctx, conn, tconn)) {
|
if (ibw_accept(ctx, conn, tconn)) {
|
||||||
DEBUG(0, ("error accepting the connect request\n"));
|
DEBUG(DEBUG_ERR, ("error accepting the connect request\n"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IBWS_STOPPED:
|
case IBWS_STOPPED:
|
||||||
@ -279,7 +279,7 @@ int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
|
|||||||
break;
|
break;
|
||||||
case IBWC_CONNECTED:
|
case IBWC_CONNECTED:
|
||||||
if (gettimeofday(&tcx->start_time, NULL)) {
|
if (gettimeofday(&tcx->start_time, NULL)) {
|
||||||
DEBUG(0, ("gettimeofday error %d", errno));
|
DEBUG(DEBUG_ERR, ("gettimeofday error %d", errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ibwtest_send_id(conn);
|
ibwtest_send_id(conn);
|
||||||
@ -330,7 +330,7 @@ int ibwtest_receive_handler(struct ibw_conn *conn, void *buf, int n)
|
|||||||
(uint32_t)sum,
|
(uint32_t)sum,
|
||||||
tconn->id ? tconn->id : "NULL"));
|
tconn->id ? tconn->id : "NULL"));
|
||||||
if (sum!=((unsigned char *)buf)[n-1]) {
|
if (sum!=((unsigned char *)buf)[n-1]) {
|
||||||
DEBUG(0, ("ERROR: checksum mismatch %u!=%u\n",
|
DEBUG(DEBUG_ERR, ("ERROR: checksum mismatch %u!=%u\n",
|
||||||
(uint32_t)sum, (uint32_t)((unsigned char *)buf)[n-1]));
|
(uint32_t)sum, (uint32_t)((unsigned char *)buf)[n-1]));
|
||||||
ibw_stop(tcx->ibwctx);
|
ibw_stop(tcx->ibwctx);
|
||||||
goto error;
|
goto error;
|
||||||
@ -404,7 +404,7 @@ static struct ibwtest_ctx *testctx = NULL;
|
|||||||
|
|
||||||
void ibwtest_sigint_handler(int sig)
|
void ibwtest_sigint_handler(int sig)
|
||||||
{
|
{
|
||||||
DEBUG(0, ("got SIGINT\n"));
|
DEBUG(DEBUG_ERR, ("got SIGINT\n"));
|
||||||
if (testctx) {
|
if (testctx) {
|
||||||
if (testctx->ibwctx->state==IBWS_READY ||
|
if (testctx->ibwctx->state==IBWS_READY ||
|
||||||
testctx->ibwctx->state==IBWS_CONNECT_REQUEST ||
|
testctx->ibwctx->state==IBWS_CONNECT_REQUEST ||
|
||||||
@ -470,7 +470,7 @@ static int ibwtest_get_address(const char *address, struct in_addr *addr)
|
|||||||
if (inet_pton(AF_INET, address, addr) <= 0) {
|
if (inet_pton(AF_INET, address, addr) <= 0) {
|
||||||
struct hostent *he = gethostbyname(address);
|
struct hostent *he = gethostbyname(address);
|
||||||
if (he == NULL || he->h_length > sizeof(*addr)) {
|
if (he == NULL || he->h_length > sizeof(*addr)) {
|
||||||
DEBUG(0, ("invalid nework address '%s'\n", address));
|
DEBUG(DEBUG_ERR, ("invalid nework address '%s'\n", address));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(addr, he->h_addr, he->h_length);
|
memcpy(addr, he->h_addr, he->h_length);
|
||||||
@ -511,12 +511,12 @@ int ibwtest_init_server(struct ibwtest_ctx *tcx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ibw_bind(tcx->ibwctx, &tcx->addrs[0])) {
|
if (ibw_bind(tcx->ibwctx, &tcx->addrs[0])) {
|
||||||
DEBUG(0, ("ERROR: ibw_bind failed\n"));
|
DEBUG(DEBUG_ERR, ("ERROR: ibw_bind failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ibw_listen(tcx->ibwctx, 1)) {
|
if (ibw_listen(tcx->ibwctx, 1)) {
|
||||||
DEBUG(0, ("ERROR: ibw_listen failed\n"));
|
DEBUG(DEBUG_ERR, ("ERROR: ibw_listen failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,7 +637,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!tcx->is_server && tcx->nsent!=0 && !tcx->error) {
|
if (!tcx->is_server && tcx->nsent!=0 && !tcx->error) {
|
||||||
if (gettimeofday(&tcx->end_time, NULL)) {
|
if (gettimeofday(&tcx->end_time, NULL)) {
|
||||||
DEBUG(0, ("gettimeofday error %d\n", errno));
|
DEBUG(DEBUG_ERR, ("gettimeofday error %d\n", errno));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
usec = (tcx->end_time.tv_sec - tcx->start_time.tv_sec) * 1000000 +
|
usec = (tcx->end_time.tv_sec - tcx->start_time.tv_sec) * 1000000 +
|
||||||
@ -654,6 +654,6 @@ cleanup:
|
|||||||
talloc_free(tcx);
|
talloc_free(tcx);
|
||||||
if (ev)
|
if (ev)
|
||||||
talloc_free(ev);
|
talloc_free(ev);
|
||||||
DEBUG(0, ("exited with code %d\n", result));
|
DEBUG(DEBUG_ERR, ("exited with code %d\n", result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ static void ctdb_send_dmaster_reply(struct ctdb_db_context *ctdb_db,
|
|||||||
TALLOC_CTX *tmp_ctx;
|
TALLOC_CTX *tmp_ctx;
|
||||||
|
|
||||||
if (ctdb->pnn != ctdb_lmaster(ctdb, &key)) {
|
if (ctdb->pnn != ctdb_lmaster(ctdb, &key)) {
|
||||||
DEBUG(0,(__location__ " Caller is not lmaster!\n"));
|
DEBUG(DEBUG_ALERT,(__location__ " Caller is not lmaster!\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
|
|||||||
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
|
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
|
||||||
|
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",
|
DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",
|
||||||
ctdb->pnn, hdr->reqid, hdr->srcnode));
|
ctdb->pnn, hdr->reqid, hdr->srcnode));
|
||||||
ctdb_ltdb_unlock(ctdb_db, key);
|
ctdb_ltdb_unlock(ctdb_db, key);
|
||||||
return;
|
return;
|
||||||
@ -254,7 +254,7 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
|
|||||||
|
|
||||||
if (hdr->reqid != state->reqid) {
|
if (hdr->reqid != state->reqid) {
|
||||||
/* we found a record but it was the wrong one */
|
/* we found a record but it was the wrong one */
|
||||||
DEBUG(0, ("Dropped orphan in ctdb_become_dmaster with reqid:%u\n from node %u", hdr->reqid, hdr->srcnode));
|
DEBUG(DEBUG_ERR, ("Dropped orphan in ctdb_become_dmaster with reqid:%u\n from node %u", hdr->reqid, hdr->srcnode));
|
||||||
ctdb_ltdb_unlock(ctdb_db, key);
|
ctdb_ltdb_unlock(ctdb_db, key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctdb_lmaster(ctdb, &key) != ctdb->pnn) {
|
if (ctdb_lmaster(ctdb, &key) != ctdb->pnn) {
|
||||||
DEBUG(0,("pnn %u dmaster request to non-lmaster lmaster=%u gen=%u curgen=%u\n",
|
DEBUG(DEBUG_ALERT,("pnn %u dmaster request to non-lmaster lmaster=%u gen=%u curgen=%u\n",
|
||||||
ctdb->pnn, ctdb_lmaster(ctdb, &key),
|
ctdb->pnn, ctdb_lmaster(ctdb, &key),
|
||||||
hdr->generation, ctdb->vnn_map->generation));
|
hdr->generation, ctdb->vnn_map->generation));
|
||||||
ctdb_fatal(ctdb, "ctdb_req_dmaster to non-lmaster");
|
ctdb_fatal(ctdb, "ctdb_req_dmaster to non-lmaster");
|
||||||
@ -322,7 +322,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
|
|||||||
|
|
||||||
/* its a protocol error if the sending node is not the current dmaster */
|
/* its a protocol error if the sending node is not the current dmaster */
|
||||||
if (header.dmaster != hdr->srcnode) {
|
if (header.dmaster != hdr->srcnode) {
|
||||||
DEBUG(0,("pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n",
|
DEBUG(DEBUG_ALERT,("pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n",
|
||||||
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
|
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
|
||||||
ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
|
ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
|
||||||
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid,
|
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid,
|
||||||
@ -334,7 +334,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (header.rsn > c->rsn) {
|
if (header.rsn > c->rsn) {
|
||||||
DEBUG(0,("pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u\n",
|
DEBUG(DEBUG_ALERT,("pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u\n",
|
||||||
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
|
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
|
||||||
ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
|
ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
|
||||||
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid));
|
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid));
|
||||||
@ -459,13 +459,13 @@ void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
|
|
||||||
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
|
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0, (__location__ " reqid %u not found\n", hdr->reqid));
|
DEBUG(DEBUG_ERR, (__location__ " reqid %u not found\n", hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->reqid != state->reqid) {
|
if (hdr->reqid != state->reqid) {
|
||||||
/* we found a record but it was the wrong one */
|
/* we found a record but it was the wrong one */
|
||||||
DEBUG(0, ("Dropped orphaned call reply with reqid:%u\n",hdr->reqid));
|
DEBUG(DEBUG_ERR, ("Dropped orphaned call reply with reqid:%u\n",hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +498,7 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, c->db_id);
|
ctdb_db = find_ctdb_db(ctdb, c->db_id);
|
||||||
if (ctdb_db == NULL) {
|
if (ctdb_db == NULL) {
|
||||||
DEBUG(0,("Unknown db_id 0x%x in ctdb_reply_dmaster\n", c->db_id));
|
DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_reply_dmaster\n", c->db_id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to get lock in ctdb_reply_dmaster\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get lock in ctdb_reply_dmaster\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,14 +531,14 @@ void ctdb_reply_error(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
|
|
||||||
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
|
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,("pnn %u Invalid reqid %u in ctdb_reply_error\n",
|
DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_reply_error\n",
|
||||||
ctdb->pnn, hdr->reqid));
|
ctdb->pnn, hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->reqid != state->reqid) {
|
if (hdr->reqid != state->reqid) {
|
||||||
/* we found a record but it was the wrong one */
|
/* we found a record but it was the wrong one */
|
||||||
DEBUG(0, ("Dropped orphaned error reply with reqid:%u\n",hdr->reqid));
|
DEBUG(DEBUG_ERR, ("Dropped orphaned error reply with reqid:%u\n",hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ static void ctdb_call_resend(struct ctdb_call_state *state)
|
|||||||
state->c->hdr.destnode = ctdb->pnn;
|
state->c->hdr.destnode = ctdb->pnn;
|
||||||
|
|
||||||
ctdb_queue_packet(ctdb, &state->c->hdr);
|
ctdb_queue_packet(ctdb, &state->c->hdr);
|
||||||
DEBUG(0,("resent ctdb_call\n"));
|
DEBUG(DEBUG_NOTICE,("resent ctdb_call\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -46,7 +46,7 @@ static int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata)
|
|||||||
long fsize;
|
long fsize;
|
||||||
f = tmpfile();
|
f = tmpfile();
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
DEBUG(0,(__location__ " Unable to open tmpfile - %s\n", strerror(errno)));
|
DEBUG(DEBUG_ERR,(__location__ " Unable to open tmpfile - %s\n", strerror(errno)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
talloc_report_full(NULL, f);
|
talloc_report_full(NULL, f);
|
||||||
@ -57,7 +57,7 @@ static int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata)
|
|||||||
outdata->dsize = fread(outdata->dptr, 1, fsize, f);
|
outdata->dsize = fread(outdata->dptr, 1, fsize, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (outdata->dsize != fsize) {
|
if (outdata->dsize != fsize) {
|
||||||
DEBUG(0,(__location__ " Unable to read tmpfile\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Unable to read tmpfile\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -155,7 +155,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
|||||||
case CTDB_CONTROL_SET_RECMASTER: {
|
case CTDB_CONTROL_SET_RECMASTER: {
|
||||||
CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
|
CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("Attempt to set recmaster when not frozen\n"));
|
DEBUG(DEBUG_NOTICE,("Attempt to set recmaster when not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ctdb->recovery_master = ((uint32_t *)(&indata.dptr[0]))[0];
|
ctdb->recovery_master = ((uint32_t *)(&indata.dptr[0]))[0];
|
||||||
@ -260,7 +260,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
|||||||
ctdb_release_all_ips(ctdb);
|
ctdb_release_all_ips(ctdb);
|
||||||
ctdb->methods->shutdown(ctdb);
|
ctdb->methods->shutdown(ctdb);
|
||||||
ctdb_event_script(ctdb, "shutdown");
|
ctdb_event_script(ctdb, "shutdown");
|
||||||
DEBUG(0,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
|
DEBUG(DEBUG_NOTICE,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
case CTDB_CONTROL_TAKEOVER_IP:
|
case CTDB_CONTROL_TAKEOVER_IP:
|
||||||
@ -361,7 +361,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
|||||||
case CTDB_CONTROL_END_RECOVERY:
|
case CTDB_CONTROL_END_RECOVERY:
|
||||||
return ctdb_control_end_recovery(ctdb, c, async_reply);
|
return ctdb_control_end_recovery(ctdb, c, async_reply);
|
||||||
default:
|
default:
|
||||||
DEBUG(0,(__location__ " Unknown CTDB control opcode %u\n", opcode));
|
DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,14 +441,14 @@ void ctdb_reply_control(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
|
|
||||||
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_control_state);
|
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_control_state);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,("pnn %u Invalid reqid %u in ctdb_reply_control\n",
|
DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_reply_control\n",
|
||||||
ctdb->pnn, hdr->reqid));
|
ctdb->pnn, hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->reqid != state->reqid) {
|
if (hdr->reqid != state->reqid) {
|
||||||
/* we found a record but it was the wrong one */
|
/* we found a record but it was the wrong one */
|
||||||
DEBUG(0, ("Dropped orphaned control reply with reqid:%u\n", hdr->reqid));
|
DEBUG(DEBUG_ERR, ("Dropped orphaned control reply with reqid:%u\n", hdr->reqid));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
|
|||||||
(destnode == CTDB_BROADCAST_ALL) ||
|
(destnode == CTDB_BROADCAST_ALL) ||
|
||||||
(destnode == CTDB_BROADCAST_CONNECTED)) &&
|
(destnode == CTDB_BROADCAST_CONNECTED)) &&
|
||||||
!(flags & CTDB_CTRL_FLAG_NOREPLY)) {
|
!(flags & CTDB_CTRL_FLAG_NOREPLY)) {
|
||||||
DEBUG(0,("Attempt to broadcast control without NOREPLY\n"));
|
DEBUG(DEBUG_CRIT,("Attempt to broadcast control without NOREPLY\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +39,12 @@ static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
|||||||
struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
|
struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
|
||||||
|
|
||||||
if (data.dsize != sizeof(*c) || !ctdb_validate_pnn(ctdb, c->pnn)) {
|
if (data.dsize != sizeof(*c) || !ctdb_validate_pnn(ctdb, c->pnn)) {
|
||||||
DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
|
DEBUG(DEBUG_CRIT,(__location__ "Invalid data in ctdb_node_flag_change\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctdb_validate_pnn(ctdb, c->pnn)) {
|
if (!ctdb_validate_pnn(ctdb, c->pnn)) {
|
||||||
DEBUG(0,("Bad pnn %u in flag_change_handler\n", c->pnn));
|
DEBUG(DEBUG_CRIT,("Bad pnn %u in flag_change_handler\n", c->pnn));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
|||||||
|
|
||||||
static void print_exit_message(void)
|
static void print_exit_message(void)
|
||||||
{
|
{
|
||||||
DEBUG(0,("CTDB daemon shutting down\n"));
|
DEBUG(DEBUG_NOTICE,("CTDB daemon shutting down\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,13 +72,13 @@ static void ctdb_start_transport(struct ctdb_context *ctdb)
|
|||||||
{
|
{
|
||||||
/* start the transport running */
|
/* start the transport running */
|
||||||
if (ctdb->methods->start(ctdb) != 0) {
|
if (ctdb->methods->start(ctdb) != 0) {
|
||||||
DEBUG(0,("transport failed to start!\n"));
|
DEBUG(DEBUG_ALERT,("transport failed to start!\n"));
|
||||||
ctdb_fatal(ctdb, "transport failed to start");
|
ctdb_fatal(ctdb, "transport failed to start");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start the recovery daemon process */
|
/* start the recovery daemon process */
|
||||||
if (ctdb_start_recoverd(ctdb) != 0) {
|
if (ctdb_start_recoverd(ctdb) != 0) {
|
||||||
DEBUG(0,("Failed to start recovery daemon\n"));
|
DEBUG(DEBUG_ALERT,("Failed to start recovery daemon\n"));
|
||||||
exit(11);
|
exit(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,12 +159,12 @@ int daemon_register_message_handler(struct ctdb_context *ctdb, uint32_t client_i
|
|||||||
struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
|
struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
|
||||||
int res;
|
int res;
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
DEBUG(0,("Bad client_id in daemon_request_register_message_handler\n"));
|
DEBUG(DEBUG_ERR,("Bad client_id in daemon_request_register_message_handler\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
res = ctdb_register_message_handler(ctdb, client, srvid, daemon_message_handler, client);
|
res = ctdb_register_message_handler(ctdb, client, srvid, daemon_message_handler, client);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to register handler %llu in daemon\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to register handler %llu in daemon\n",
|
||||||
(unsigned long long)srvid));
|
(unsigned long long)srvid));
|
||||||
} else {
|
} else {
|
||||||
DEBUG(DEBUG_INFO,(__location__ " Registered message handler for srvid=%llu\n",
|
DEBUG(DEBUG_INFO,(__location__ " Registered message handler for srvid=%llu\n",
|
||||||
@ -189,7 +189,7 @@ int daemon_deregister_message_handler(struct ctdb_context *ctdb, uint32_t client
|
|||||||
{
|
{
|
||||||
struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
|
struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
DEBUG(0,("Bad client_id in daemon_request_deregister_message_handler\n"));
|
DEBUG(DEBUG_ERR,("Bad client_id in daemon_request_deregister_message_handler\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return ctdb_deregister_message_handler(ctdb, srvid, client);
|
return ctdb_deregister_message_handler(ctdb, srvid, client);
|
||||||
@ -230,7 +230,7 @@ static void daemon_request_message_from_client(struct ctdb_client *client,
|
|||||||
res = ctdb_daemon_send_message(client->ctdb, c->hdr.destnode,
|
res = ctdb_daemon_send_message(client->ctdb, c->hdr.destnode,
|
||||||
c->srvid, data);
|
c->srvid, data);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to send message to remote node %u\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to send message to remote node %u\n",
|
||||||
c->hdr.destnode));
|
c->hdr.destnode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
|
|||||||
|
|
||||||
res = ctdb_daemon_call_recv(state, dstate->call);
|
res = ctdb_daemon_call_recv(state, dstate->call);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
DEBUG(0, (__location__ " ctdbd_call_recv() returned error\n"));
|
DEBUG(DEBUG_ERR, (__location__ " ctdbd_call_recv() returned error\n"));
|
||||||
client->ctdb->statistics.pending_calls--;
|
client->ctdb->statistics.pending_calls--;
|
||||||
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
|
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
|
||||||
return;
|
return;
|
||||||
@ -270,7 +270,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
|
|||||||
r = ctdbd_allocate_pkt(client->ctdb, dstate, CTDB_REPLY_CALL,
|
r = ctdbd_allocate_pkt(client->ctdb, dstate, CTDB_REPLY_CALL,
|
||||||
length, struct ctdb_reply_call);
|
length, struct ctdb_reply_call);
|
||||||
if (r == NULL) {
|
if (r == NULL) {
|
||||||
DEBUG(0, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
|
DEBUG(DEBUG_ERR, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
|
||||||
client->ctdb->statistics.pending_calls--;
|
client->ctdb->statistics.pending_calls--;
|
||||||
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
|
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
|
||||||
return;
|
return;
|
||||||
@ -281,7 +281,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
|
|||||||
|
|
||||||
res = daemon_queue_send(client, &r->hdr);
|
res = daemon_queue_send(client, &r->hdr);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
DEBUG(0, (__location__ " Failed to queue packet from daemon to client\n"));
|
DEBUG(DEBUG_ERR, (__location__ " Failed to queue packet from daemon to client\n"));
|
||||||
}
|
}
|
||||||
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
|
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
|
||||||
talloc_free(dstate);
|
talloc_free(dstate);
|
||||||
@ -302,13 +302,13 @@ static void daemon_incoming_packet_wrap(void *p, struct ctdb_req_header *hdr)
|
|||||||
struct ctdb_daemon_packet_wrap *w = talloc_get_type(p,
|
struct ctdb_daemon_packet_wrap *w = talloc_get_type(p,
|
||||||
struct ctdb_daemon_packet_wrap);
|
struct ctdb_daemon_packet_wrap);
|
||||||
if (w == NULL) {
|
if (w == NULL) {
|
||||||
DEBUG(0,(__location__ " Bad packet type '%s'\n", talloc_get_name(p)));
|
DEBUG(DEBUG_CRIT,(__location__ " Bad packet type '%s'\n", talloc_get_name(p)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
client = ctdb_reqid_find(w->ctdb, w->client_id, struct ctdb_client);
|
client = ctdb_reqid_find(w->ctdb, w->client_id, struct ctdb_client);
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
DEBUG(0,(__location__ " Packet for disconnected client %u\n",
|
DEBUG(DEBUG_ERR,(__location__ " Packet for disconnected client %u\n",
|
||||||
w->client_id));
|
w->client_id));
|
||||||
talloc_free(w);
|
talloc_free(w);
|
||||||
return;
|
return;
|
||||||
@ -342,7 +342,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
|
|||||||
|
|
||||||
ctdb_db = find_ctdb_db(client->ctdb, c->db_id);
|
ctdb_db = find_ctdb_db(client->ctdb, c->db_id);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0, (__location__ " Unknown database in request. db_id==0x%08x",
|
DEBUG(DEBUG_ERR, (__location__ " Unknown database in request. db_id==0x%08x",
|
||||||
c->db_id));
|
c->db_id));
|
||||||
ctdb->statistics.pending_calls--;
|
ctdb->statistics.pending_calls--;
|
||||||
return;
|
return;
|
||||||
@ -369,7 +369,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
|
|||||||
talloc_free(w);
|
talloc_free(w);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " Unable to fetch record\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Unable to fetch record\n"));
|
||||||
ctdb->statistics.pending_calls--;
|
ctdb->statistics.pending_calls--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -377,7 +377,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
|
|||||||
dstate = talloc(client, struct daemon_call_state);
|
dstate = talloc(client, struct daemon_call_state);
|
||||||
if (dstate == NULL) {
|
if (dstate == NULL) {
|
||||||
ctdb_ltdb_unlock(ctdb_db, key);
|
ctdb_ltdb_unlock(ctdb_db, key);
|
||||||
DEBUG(0,(__location__ " Unable to allocate dstate\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Unable to allocate dstate\n"));
|
||||||
ctdb->statistics.pending_calls--;
|
ctdb->statistics.pending_calls--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
|
|||||||
call = dstate->call = talloc_zero(dstate, struct ctdb_call);
|
call = dstate->call = talloc_zero(dstate, struct ctdb_call);
|
||||||
if (call == NULL) {
|
if (call == NULL) {
|
||||||
ctdb_ltdb_unlock(ctdb_db, key);
|
ctdb_ltdb_unlock(ctdb_db, key);
|
||||||
DEBUG(0,(__location__ " Unable to allocate call\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Unable to allocate call\n"));
|
||||||
ctdb->statistics.pending_calls--;
|
ctdb->statistics.pending_calls--;
|
||||||
ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
|
ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
|
||||||
return;
|
return;
|
||||||
@ -410,7 +410,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
|
|||||||
ctdb_ltdb_unlock(ctdb_db, key);
|
ctdb_ltdb_unlock(ctdb_db, key);
|
||||||
|
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,(__location__ " Unable to setup call send\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Unable to setup call send\n"));
|
||||||
ctdb->statistics.pending_calls--;
|
ctdb->statistics.pending_calls--;
|
||||||
ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
|
ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
|
||||||
return;
|
return;
|
||||||
@ -467,7 +467,7 @@ static void daemon_incoming_packet(void *p, struct ctdb_req_header *hdr)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG(0,(__location__ " daemon: unrecognized operation %u\n",
|
DEBUG(DEBUG_CRIT,(__location__ " daemon: unrecognized operation %u\n",
|
||||||
hdr->operation));
|
hdr->operation));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ static int ux_socket_bind(struct ctdb_context *ctdb)
|
|||||||
/* AIX doesn't like this :( */
|
/* AIX doesn't like this :( */
|
||||||
if (fchown(ctdb->daemon.sd, geteuid(), getegid()) != 0 ||
|
if (fchown(ctdb->daemon.sd, geteuid(), getegid()) != 0 ||
|
||||||
fchmod(ctdb->daemon.sd, 0700) != 0) {
|
fchmod(ctdb->daemon.sd, 0700) != 0) {
|
||||||
DEBUG(0,("Unable to secure ctdb socket '%s', ctdb->daemon.name\n"));
|
DEBUG(DEBUG_CRIT,("Unable to secure ctdb socket '%s', ctdb->daemon.name\n"));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -585,11 +585,11 @@ static int ux_socket_bind(struct ctdb_context *ctdb)
|
|||||||
strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path));
|
strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path));
|
||||||
|
|
||||||
if (bind(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
|
if (bind(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
|
||||||
DEBUG(0,("Unable to bind on ctdb socket '%s'\n", ctdb->daemon.name));
|
DEBUG(DEBUG_CRIT,("Unable to bind on ctdb socket '%s'\n", ctdb->daemon.name));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
if (listen(ctdb->daemon.sd, 10) != 0) {
|
if (listen(ctdb->daemon.sd, 10) != 0) {
|
||||||
DEBUG(0,("Unable to listen on ctdb socket '%s'\n", ctdb->daemon.name));
|
DEBUG(DEBUG_CRIT,("Unable to listen on ctdb socket '%s'\n", ctdb->daemon.name));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
|||||||
/* create a unix domain stream socket to listen to */
|
/* create a unix domain stream socket to listen to */
|
||||||
res = ux_socket_bind(ctdb);
|
res = ux_socket_bind(ctdb);
|
||||||
if (res!=0) {
|
if (res!=0) {
|
||||||
DEBUG(0,(__location__ " Failed to open CTDB unix domain socket\n"));
|
DEBUG(DEBUG_ALERT,(__location__ " Failed to open CTDB unix domain socket\n"));
|
||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
|||||||
setsid();
|
setsid();
|
||||||
close(0);
|
close(0);
|
||||||
if (open("/dev/null", O_RDONLY) != 0) {
|
if (open("/dev/null", O_RDONLY) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to setup stdin on /dev/null\n"));
|
DEBUG(DEBUG_ALERT,(__location__ " Failed to setup stdin on /dev/null\n"));
|
||||||
exit(11);
|
exit(11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -672,13 +672,12 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to initialise transport '%s'\n", ctdb->transport));
|
DEBUG(DEBUG_ERR,("Failed to initialise transport '%s'\n", ctdb->transport));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialise the transport */
|
/* initialise the transport */
|
||||||
if (ctdb->methods->initialise(ctdb) != 0) {
|
if (ctdb->methods->initialise(ctdb) != 0) {
|
||||||
DEBUG(0,("transport failed to initialise!\n"));
|
|
||||||
ctdb_fatal(ctdb, "transport failed to initialise");
|
ctdb_fatal(ctdb, "transport failed to initialise");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +711,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
|||||||
/* go into a wait loop to allow other nodes to complete */
|
/* go into a wait loop to allow other nodes to complete */
|
||||||
event_loop_wait(ctdb->ev);
|
event_loop_wait(ctdb->ev);
|
||||||
|
|
||||||
DEBUG(0,("event_loop_wait() returned. this should not happen\n"));
|
DEBUG(DEBUG_CRIT,("event_loop_wait() returned. this should not happen\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,7 +732,7 @@ struct ctdb_req_header *_ctdb_transport_allocate(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
hdr = (struct ctdb_req_header *)ctdb->methods->allocate_pkt(mem_ctx, size);
|
hdr = (struct ctdb_req_header *)ctdb->methods->allocate_pkt(mem_ctx, size);
|
||||||
if (hdr == NULL) {
|
if (hdr == NULL) {
|
||||||
DEBUG(0,("Unable to allocate transport packet for operation %u of length %u\n",
|
DEBUG(DEBUG_ERR,("Unable to allocate transport packet for operation %u of length %u\n",
|
||||||
operation, (unsigned)length));
|
operation, (unsigned)length));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -862,7 +861,7 @@ static void daemon_request_control_from_client(struct ctdb_client *client,
|
|||||||
data, daemon_control_callback,
|
data, daemon_control_callback,
|
||||||
state);
|
state);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to send control to remote node %u\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to send control to remote node %u\n",
|
||||||
c->hdr.destnode));
|
c->hdr.destnode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -913,7 +912,7 @@ static void ctdb_local_message_trigger(struct event_context *ev, struct timed_ev
|
|||||||
|
|
||||||
res = ctdb_dispatch_message(m->ctdb, m->srvid, m->data);
|
res = ctdb_dispatch_message(m->ctdb, m->srvid, m->data);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
DEBUG(0, (__location__ " Failed to dispatch message for srvid=%llu\n",
|
DEBUG(DEBUG_ERR, (__location__ " Failed to dispatch message for srvid=%llu\n",
|
||||||
(unsigned long long)m->srvid));
|
(unsigned long long)m->srvid));
|
||||||
}
|
}
|
||||||
talloc_free(m);
|
talloc_free(m);
|
||||||
|
@ -84,18 +84,18 @@ static void ctdb_freeze_lock_handler(struct event_context *ev, struct fd_event *
|
|||||||
struct ctdb_freeze_waiter *w;
|
struct ctdb_freeze_waiter *w;
|
||||||
|
|
||||||
if (h->ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
|
if (h->ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("freeze child died - unfreezing\n"));
|
DEBUG(DEBUG_INFO,("freeze child died - unfreezing\n"));
|
||||||
talloc_free(h);
|
talloc_free(h);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read(h->fd, &status, sizeof(status)) != sizeof(status)) {
|
if (read(h->fd, &status, sizeof(status)) != sizeof(status)) {
|
||||||
DEBUG(0,("read error from freeze lock child\n"));
|
DEBUG(DEBUG_ERR,("read error from freeze lock child\n"));
|
||||||
status = -1;
|
status = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == -1) {
|
if (status == -1) {
|
||||||
DEBUG(0,("Failed to get locks in ctdb_freeze_child\n"));
|
DEBUG(DEBUG_ERR,("Failed to get locks in ctdb_freeze_child\n"));
|
||||||
/* we didn't get the locks - destroy the handle */
|
/* we didn't get the locks - destroy the handle */
|
||||||
talloc_free(h);
|
talloc_free(h);
|
||||||
return;
|
return;
|
||||||
@ -128,14 +128,14 @@ static struct ctdb_freeze_handle *ctdb_freeze_lock(struct ctdb_context *ctdb)
|
|||||||
|
|
||||||
/* use socketpair() instead of pipe() so we have bi-directional fds */
|
/* use socketpair() instead of pipe() so we have bi-directional fds */
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) {
|
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) {
|
||||||
DEBUG(0,("Failed to create pipe for ctdb_freeze_lock\n"));
|
DEBUG(DEBUG_ERR,("Failed to create pipe for ctdb_freeze_lock\n"));
|
||||||
talloc_free(h);
|
talloc_free(h);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
h->child = fork();
|
h->child = fork();
|
||||||
if (h->child == -1) {
|
if (h->child == -1) {
|
||||||
DEBUG(0,("Failed to fork child for ctdb_freeze_lock\n"));
|
DEBUG(DEBUG_ERR,("Failed to fork child for ctdb_freeze_lock\n"));
|
||||||
talloc_free(h);
|
talloc_free(h);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ static struct ctdb_freeze_handle *ctdb_freeze_lock(struct ctdb_context *ctdb)
|
|||||||
fde = event_add_fd(ctdb->ev, h, h->fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
|
fde = event_add_fd(ctdb->ev, h, h->fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
|
||||||
ctdb_freeze_lock_handler, h);
|
ctdb_freeze_lock_handler, h);
|
||||||
if (fde == NULL) {
|
if (fde == NULL) {
|
||||||
DEBUG(0,("Failed to setup fd event for ctdb_freeze_lock\n"));
|
DEBUG(DEBUG_ERR,("Failed to setup fd event for ctdb_freeze_lock\n"));
|
||||||
close(fd[0]);
|
close(fd[0]);
|
||||||
talloc_free(h);
|
talloc_free(h);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -258,7 +258,7 @@ int32_t ctdb_control_thaw(struct ctdb_context *ctdb)
|
|||||||
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
||||||
tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
||||||
if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
|
if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to cancel transaction for db '%s'\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
|
||||||
ctdb_db->db_name));
|
ctdb_db->db_name));
|
||||||
}
|
}
|
||||||
tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
||||||
@ -291,7 +291,7 @@ int32_t ctdb_control_transaction_start(struct ctdb_context *ctdb, uint32_t id)
|
|||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ int32_t ctdb_control_transaction_start(struct ctdb_context *ctdb, uint32_t id)
|
|||||||
|
|
||||||
if (ctdb->freeze_handle->transaction_started) {
|
if (ctdb->freeze_handle->transaction_started) {
|
||||||
if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
|
if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to cancel transaction for db '%s'\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
|
||||||
ctdb_db->db_name));
|
ctdb_db->db_name));
|
||||||
/* not a fatal error */
|
/* not a fatal error */
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ int32_t ctdb_control_transaction_start(struct ctdb_context *ctdb, uint32_t id)
|
|||||||
tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to start transaction for db '%s'\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to start transaction for db '%s'\n",
|
||||||
ctdb_db->db_name));
|
ctdb_db->db_name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -334,24 +334,24 @@ int32_t ctdb_control_transaction_commit(struct ctdb_context *ctdb, uint32_t id)
|
|||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctdb->freeze_handle->transaction_started) {
|
if (!ctdb->freeze_handle->transaction_started) {
|
||||||
DEBUG(0,(__location__ " transaction not started\n"));
|
DEBUG(DEBUG_ERR,(__location__ " transaction not started\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id != ctdb->freeze_handle->transaction_id) {
|
if (id != ctdb->freeze_handle->transaction_id) {
|
||||||
DEBUG(0,(__location__ " incorrect transaction id 0x%x in commit\n", id));
|
DEBUG(DEBUG_ERR,(__location__ " incorrect transaction id 0x%x in commit\n", id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
||||||
tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
||||||
if (tdb_transaction_commit(ctdb_db->ltdb->tdb) != 0) {
|
if (tdb_transaction_commit(ctdb_db->ltdb->tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to commit transaction for db '%s'\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to commit transaction for db '%s'\n",
|
||||||
ctdb_db->db_name));
|
ctdb_db->db_name));
|
||||||
/* this has to be fatal to maintain integrity - it should only
|
/* this has to be fatal to maintain integrity - it should only
|
||||||
happen if we run out of disk space */
|
happen if we run out of disk space */
|
||||||
@ -376,28 +376,28 @@ int32_t ctdb_control_wipe_database(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctdb->freeze_handle->transaction_started) {
|
if (!ctdb->freeze_handle->transaction_started) {
|
||||||
DEBUG(0,(__location__ " transaction not started\n"));
|
DEBUG(DEBUG_ERR,(__location__ " transaction not started\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w.transaction_id != ctdb->freeze_handle->transaction_id) {
|
if (w.transaction_id != ctdb->freeze_handle->transaction_id) {
|
||||||
DEBUG(0,(__location__ " incorrect transaction id 0x%x in commit\n", w.transaction_id));
|
DEBUG(DEBUG_ERR,(__location__ " incorrect transaction id 0x%x in commit\n", w.transaction_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, w.db_id);
|
ctdb_db = find_ctdb_db(ctdb, w.db_id);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0,(__location__ " Unknown db 0x%x\n", w.db_id));
|
DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%x\n", w.db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdb_wipe_all(ctdb_db->ltdb->tdb) != 0) {
|
if (tdb_wipe_all(ctdb_db->ltdb->tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to wipe database for db '%s'\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to wipe database for db '%s'\n",
|
||||||
ctdb_db->db_name));
|
ctdb_db->db_name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ static void ctdb_check_for_dead_nodes(struct event_context *ev, struct timed_eve
|
|||||||
node->rx_cnt = 0;
|
node->rx_cnt = 0;
|
||||||
|
|
||||||
if (node->dead_count >= ctdb->tunable.keepalive_limit) {
|
if (node->dead_count >= ctdb->tunable.keepalive_limit) {
|
||||||
DEBUG(0,("dead count reached for node %u\n", node->pnn));
|
DEBUG(DEBUG_NOTICE,("dead count reached for node %u\n", node->pnn));
|
||||||
ctdb_node_dead(node);
|
ctdb_node_dead(node);
|
||||||
ctdb_send_keepalive(ctdb, node->pnn);
|
ctdb_send_keepalive(ctdb, node->pnn);
|
||||||
/* maybe tell the transport layer to kill the
|
/* maybe tell the transport layer to kill the
|
||||||
@ -94,7 +94,7 @@ void ctdb_start_keepalive(struct ctdb_context *ctdb)
|
|||||||
ctdb_check_for_dead_nodes, ctdb);
|
ctdb_check_for_dead_nodes, ctdb);
|
||||||
CTDB_NO_MEMORY_FATAL(ctdb, te);
|
CTDB_NO_MEMORY_FATAL(ctdb, te);
|
||||||
|
|
||||||
DEBUG(0,("Keepalive monitoring has been started\n"));
|
DEBUG(DEBUG_NOTICE,("Keepalive monitoring has been started\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctdb_stop_keepalive(struct ctdb_context *ctdb)
|
void ctdb_stop_keepalive(struct ctdb_context *ctdb)
|
||||||
|
@ -188,7 +188,7 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
|
|||||||
|
|
||||||
/* setup a pipe to catch IO from subprocesses */
|
/* setup a pipe to catch IO from subprocesses */
|
||||||
if (pipe(p) != 0) {
|
if (pipe(p) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to setup for child logging pipe\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to setup for child logging pipe\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ static void lock_fetch_callback(void *p)
|
|||||||
struct lock_fetch_state *state = talloc_get_type(p, struct lock_fetch_state);
|
struct lock_fetch_state *state = talloc_get_type(p, struct lock_fetch_state);
|
||||||
if (!state->ignore_generation &&
|
if (!state->ignore_generation &&
|
||||||
state->generation != state->ctdb->vnn_map->generation) {
|
state->generation != state->ctdb->vnn_map->generation) {
|
||||||
DEBUG(0,("Discarding previous generation lockwait packet\n"));
|
DEBUG(DEBUG_NOTICE,("Discarding previous generation lockwait packet\n"));
|
||||||
talloc_free(state->hdr);
|
talloc_free(state->hdr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ static void ctdb_check_db_empty(struct ctdb_db_context *ctdb_db)
|
|||||||
struct tdb_context *tdb = ctdb_db->ltdb->tdb;
|
struct tdb_context *tdb = ctdb_db->ltdb->tdb;
|
||||||
int count = tdb_traverse_read(tdb, NULL, NULL);
|
int count = tdb_traverse_read(tdb, NULL, NULL);
|
||||||
if (count != 0) {
|
if (count != 0) {
|
||||||
DEBUG(0,(__location__ " tdb '%s' not empty on attach! aborting\n",
|
DEBUG(DEBUG_ALERT,(__location__ " tdb '%s' not empty on attach! aborting\n",
|
||||||
ctdb_db->db_path));
|
ctdb_db->db_path));
|
||||||
ctdb_fatal(ctdb_db->ctdb, "database not empty on attach");
|
ctdb_fatal(ctdb_db->ctdb, "database not empty on attach");
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
|
|||||||
/* check for hash collisions */
|
/* check for hash collisions */
|
||||||
for (tmp_db=ctdb->db_list;tmp_db;tmp_db=tmp_db->next) {
|
for (tmp_db=ctdb->db_list;tmp_db;tmp_db=tmp_db->next) {
|
||||||
if (tmp_db->db_id == ctdb_db->db_id) {
|
if (tmp_db->db_id == ctdb_db->db_id) {
|
||||||
DEBUG(0,("db_id 0x%x hash collision. name1='%s' name2='%s'\n",
|
DEBUG(DEBUG_CRIT,("db_id 0x%x hash collision. name1='%s' name2='%s'\n",
|
||||||
tmp_db->db_id, db_name, tmp_db->db_name));
|
tmp_db->db_id, db_name, tmp_db->db_name));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return -1;
|
return -1;
|
||||||
@ -226,14 +226,14 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
|
|||||||
|
|
||||||
/* make sure the db directory exists */
|
/* make sure the db directory exists */
|
||||||
if (mkdir(ctdb->db_directory, 0700) == -1 && errno != EEXIST) {
|
if (mkdir(ctdb->db_directory, 0700) == -1 && errno != EEXIST) {
|
||||||
DEBUG(0,(__location__ " Unable to create ctdb directory '%s'\n",
|
DEBUG(DEBUG_CRIT,(__location__ " Unable to create ctdb directory '%s'\n",
|
||||||
ctdb->db_directory));
|
ctdb->db_directory));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (persistent && mkdir(ctdb->db_directory_persistent, 0700) == -1 && errno != EEXIST) {
|
if (persistent && mkdir(ctdb->db_directory_persistent, 0700) == -1 && errno != EEXIST) {
|
||||||
DEBUG(0,(__location__ " Unable to create ctdb persistent directory '%s'\n",
|
DEBUG(DEBUG_CRIT,(__location__ " Unable to create ctdb persistent directory '%s'\n",
|
||||||
ctdb->db_directory_persistent));
|
ctdb->db_directory_persistent));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return -1;
|
return -1;
|
||||||
@ -249,7 +249,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
|
|||||||
persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC,
|
persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC,
|
||||||
O_CREAT|O_RDWR, 0666);
|
O_CREAT|O_RDWR, 0666);
|
||||||
if (ctdb_db->ltdb == NULL) {
|
if (ctdb_db->ltdb == NULL) {
|
||||||
DEBUG(0,("Failed to open tdb '%s'\n", ctdb_db->db_path));
|
DEBUG(DEBUG_CRIT,("Failed to open tdb '%s'\n", ctdb_db->db_path));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
|
|||||||
*/
|
*/
|
||||||
ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_null_func, CTDB_NULL_FUNC);
|
ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_null_func, CTDB_NULL_FUNC);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to setup null function for '%s'\n", ctdb_db->db_name));
|
DEBUG(DEBUG_CRIT,("Failed to setup null function for '%s'\n", ctdb_db->db_name));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
|
|||||||
*/
|
*/
|
||||||
ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_fetch_func, CTDB_FETCH_FUNC);
|
ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_fetch_func, CTDB_FETCH_FUNC);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to setup fetch function for '%s'\n", ctdb_db->db_name));
|
DEBUG(DEBUG_CRIT,("Failed to setup fetch function for '%s'\n", ctdb_db->db_name));
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
|
|||||||
databases
|
databases
|
||||||
*/
|
*/
|
||||||
if (node->flags & NODE_FLAGS_INACTIVE) {
|
if (node->flags & NODE_FLAGS_INACTIVE) {
|
||||||
DEBUG(0,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
|
DEBUG(DEBUG_ERR,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
|
|||||||
|
|
||||||
db = ctdb_db_handle(ctdb, db_name);
|
db = ctdb_db_handle(ctdb, db_name);
|
||||||
if (!db) {
|
if (!db) {
|
||||||
DEBUG(0,("Failed to find db handle for name '%s'\n", db_name));
|
DEBUG(DEBUG_ERR,("Failed to find db handle for name '%s'\n", db_name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,12 +380,12 @@ int ctdb_attach_persistent(struct ctdb_context *ctdb)
|
|||||||
p[4] = 0;
|
p[4] = 0;
|
||||||
|
|
||||||
if (ctdb_local_attach(ctdb, s, true) != 0) {
|
if (ctdb_local_attach(ctdb, s, true) != 0) {
|
||||||
DEBUG(0,("Failed to attach to persistent database '%s'\n", de->d_name));
|
DEBUG(DEBUG_ERR,("Failed to attach to persistent database '%s'\n", de->d_name));
|
||||||
closedir(d);
|
closedir(d);
|
||||||
talloc_free(s);
|
talloc_free(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DEBUG(0,("Attached to persistent database %s\n", s));
|
DEBUG(DEBUG_NOTICE,("Attached to persistent database %s\n", s));
|
||||||
|
|
||||||
talloc_free(s);
|
talloc_free(s);
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ int32_t ctdb_ltdb_update_seqnum(struct ctdb_context *ctdb, uint32_t db_id, uint3
|
|||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, db_id);
|
ctdb_db = find_ctdb_db(ctdb, db_id);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0,("Unknown db_id 0x%x in ctdb_ltdb_update_seqnum\n", db_id));
|
DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_ltdb_update_seqnum\n", db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ int32_t ctdb_ltdb_enable_seqnum(struct ctdb_context *ctdb, uint32_t db_id)
|
|||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
ctdb_db = find_ctdb_db(ctdb, db_id);
|
ctdb_db = find_ctdb_db(ctdb, db_id);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0,("Unknown db_id 0x%x in ctdb_ltdb_enable_seqnum\n", db_id));
|
DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_ltdb_enable_seqnum\n", db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
|
|||||||
c.old_flags = node->flags;
|
c.old_flags = node->flags;
|
||||||
|
|
||||||
if (status != 0 && !(node->flags & NODE_FLAGS_UNHEALTHY)) {
|
if (status != 0 && !(node->flags & NODE_FLAGS_UNHEALTHY)) {
|
||||||
DEBUG(0,("monitor event failed - disabling node\n"));
|
DEBUG(DEBUG_NOTICE,("monitor event failed - disabling node\n"));
|
||||||
node->flags |= NODE_FLAGS_UNHEALTHY;
|
node->flags |= NODE_FLAGS_UNHEALTHY;
|
||||||
ctdb->monitor->next_interval = 1;
|
ctdb->monitor->next_interval = 1;
|
||||||
} else if (status == 0 && (node->flags & NODE_FLAGS_UNHEALTHY)) {
|
} else if (status == 0 && (node->flags & NODE_FLAGS_UNHEALTHY)) {
|
||||||
@ -89,9 +89,9 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
|
|||||||
static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p)
|
static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p)
|
||||||
{
|
{
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
DEBUG(0,("startup event failed\n"));
|
DEBUG(DEBUG_ERR,("startup event failed\n"));
|
||||||
} else if (status == 0) {
|
} else if (status == 0) {
|
||||||
DEBUG(0,("startup event OK - enabling monitoring\n"));
|
DEBUG(DEBUG_NOTICE,("startup event OK - enabling monitoring\n"));
|
||||||
ctdb->done_startup = true;
|
ctdb->done_startup = true;
|
||||||
ctdb->monitor->next_interval = 1;
|
ctdb->monitor->next_interval = 1;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Unable to launch monitor event script\n"));
|
DEBUG(DEBUG_ERR,("Unable to launch monitor event script\n"));
|
||||||
ctdb->monitor->next_interval = 1;
|
ctdb->monitor->next_interval = 1;
|
||||||
event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
|
event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
|
||||||
timeval_current_ofs(1, 0),
|
timeval_current_ofs(1, 0),
|
||||||
@ -170,7 +170,7 @@ void ctdb_stop_monitoring(struct ctdb_context *ctdb)
|
|||||||
|
|
||||||
ctdb->monitor->monitoring_mode = CTDB_MONITORING_DISABLED;
|
ctdb->monitor->monitoring_mode = CTDB_MONITORING_DISABLED;
|
||||||
ctdb->monitor->next_interval = 1;
|
ctdb->monitor->next_interval = 1;
|
||||||
DEBUG(0,("Monitoring has been stopped\n"));
|
DEBUG(DEBUG_NOTICE,("Monitoring has been stopped\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -198,7 +198,7 @@ void ctdb_start_monitoring(struct ctdb_context *ctdb)
|
|||||||
CTDB_NO_MEMORY_FATAL(ctdb, te);
|
CTDB_NO_MEMORY_FATAL(ctdb, te);
|
||||||
|
|
||||||
ctdb->monitor->monitoring_mode = CTDB_MONITORING_ACTIVE;
|
ctdb->monitor->monitoring_mode = CTDB_MONITORING_ACTIVE;
|
||||||
DEBUG(0,("Monitoring has been started\n"));
|
DEBUG(DEBUG_NOTICE,("Monitoring has been started\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(0, ("Control modflags on node %u - flags now 0x%x\n", ctdb->pnn, node->flags));
|
DEBUG(DEBUG_INFO, ("Control modflags on node %u - flags now 0x%x\n", ctdb->pnn, node->flags));
|
||||||
|
|
||||||
/* if we have been banned, go into recovery mode */
|
/* if we have been banned, go into recovery mode */
|
||||||
c.pnn = ctdb->pnn;
|
c.pnn = ctdb->pnn;
|
||||||
@ -237,7 +237,7 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
|
|
||||||
if ((node->flags & NODE_FLAGS_BANNED) && !(old_flags & NODE_FLAGS_BANNED)) {
|
if ((node->flags & NODE_FLAGS_BANNED) && !(old_flags & NODE_FLAGS_BANNED)) {
|
||||||
/* make sure we are frozen */
|
/* make sure we are frozen */
|
||||||
DEBUG(0,("This node has been banned - forcing freeze and recovery\n"));
|
DEBUG(DEBUG_NOTICE,("This node has been banned - forcing freeze and recovery\n"));
|
||||||
/* Reset the generation id to 1 to make us ignore any
|
/* Reset the generation id to 1 to make us ignore any
|
||||||
REQ/REPLY CALL/DMASTER someone sends to us.
|
REQ/REPLY CALL/DMASTER someone sends to us.
|
||||||
We are now banned so we shouldnt service database calls
|
We are now banned so we shouldnt service database calls
|
||||||
|
@ -46,7 +46,7 @@ static void ctdb_persistent_callback(struct ctdb_context *ctdb,
|
|||||||
struct ctdb_persistent_state);
|
struct ctdb_persistent_state);
|
||||||
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
DEBUG(0,("ctdb_persistent_callback failed with status %d (%s)\n",
|
DEBUG(DEBUG_ERR,("ctdb_persistent_callback failed with status %d (%s)\n",
|
||||||
status, errormsg));
|
status, errormsg));
|
||||||
state->status = status;
|
state->status = status;
|
||||||
state->errormsg = errormsg;
|
state->errormsg = errormsg;
|
||||||
@ -108,7 +108,7 @@ int32_t ctdb_control_persistent_store(struct ctdb_context *ctdb,
|
|||||||
c->client_id, 0, recdata,
|
c->client_id, 0, recdata,
|
||||||
ctdb_persistent_callback, state);
|
ctdb_persistent_callback, state);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("Unable to send CTDB_CONTROL_UPDATE_RECORD to pnn %u\n", node->pnn));
|
DEBUG(DEBUG_ERR,("Unable to send CTDB_CONTROL_UPDATE_RECORD to pnn %u\n", node->pnn));
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -157,13 +157,13 @@ static int ctdb_persistent_store(struct ctdb_persistent_lock_state *state)
|
|||||||
/* fetch the old header and ensure the rsn is less than the new rsn */
|
/* fetch the old header and ensure the rsn is less than the new rsn */
|
||||||
ret = ctdb_ltdb_fetch(state->ctdb_db, state->key, &oldheader, NULL, NULL);
|
ret = ctdb_ltdb_fetch(state->ctdb_db, state->key, &oldheader, NULL, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to fetch old record for db_id 0x%08x in ctdb_persistent_store\n",
|
DEBUG(DEBUG_ERR,("Failed to fetch old record for db_id 0x%08x in ctdb_persistent_store\n",
|
||||||
state->ctdb_db->db_id));
|
state->ctdb_db->db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldheader.rsn >= state->header->rsn) {
|
if (oldheader.rsn >= state->header->rsn) {
|
||||||
DEBUG(0,("existing header for db_id 0x%08x has larger RSN %llu than new RSN %llu in ctdb_persistent_store\n",
|
DEBUG(DEBUG_CRIT,("existing header for db_id 0x%08x has larger RSN %llu than new RSN %llu in ctdb_persistent_store\n",
|
||||||
state->ctdb_db->db_id,
|
state->ctdb_db->db_id,
|
||||||
(unsigned long long)oldheader.rsn, (unsigned long long)state->header->rsn));
|
(unsigned long long)oldheader.rsn, (unsigned long long)state->header->rsn));
|
||||||
return -1;
|
return -1;
|
||||||
@ -171,7 +171,7 @@ static int ctdb_persistent_store(struct ctdb_persistent_lock_state *state)
|
|||||||
|
|
||||||
ret = ctdb_ltdb_store(state->ctdb_db, state->key, state->header, state->data);
|
ret = ctdb_ltdb_store(state->ctdb_db, state->key, state->header, state->data);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to store record for db_id 0x%08x in ctdb_persistent_store\n",
|
DEBUG(DEBUG_CRIT,("Failed to store record for db_id 0x%08x in ctdb_persistent_store\n",
|
||||||
state->ctdb_db->db_id));
|
state->ctdb_db->db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ static void ctdb_persistent_lock_callback(void *private_data)
|
|||||||
|
|
||||||
ret = tdb_chainlock_mark(state->tdb, state->key);
|
ret = tdb_chainlock_mark(state->tdb, state->key);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to mark lock in ctdb_persistent_lock_callback\n"));
|
DEBUG(DEBUG_ERR,("Failed to mark lock in ctdb_persistent_lock_callback\n"));
|
||||||
ctdb_request_control_reply(state->ctdb_db->ctdb, state->c, NULL, ret, NULL);
|
ctdb_request_control_reply(state->ctdb_db->ctdb, state->c, NULL, ret, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -231,13 +231,13 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
|
|||||||
struct ctdb_persistent_lock_state *state;
|
struct ctdb_persistent_lock_state *state;
|
||||||
|
|
||||||
if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
|
if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
|
||||||
DEBUG(0,("rejecting ctdb_control_update_record when recovery active\n"));
|
DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_update_record when recovery active\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, db_id);
|
ctdb_db = find_ctdb_db(ctdb, db_id);
|
||||||
if (ctdb_db == NULL) {
|
if (ctdb_db == NULL) {
|
||||||
DEBUG(0,("Unknown database 0x%08x in ctdb_control_update_record\n", db_id));
|
DEBUG(DEBUG_ERR,("Unknown database 0x%08x in ctdb_control_update_record\n", db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
|
|||||||
state->data.dsize = rec->datalen;
|
state->data.dsize = rec->datalen;
|
||||||
|
|
||||||
if (state->data.dsize < sizeof(struct ctdb_ltdb_header)) {
|
if (state->data.dsize < sizeof(struct ctdb_ltdb_header)) {
|
||||||
DEBUG(0,("Invalid data size %u in ctdb_control_update_record\n",
|
DEBUG(DEBUG_CRIT,("Invalid data size %u in ctdb_control_update_record\n",
|
||||||
(unsigned)state->data.dsize));
|
(unsigned)state->data.dsize));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
|
|||||||
/* wait until we have a lock on this record */
|
/* wait until we have a lock on this record */
|
||||||
handle = ctdb_lockwait(ctdb_db, state->key, ctdb_persistent_lock_callback, state);
|
handle = ctdb_lockwait(ctdb_db, state->key, ctdb_persistent_lock_callback, state);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
DEBUG(0,("Failed to setup lockwait handler in ctdb_control_update_record\n"));
|
DEBUG(DEBUG_ERR,("Failed to setup lockwait handler in ctdb_control_update_record\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ static int ctdb_lock_all_databases_mark(struct ctdb_context *ctdb)
|
|||||||
{
|
{
|
||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("Attempt to mark all databases locked when not frozen\n"));
|
DEBUG(DEBUG_ERR,("Attempt to mark all databases locked when not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
||||||
@ -53,7 +53,7 @@ static int ctdb_lock_all_databases_unmark(struct ctdb_context *ctdb)
|
|||||||
{
|
{
|
||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("Attempt to unmark all databases locked when not frozen\n"));
|
DEBUG(DEBUG_ERR,("Attempt to unmark all databases locked when not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
|
||||||
@ -92,7 +92,7 @@ ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA inda
|
|||||||
struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr;
|
struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr;
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("Attempt to set vnnmap when not frozen\n"));
|
DEBUG(DEBUG_ERR,("Attempt to set vnnmap when not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ ctdb_control_getdbmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indat
|
|||||||
outdata->dsize = offsetof(struct ctdb_dbid_map, dbs) + sizeof(dbid_map->dbs[0])*len;
|
outdata->dsize = offsetof(struct ctdb_dbid_map, dbs) + sizeof(dbid_map->dbs[0])*len;
|
||||||
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
|
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
|
||||||
if (!outdata->dptr) {
|
if (!outdata->dptr) {
|
||||||
DEBUG(0, (__location__ " Failed to allocate dbmap array\n"));
|
DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate dbmap array\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
|
|||||||
outdata->dsize = offsetof(struct ctdb_node_map, nodes) + num_nodes*sizeof(struct ctdb_node_and_flags);
|
outdata->dsize = offsetof(struct ctdb_node_map, nodes) + num_nodes*sizeof(struct ctdb_node_and_flags);
|
||||||
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
|
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
|
||||||
if (!outdata->dptr) {
|
if (!outdata->dptr) {
|
||||||
DEBUG(0, (__location__ " Failed to allocate nodemap array\n"));
|
DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate nodemap array\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
|
|||||||
}
|
}
|
||||||
params->pulldata = talloc_realloc_size(NULL, params->pulldata, rec->length + params->len);
|
params->pulldata = talloc_realloc_size(NULL, params->pulldata, rec->length + params->len);
|
||||||
if (params->pulldata == NULL) {
|
if (params->pulldata == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to expand pulldb_data to %u (%u records)\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to expand pulldb_data to %u (%u records)\n",
|
||||||
rec->length + params->len, params->pulldata->count));
|
rec->length + params->len, params->pulldata->count));
|
||||||
params->failed = true;
|
params->failed = true;
|
||||||
return -1;
|
return -1;
|
||||||
@ -218,7 +218,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
|
|||||||
struct ctdb_control_pulldb_reply *reply;
|
struct ctdb_control_pulldb_reply *reply;
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("rejecting ctdb_control_pull_db when not frozen\n"));
|
DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_pull_db when not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
|
|||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, pull->db_id);
|
ctdb_db = find_ctdb_db(ctdb, pull->db_id);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0,(__location__ " Unknown db 0x%08x\n", pull->db_id));
|
DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", pull->db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,12 +241,12 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
|
|||||||
params.failed = false;
|
params.failed = false;
|
||||||
|
|
||||||
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
|
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdb_traverse_read(ctdb_db->ltdb->tdb, traverse_pulldb, ¶ms) == -1) {
|
if (tdb_traverse_read(ctdb_db->ltdb->tdb, traverse_pulldb, ¶ms) == -1) {
|
||||||
DEBUG(0,(__location__ " Failed to get traverse db '%s'\n", ctdb_db->db_name));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get traverse db '%s'\n", ctdb_db->db_name));
|
||||||
ctdb_lock_all_databases_unmark(ctdb);
|
ctdb_lock_all_databases_unmark(ctdb);
|
||||||
talloc_free(params.pulldata);
|
talloc_free(params.pulldata);
|
||||||
return -1;
|
return -1;
|
||||||
@ -271,23 +271,23 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
struct ctdb_rec_data *rec;
|
struct ctdb_rec_data *rec;
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("rejecting ctdb_control_push_db when not frozen\n"));
|
DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_push_db when not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
|
if (indata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
|
||||||
DEBUG(0,(__location__ " invalid data in pulldb reply\n"));
|
DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, reply->db_id);
|
ctdb_db = find_ctdb_db(ctdb, reply->db_id);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0,(__location__ " Unknown db 0x%08x\n", reply->db_id));
|
DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", reply->db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
|
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
data.dsize = rec->datalen;
|
data.dsize = rec->datalen;
|
||||||
|
|
||||||
if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
|
if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
|
||||||
DEBUG(0,(__location__ " bad ltdb record\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " bad ltdb record\n"));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
hdr = (struct ctdb_ltdb_header *)data.dptr;
|
hdr = (struct ctdb_ltdb_header *)data.dptr;
|
||||||
@ -315,7 +315,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
|
|
||||||
ret = ctdb_ltdb_store(ctdb_db, key, hdr, data);
|
ret = ctdb_ltdb_store(ctdb_db, key, hdr, data);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, (__location__ " Unable to store record\n"));
|
DEBUG(DEBUG_CRIT, (__location__ " Unable to store record\n"));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ static int traverse_setdmaster(struct tdb_context *tdb, TDB_DATA key, TDB_DATA d
|
|||||||
|
|
||||||
ret = tdb_store(tdb, key, data, TDB_REPLACE);
|
ret = tdb_store(tdb, key, data, TDB_REPLACE);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DEBUG(0,(__location__ " failed to write tdb data back ret:%d\n",ret));
|
DEBUG(DEBUG_CRIT,(__location__ " failed to write tdb data back ret:%d\n",ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,18 +364,18 @@ int32_t ctdb_control_set_dmaster(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("rejecting ctdb_control_set_dmaster when not frozen\n"));
|
DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_set_dmaster when not frozen\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, p->db_id);
|
ctdb_db = find_ctdb_db(ctdb, p->db_id);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0,(__location__ " Unknown db 0x%08x\n", p->db_id));
|
DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", p->db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
|
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,14 +473,14 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
|
|||||||
pid_t parent = getpid();
|
pid_t parent = getpid();
|
||||||
|
|
||||||
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
|
||||||
DEBUG(0,("Attempt to change recovery mode to %u when not frozen\n",
|
DEBUG(DEBUG_ERR,("Attempt to change recovery mode to %u when not frozen\n",
|
||||||
recmode));
|
recmode));
|
||||||
(*errormsg) = "Cannot change recovery mode while not frozen";
|
(*errormsg) = "Cannot change recovery mode while not frozen";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recmode != ctdb->recovery_mode) {
|
if (recmode != ctdb->recovery_mode) {
|
||||||
DEBUG(0,(__location__ " Recovery mode set to %s\n",
|
DEBUG(DEBUG_NOTICE,(__location__ " Recovery mode set to %s\n",
|
||||||
recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"ACTIVE"));
|
recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"ACTIVE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +503,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
|
|||||||
ret = pipe(state->fd);
|
ret = pipe(state->fd);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
DEBUG(0,(__location__ " Failed to open pipe for set_recmode child\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " Failed to open pipe for set_recmode child\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +523,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
|
|||||||
as it should be held by the recovery master
|
as it should be held by the recovery master
|
||||||
*/
|
*/
|
||||||
if (ctdb_recovery_lock(ctdb, false)) {
|
if (ctdb_recovery_lock(ctdb, false)) {
|
||||||
DEBUG(0,("ERROR: recovery lock file %s not locked when recovering!\n", ctdb->recovery_lock_file));
|
DEBUG(DEBUG_CRIT,("ERROR: recovery lock file %s not locked when recovering!\n", ctdb->recovery_lock_file));
|
||||||
cc = 1;
|
cc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
|
|||||||
}
|
}
|
||||||
ctdb->recovery_lock_fd = open(ctdb->recovery_lock_file, O_RDWR|O_CREAT, 0600);
|
ctdb->recovery_lock_fd = open(ctdb->recovery_lock_file, O_RDWR|O_CREAT, 0600);
|
||||||
if (ctdb->recovery_lock_fd == -1) {
|
if (ctdb->recovery_lock_fd == -1) {
|
||||||
DEBUG(0,("ctdb_recovery_lock: Unable to open %s - (%s)\n",
|
DEBUG(DEBUG_ERR,("ctdb_recovery_lock: Unable to open %s - (%s)\n",
|
||||||
ctdb->recovery_lock_file, strerror(errno)));
|
ctdb->recovery_lock_file, strerror(errno)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -590,7 +590,7 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
|
|||||||
close(ctdb->recovery_lock_fd);
|
close(ctdb->recovery_lock_fd);
|
||||||
ctdb->recovery_lock_fd = -1;
|
ctdb->recovery_lock_fd = -1;
|
||||||
if (keep) {
|
if (keep) {
|
||||||
DEBUG(0,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
|
DEBUG(DEBUG_CRIT,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -600,7 +600,7 @@ bool ctdb_recovery_lock(struct ctdb_context *ctdb, bool keep)
|
|||||||
ctdb->recovery_lock_fd = -1;
|
ctdb->recovery_lock_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(0,("ctdb_recovery_lock: Got recovery lock on '%s'\n", ctdb->recovery_lock_file));
|
DEBUG(DEBUG_NOTICE,("ctdb_recovery_lock: Got recovery lock on '%s'\n", ctdb->recovery_lock_file));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -624,13 +624,13 @@ int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
|
int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
|
||||||
|
|
||||||
if (indata.dsize < sizeof(uint32_t) || indata.dsize != rec->length) {
|
if (indata.dsize < sizeof(uint32_t) || indata.dsize != rec->length) {
|
||||||
DEBUG(0,(__location__ " Bad record size in ctdb_control_delete_record\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Bad record size in ctdb_control_delete_record\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_db = find_ctdb_db(ctdb, rec->reqid);
|
ctdb_db = find_ctdb_db(ctdb, rec->reqid);
|
||||||
if (!ctdb_db) {
|
if (!ctdb_db) {
|
||||||
DEBUG(0,(__location__ " Unknown db 0x%08x\n", rec->reqid));
|
DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", rec->reqid));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,7 +645,7 @@ int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.dsize != sizeof(struct ctdb_ltdb_header)) {
|
if (data.dsize != sizeof(struct ctdb_ltdb_header)) {
|
||||||
DEBUG(0,(__location__ " Bad record size\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Bad record size\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,7 +666,7 @@ int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
if (tdb_lock_nonblock(ctdb_db->ltdb->tdb, -1, F_WRLCK) == 0) {
|
if (tdb_lock_nonblock(ctdb_db->ltdb->tdb, -1, F_WRLCK) == 0) {
|
||||||
tdb_delete(ctdb_db->ltdb->tdb, key);
|
tdb_delete(ctdb_db->ltdb->tdb, key);
|
||||||
tdb_unlock(ctdb_db->ltdb->tdb, -1, F_WRLCK);
|
tdb_unlock(ctdb_db->ltdb->tdb, -1, F_WRLCK);
|
||||||
DEBUG(0,(__location__ " Deleted corrupt record\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " Deleted corrupt record\n"));
|
||||||
}
|
}
|
||||||
tdb_chainunlock(ctdb_db->ltdb->tdb, key);
|
tdb_chainunlock(ctdb_db->ltdb->tdb, key);
|
||||||
free(data.dptr);
|
free(data.dptr);
|
||||||
@ -726,7 +726,7 @@ static void ctdb_end_recovery_callback(struct ctdb_context *ctdb, int status, vo
|
|||||||
ctdb_enable_monitoring(ctdb);
|
ctdb_enable_monitoring(ctdb);
|
||||||
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
DEBUG(0,(__location__ " recovered event script failed (status %d)\n", status));
|
DEBUG(DEBUG_ERR,(__location__ " recovered event script failed (status %d)\n", status));
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
|
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
|
||||||
@ -745,7 +745,7 @@ int32_t ctdb_control_end_recovery(struct ctdb_context *ctdb,
|
|||||||
int ret;
|
int ret;
|
||||||
struct recovery_callback_state *state;
|
struct recovery_callback_state *state;
|
||||||
|
|
||||||
DEBUG(0,("Recovery has finished\n"));
|
DEBUG(DEBUG_NOTICE,("Recovery has finished\n"));
|
||||||
|
|
||||||
state = talloc(ctdb, struct recovery_callback_state);
|
state = talloc(ctdb, struct recovery_callback_state);
|
||||||
CTDB_NO_MEMORY(ctdb, state);
|
CTDB_NO_MEMORY(ctdb, state);
|
||||||
@ -763,7 +763,7 @@ int32_t ctdb_control_end_recovery(struct ctdb_context *ctdb,
|
|||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ctdb_enable_monitoring(ctdb);
|
ctdb_enable_monitoring(ctdb);
|
||||||
|
|
||||||
DEBUG(0,(__location__ " Failed to end recovery\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to end recovery\n"));
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -783,7 +783,7 @@ static void ctdb_start_recovery_callback(struct ctdb_context *ctdb, int status,
|
|||||||
ctdb_enable_monitoring(ctdb);
|
ctdb_enable_monitoring(ctdb);
|
||||||
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
DEBUG(0,(__location__ " startrecovery event script failed (status %d)\n", status));
|
DEBUG(DEBUG_ERR,(__location__ " startrecovery event script failed (status %d)\n", status));
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
|
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
|
||||||
@ -800,7 +800,7 @@ int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
|
|||||||
int ret;
|
int ret;
|
||||||
struct recovery_callback_state *state;
|
struct recovery_callback_state *state;
|
||||||
|
|
||||||
DEBUG(0,("Recovery has started\n"));
|
DEBUG(DEBUG_NOTICE,("Recovery has started\n"));
|
||||||
|
|
||||||
state = talloc(ctdb, struct recovery_callback_state);
|
state = talloc(ctdb, struct recovery_callback_state);
|
||||||
CTDB_NO_MEMORY(ctdb, state);
|
CTDB_NO_MEMORY(ctdb, state);
|
||||||
@ -818,7 +818,7 @@ int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
|
|||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ctdb_enable_monitoring(ctdb);
|
ctdb_enable_monitoring(ctdb);
|
||||||
|
|
||||||
DEBUG(0,(__location__ " Failed to start recovery\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to start recovery\n"));
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -230,7 +230,7 @@ void ctdb_input_pkt(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
case CTDB_REPLY_DMASTER:
|
case CTDB_REPLY_DMASTER:
|
||||||
/* we dont allow these calls when banned */
|
/* we dont allow these calls when banned */
|
||||||
if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_BANNED) {
|
if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_BANNED) {
|
||||||
DEBUG(0,(__location__ " ctdb operation %u"
|
DEBUG(DEBUG_DEBUG,(__location__ " ctdb operation %u"
|
||||||
" request %u"
|
" request %u"
|
||||||
" length %u from node %u to %u while node"
|
" length %u from node %u to %u while node"
|
||||||
" is banned\n",
|
" is banned\n",
|
||||||
@ -245,7 +245,7 @@ void ctdb_input_pkt(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
same generation instance as this node
|
same generation instance as this node
|
||||||
*/
|
*/
|
||||||
if (ctdb->vnn_map->generation != hdr->generation) {
|
if (ctdb->vnn_map->generation != hdr->generation) {
|
||||||
DEBUG(0,(__location__ " ctdb operation %u"
|
DEBUG(DEBUG_DEBUG,(__location__ " ctdb operation %u"
|
||||||
" request %u"
|
" request %u"
|
||||||
" length %u from node %u to %u had an"
|
" length %u from node %u to %u had an"
|
||||||
" invalid generation id:%u while our"
|
" invalid generation id:%u while our"
|
||||||
@ -304,7 +304,7 @@ void ctdb_input_pkt(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG(0,("%s: Packet with unknown operation %u\n",
|
DEBUG(DEBUG_CRIT,("%s: Packet with unknown operation %u\n",
|
||||||
__location__, hdr->operation));
|
__location__, hdr->operation));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -330,7 +330,7 @@ void ctdb_node_dead(struct ctdb_node *node)
|
|||||||
node->rx_cnt = 0;
|
node->rx_cnt = 0;
|
||||||
node->dead_count = 0;
|
node->dead_count = 0;
|
||||||
|
|
||||||
DEBUG(0,("%s: node %s is dead: %u connected\n",
|
DEBUG(DEBUG_NOTICE,("%s: node %s is dead: %u connected\n",
|
||||||
node->ctdb->name, node->name, node->ctdb->num_connected));
|
node->ctdb->name, node->name, node->ctdb->num_connected));
|
||||||
ctdb_daemon_cancel_controls(node->ctdb, node);
|
ctdb_daemon_cancel_controls(node->ctdb, node);
|
||||||
|
|
||||||
@ -382,13 +382,13 @@ static void ctdb_defer_packet(struct ctdb_context *ctdb, struct ctdb_req_header
|
|||||||
struct queue_next *q;
|
struct queue_next *q;
|
||||||
q = talloc(ctdb, struct queue_next);
|
q = talloc(ctdb, struct queue_next);
|
||||||
if (q == NULL) {
|
if (q == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to allocate deferred packet\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to allocate deferred packet\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
q->ctdb = ctdb;
|
q->ctdb = ctdb;
|
||||||
q->hdr = talloc_memdup(ctdb, hdr, hdr->length);
|
q->hdr = talloc_memdup(ctdb, hdr, hdr->length);
|
||||||
if (q->hdr == NULL) {
|
if (q->hdr == NULL) {
|
||||||
DEBUG(0,("Error copying deferred packet to self\n"));
|
DEBUG(DEBUG_ERR,("Error copying deferred packet to self\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
@ -463,7 +463,7 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
|||||||
ctdb->statistics.node_packets_sent++;
|
ctdb->statistics.node_packets_sent++;
|
||||||
|
|
||||||
if (!ctdb_validate_pnn(ctdb, hdr->destnode)) {
|
if (!ctdb_validate_pnn(ctdb, hdr->destnode)) {
|
||||||
DEBUG(0,(__location__ " cant send to node %u that does not exist\n",
|
DEBUG(DEBUG_CRIT,(__location__ " cant send to node %u that does not exist\n",
|
||||||
hdr->destnode));
|
hdr->destnode));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ int32_t ctdb_control_register_server_id(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
|
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
DEBUG(0,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ static void server_id_count(void *param, void *data)
|
|||||||
struct count_server_ids);
|
struct count_server_ids);
|
||||||
|
|
||||||
if (svid == NULL) {
|
if (svid == NULL) {
|
||||||
DEBUG(0, (__location__ " Got null pointer for svid\n"));
|
DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,12 +140,12 @@ static void server_id_store(void *param, void *data)
|
|||||||
struct ctdb_server_id);
|
struct ctdb_server_id);
|
||||||
|
|
||||||
if (svid == NULL) {
|
if (svid == NULL) {
|
||||||
DEBUG(0, (__location__ " Got null pointer for svid\n"));
|
DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (svid->count >= svid->list->num) {
|
if (svid->count >= svid->list->num) {
|
||||||
DEBUG(0, (__location__ " size of server id tree changed during traverse\n"));
|
DEBUG(DEBUG_ERR, (__location__ " size of server id tree changed during traverse\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,12 +75,12 @@ static void ctdb_control_send_arp(struct event_context *ev, struct timed_event *
|
|||||||
|
|
||||||
ret = ctdb_sys_send_arp(&arp->sin, arp->vnn->iface);
|
ret = ctdb_sys_send_arp(&arp->sin, arp->vnn->iface);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " sending of arp failed (%s)\n", strerror(errno)));
|
DEBUG(DEBUG_CRIT,(__location__ " sending of arp failed (%s)\n", strerror(errno)));
|
||||||
}
|
}
|
||||||
|
|
||||||
s = ctdb_sys_open_sending_socket();
|
s = ctdb_sys_open_sending_socket();
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
DEBUG(0,(__location__ " failed to open raw socket for sending tickles\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket for sending tickles\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ static void ctdb_control_send_arp(struct event_context *ev, struct timed_event *
|
|||||||
ret = ctdb_sys_send_tcp(s, &tcparray->connections[i].saddr,
|
ret = ctdb_sys_send_tcp(s, &tcparray->connections[i].saddr,
|
||||||
&tcparray->connections[i].daddr, 0, 0, 0);
|
&tcparray->connections[i].daddr, 0, 0, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to send tcp tickle ack for %s\n",
|
DEBUG(DEBUG_CRIT,(__location__ " Failed to send tcp tickle ack for %s\n",
|
||||||
inet_ntoa(tcparray->connections[i].saddr.sin_addr)));
|
inet_ntoa(tcparray->connections[i].saddr.sin_addr)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ static void takeover_ip_callback(struct ctdb_context *ctdb, int status,
|
|||||||
ctdb_enable_monitoring(ctdb);
|
ctdb_enable_monitoring(ctdb);
|
||||||
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to takeover IP %s on interface %s\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
|
||||||
ip, state->vnn->iface));
|
ip, state->vnn->iface));
|
||||||
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
|
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
@ -213,7 +213,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
|
|||||||
/* update out vnn list */
|
/* update out vnn list */
|
||||||
vnn = find_public_ip_vnn(ctdb, pip->sin);
|
vnn = find_public_ip_vnn(ctdb, pip->sin);
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
DEBUG(0,("takeoverip called for an ip '%s' that is not a public address\n",
|
DEBUG(DEBUG_ERR,("takeoverip called for an ip '%s' that is not a public address\n",
|
||||||
inet_ntoa(pip->sin.sin_addr)));
|
inet_ntoa(pip->sin.sin_addr)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
state->vnn = vnn;
|
state->vnn = vnn;
|
||||||
|
|
||||||
DEBUG(0,("Takeover of IP %s/%u on interface %s\n",
|
DEBUG(DEBUG_NOTICE,("Takeover of IP %s/%u on interface %s\n",
|
||||||
inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits,
|
inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits,
|
||||||
vnn->iface));
|
vnn->iface));
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ctdb_enable_monitoring(ctdb);
|
ctdb_enable_monitoring(ctdb);
|
||||||
DEBUG(0,(__location__ " Failed to takeover IP %s on interface %s\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
|
||||||
inet_ntoa(pip->sin.sin_addr), vnn->iface));
|
inet_ntoa(pip->sin.sin_addr), vnn->iface));
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
return -1;
|
return -1;
|
||||||
@ -281,7 +281,7 @@ static void release_kill_clients(struct ctdb_context *ctdb, struct sockaddr_in i
|
|||||||
DEBUG(DEBUG_INFO,("matched client %u with IP %s and pid %u\n",
|
DEBUG(DEBUG_INFO,("matched client %u with IP %s and pid %u\n",
|
||||||
ip->client_id, inet_ntoa(ip->ip.sin_addr), client->pid));
|
ip->client_id, inet_ntoa(ip->ip.sin_addr), client->pid));
|
||||||
if (client->pid != 0) {
|
if (client->pid != 0) {
|
||||||
DEBUG(0,(__location__ " Killing client pid %u for IP %s on client_id %u\n",
|
DEBUG(DEBUG_INFO,(__location__ " Killing client pid %u for IP %s on client_id %u\n",
|
||||||
(unsigned)client->pid, inet_ntoa(in.sin_addr),
|
(unsigned)client->pid, inet_ntoa(in.sin_addr),
|
||||||
ip->client_id));
|
ip->client_id));
|
||||||
kill(client->pid, SIGKILL);
|
kill(client->pid, SIGKILL);
|
||||||
@ -335,7 +335,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
|
|||||||
/* update our vnn list */
|
/* update our vnn list */
|
||||||
vnn = find_public_ip_vnn(ctdb, pip->sin);
|
vnn = find_public_ip_vnn(ctdb, pip->sin);
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
DEBUG(0,("releaseip called for an ip '%s' that is not a public address\n",
|
DEBUG(DEBUG_ERR,("releaseip called for an ip '%s' that is not a public address\n",
|
||||||
inet_ntoa(pip->sin.sin_addr)));
|
inet_ntoa(pip->sin.sin_addr)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(0,("Release of IP %s/%u on interface %s\n",
|
DEBUG(DEBUG_NOTICE,("Release of IP %s/%u on interface %s\n",
|
||||||
inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits,
|
inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits,
|
||||||
vnn->iface));
|
vnn->iface));
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
|
|||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ctdb_enable_monitoring(ctdb);
|
ctdb_enable_monitoring(ctdb);
|
||||||
|
|
||||||
DEBUG(0,(__location__ " Failed to release IP %s on interface %s\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to release IP %s on interface %s\n",
|
||||||
inet_ntoa(pip->sin.sin_addr), vnn->iface));
|
inet_ntoa(pip->sin.sin_addr), vnn->iface));
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
return -1;
|
return -1;
|
||||||
@ -398,7 +398,7 @@ static int add_public_address(struct ctdb_context *ctdb, struct sockaddr_in addr
|
|||||||
/* Verify that we dont have an entry for this ip yet */
|
/* Verify that we dont have an entry for this ip yet */
|
||||||
for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
|
for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
|
||||||
if (ctdb_same_sockaddr(&addr, &vnn->public_address)) {
|
if (ctdb_same_sockaddr(&addr, &vnn->public_address)) {
|
||||||
DEBUG(0,("Same ip '%s' specified multiple times in the public address list \n",
|
DEBUG(DEBUG_CRIT,("Same ip '%s' specified multiple times in the public address list \n",
|
||||||
inet_ntoa(addr.sin_addr)));
|
inet_ntoa(addr.sin_addr)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -454,14 +454,14 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist)
|
|||||||
|
|
||||||
tok = strtok(lines[i], " \t");
|
tok = strtok(lines[i], " \t");
|
||||||
if (!tok || !parse_ip_mask(tok, &addr, &mask)) {
|
if (!tok || !parse_ip_mask(tok, &addr, &mask)) {
|
||||||
DEBUG(0,("Badly formed line %u in public address list\n", i+1));
|
DEBUG(DEBUG_CRIT,("Badly formed line %u in public address list\n", i+1));
|
||||||
talloc_free(lines);
|
talloc_free(lines);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tok = strtok(NULL, " \t");
|
tok = strtok(NULL, " \t");
|
||||||
if (tok == NULL) {
|
if (tok == NULL) {
|
||||||
if (NULL == ctdb->default_public_interface) {
|
if (NULL == ctdb->default_public_interface) {
|
||||||
DEBUG(0,("No default public interface and no interface specified at line %u of public address list\n",
|
DEBUG(DEBUG_CRIT,("No default public interface and no interface specified at line %u of public address list\n",
|
||||||
i+1));
|
i+1));
|
||||||
talloc_free(lines);
|
talloc_free(lines);
|
||||||
return -1;
|
return -1;
|
||||||
@ -472,7 +472,7 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (add_public_address(ctdb, addr, mask, iface)) {
|
if (add_public_address(ctdb, addr, mask, iface)) {
|
||||||
DEBUG(0,("Failed to add line %u to the public address list\n", i+1));
|
DEBUG(DEBUG_CRIT,("Failed to add line %u to the public address list\n", i+1));
|
||||||
talloc_free(lines);
|
talloc_free(lines);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -576,7 +576,7 @@ static int find_takeover_node(struct ctdb_context *ctdb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pnn == -1) {
|
if (pnn == -1) {
|
||||||
DEBUG(0,(__location__ " Could not find node to take over public address '%s'\n", inet_ntoa(ip->sin.sin_addr)));
|
DEBUG(DEBUG_WARNING,(__location__ " Could not find node to take over public address '%s'\n", inet_ntoa(ip->sin.sin_addr)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,7 +687,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
|
|||||||
available/unavailable nodes.
|
available/unavailable nodes.
|
||||||
*/
|
*/
|
||||||
if (1 == ctdb->tunable.deterministic_public_ips) {
|
if (1 == ctdb->tunable.deterministic_public_ips) {
|
||||||
DEBUG(0,("Deterministic IPs enabled. Resetting all ip allocations\n"));
|
DEBUG(DEBUG_NOTICE,("Deterministic IPs enabled. Resetting all ip allocations\n"));
|
||||||
for (i=0,tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next,i++) {
|
for (i=0,tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next,i++) {
|
||||||
tmp_ip->pnn = i%nodemap->num;
|
tmp_ip->pnn = i%nodemap->num;
|
||||||
}
|
}
|
||||||
@ -718,7 +718,7 @@ try_again:
|
|||||||
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
||||||
if (tmp_ip->pnn == -1) {
|
if (tmp_ip->pnn == -1) {
|
||||||
if (find_takeover_node(ctdb, nodemap, mask, tmp_ip, all_ips)) {
|
if (find_takeover_node(ctdb, nodemap, mask, tmp_ip, all_ips)) {
|
||||||
DEBUG(0,("Failed to find node to cover ip %s\n", inet_ntoa(tmp_ip->sin.sin_addr)));
|
DEBUG(DEBUG_WARNING,("Failed to find node to cover ip %s\n", inet_ntoa(tmp_ip->sin.sin_addr)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -773,7 +773,7 @@ try_again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxnode == -1) {
|
if (maxnode == -1) {
|
||||||
DEBUG(0,(__location__ " Could not find maxnode. May not be able to serve ip '%s'\n", inet_ntoa(tmp_ip->sin.sin_addr)));
|
DEBUG(DEBUG_WARNING,(__location__ " Could not find maxnode. May not be able to serve ip '%s'\n", inet_ntoa(tmp_ip->sin.sin_addr)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ try_again:
|
|||||||
data, async_data,
|
data, async_data,
|
||||||
&timeout, NULL);
|
&timeout, NULL);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -853,7 +853,7 @@ try_again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ctdb_client_async_wait(ctdb, async_data) != 0) {
|
if (ctdb_client_async_wait(ctdb, async_data) != 0) {
|
||||||
DEBUG(0,(__location__ " Async control CTDB_CONTROL_RELEASE_IP failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Async control CTDB_CONTROL_RELEASE_IP failed\n"));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -880,7 +880,7 @@ try_again:
|
|||||||
data, async_data,
|
data, async_data,
|
||||||
&timeout, NULL);
|
&timeout, NULL);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -888,7 +888,7 @@ try_again:
|
|||||||
ctdb_client_async_add(async_data, state);
|
ctdb_client_async_add(async_data, state);
|
||||||
}
|
}
|
||||||
if (ctdb_client_async_wait(ctdb, async_data) != 0) {
|
if (ctdb_client_async_wait(ctdb, async_data) != 0) {
|
||||||
DEBUG(0,(__location__ " Async control CTDB_CONTROL_TAKEOVER_IP failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Async control CTDB_CONTROL_TAKEOVER_IP failed\n"));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -928,14 +928,14 @@ int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id,
|
|||||||
vnn = find_public_ip_vnn(ctdb, p->dest);
|
vnn = find_public_ip_vnn(ctdb, p->dest);
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
if (ntohl(p->dest.sin_addr.s_addr) != INADDR_LOOPBACK) {
|
if (ntohl(p->dest.sin_addr.s_addr) != INADDR_LOOPBACK) {
|
||||||
DEBUG(0,("Could not add client IP %s. This is not a public address.\n",
|
DEBUG(DEBUG_ERR,("Could not add client IP %s. This is not a public address.\n",
|
||||||
inet_ntoa(p->dest.sin_addr)));
|
inet_ntoa(p->dest.sin_addr)));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vnn->pnn != ctdb->pnn) {
|
if (vnn->pnn != ctdb->pnn) {
|
||||||
DEBUG(0,("Attempt to register tcp client for IP %s we don't hold - failing (client_id %u pid %u)\n",
|
DEBUG(DEBUG_ERR,("Attempt to register tcp client for IP %s we don't hold - failing (client_id %u pid %u)\n",
|
||||||
inet_ntoa(p->dest.sin_addr),
|
inet_ntoa(p->dest.sin_addr),
|
||||||
client_id, client->pid));
|
client_id, client->pid));
|
||||||
/* failing this call will tell smbd to die */
|
/* failing this call will tell smbd to die */
|
||||||
@ -975,7 +975,7 @@ int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id,
|
|||||||
CTDB_CONTROL_TCP_ADD,
|
CTDB_CONTROL_TCP_ADD,
|
||||||
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
|
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to send CTDB_CONTROL_TCP_ADD\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to send CTDB_CONTROL_TCP_ADD\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,7 +1027,7 @@ int32_t ctdb_control_tcp_add(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
|
|
||||||
vnn = find_public_ip_vnn(ctdb, p->dest);
|
vnn = find_public_ip_vnn(ctdb, p->dest);
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
DEBUG(0,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n",
|
DEBUG(DEBUG_ERR,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n",
|
||||||
inet_ntoa(p->dest.sin_addr)));
|
inet_ntoa(p->dest.sin_addr)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1096,7 +1096,7 @@ static void ctdb_remove_tcp_connection(struct ctdb_context *ctdb, struct ctdb_tc
|
|||||||
struct ctdb_vnn *vnn = find_public_ip_vnn(ctdb, conn->daddr);
|
struct ctdb_vnn *vnn = find_public_ip_vnn(ctdb, conn->daddr);
|
||||||
|
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
DEBUG(0,(__location__ " unable to find public address %s\n", inet_ntoa(conn->daddr.sin_addr)));
|
DEBUG(DEBUG_ERR,(__location__ " unable to find public address %s\n", inet_ntoa(conn->daddr.sin_addr)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1414,7 +1414,7 @@ static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
DEBUG(0,(__location__ " Could not killtcp, not a public address\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Could not killtcp, not a public address\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1460,7 +1460,7 @@ static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
|
|||||||
if (killtcp->sending_fd == -1) {
|
if (killtcp->sending_fd == -1) {
|
||||||
killtcp->sending_fd = ctdb_sys_open_sending_socket();
|
killtcp->sending_fd = ctdb_sys_open_sending_socket();
|
||||||
if (killtcp->sending_fd == -1) {
|
if (killtcp->sending_fd == -1) {
|
||||||
DEBUG(0,(__location__ " Failed to open sending socket for killtcp\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " Failed to open sending socket for killtcp\n"));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1471,7 +1471,7 @@ static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
|
|||||||
if (killtcp->capture_fd == -1) {
|
if (killtcp->capture_fd == -1) {
|
||||||
killtcp->capture_fd = ctdb_sys_open_capture_socket(vnn->iface, &killtcp->private_data);
|
killtcp->capture_fd = ctdb_sys_open_capture_socket(vnn->iface, &killtcp->private_data);
|
||||||
if (killtcp->capture_fd == -1) {
|
if (killtcp->capture_fd == -1) {
|
||||||
DEBUG(0,(__location__ " Failed to open capturing socket for killtcp\n"));
|
DEBUG(DEBUG_CRIT,(__location__ " Failed to open capturing socket for killtcp\n"));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1527,7 +1527,7 @@ int32_t ctdb_control_set_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
|
|||||||
*/
|
*/
|
||||||
if (indata.dsize < offsetof(struct ctdb_control_tcp_tickle_list,
|
if (indata.dsize < offsetof(struct ctdb_control_tcp_tickle_list,
|
||||||
tickles.connections)) {
|
tickles.connections)) {
|
||||||
DEBUG(0,("Bad indata in ctdb_control_set_tcp_tickle_list. Not enough data for the tickle.num field\n"));
|
DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tcp_tickle_list. Not enough data for the tickle.num field\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1536,13 +1536,13 @@ int32_t ctdb_control_set_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
|
|||||||
tickles.connections)
|
tickles.connections)
|
||||||
+ sizeof(struct ctdb_tcp_connection)
|
+ sizeof(struct ctdb_tcp_connection)
|
||||||
* list->tickles.num) {
|
* list->tickles.num) {
|
||||||
DEBUG(0,("Bad indata in ctdb_control_set_tcp_tickle_list\n"));
|
DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tcp_tickle_list\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vnn = find_public_ip_vnn(ctdb, list->ip);
|
vnn = find_public_ip_vnn(ctdb, list->ip);
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
DEBUG(0,(__location__ " Could not set tcp tickle list, '%s' is not a public address\n",
|
DEBUG(DEBUG_ERR,(__location__ " Could not set tcp tickle list, '%s' is not a public address\n",
|
||||||
inet_ntoa(list->ip.sin_addr)));
|
inet_ntoa(list->ip.sin_addr)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1582,7 +1582,7 @@ int32_t ctdb_control_get_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
|
|||||||
|
|
||||||
vnn = find_public_ip_vnn(ctdb, *ip);
|
vnn = find_public_ip_vnn(ctdb, *ip);
|
||||||
if (vnn == NULL) {
|
if (vnn == NULL) {
|
||||||
DEBUG(0,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n",
|
DEBUG(DEBUG_ERR,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n",
|
||||||
inet_ntoa(ip->sin_addr)));
|
inet_ntoa(ip->sin_addr)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1648,7 +1648,7 @@ static int ctdb_ctrl_set_tcp_tickles(struct ctdb_context *ctdb,
|
|||||||
CTDB_CONTROL_SET_TCP_TICKLE_LIST,
|
CTDB_CONTROL_SET_TCP_TICKLE_LIST,
|
||||||
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
|
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " ctdb_control for set tcp tickles failed\n"));
|
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for set tcp tickles failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1686,7 +1686,7 @@ static void ctdb_update_tcp_tickles(struct event_context *ev,
|
|||||||
&vnn->public_address,
|
&vnn->public_address,
|
||||||
vnn->tcp_array);
|
vnn->tcp_array);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to send the tickle update for public address %s\n",
|
DEBUG(DEBUG_ERR,("Failed to send the tickle update for public address %s\n",
|
||||||
inet_ntoa(vnn->public_address.sin_addr)));
|
inet_ntoa(vnn->public_address.sin_addr)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1731,7 +1731,7 @@ static void send_gratious_arp(struct event_context *ev, struct timed_event *te,
|
|||||||
|
|
||||||
ret = ctdb_sys_send_arp(&arp->sin, arp->iface);
|
ret = ctdb_sys_send_arp(&arp->sin, arp->iface);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,(__location__ " sending of gratious arp failed (%s)\n", strerror(errno)));
|
DEBUG(DEBUG_ERR,(__location__ " sending of gratious arp failed (%s)\n", strerror(errno)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1758,14 +1758,14 @@ int32_t ctdb_control_send_gratious_arp(struct ctdb_context *ctdb, TDB_DATA indat
|
|||||||
|
|
||||||
/* verify the size of indata */
|
/* verify the size of indata */
|
||||||
if (indata.dsize < offsetof(struct ctdb_control_gratious_arp, iface)) {
|
if (indata.dsize < offsetof(struct ctdb_control_gratious_arp, iface)) {
|
||||||
DEBUG(0,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (indata.dsize !=
|
if (indata.dsize !=
|
||||||
( offsetof(struct ctdb_control_gratious_arp, iface)
|
( offsetof(struct ctdb_control_gratious_arp, iface)
|
||||||
+ gratious_arp->len ) ){
|
+ gratious_arp->len ) ){
|
||||||
|
|
||||||
DEBUG(0,(__location__ " Wrong size of indata. Was %u bytes "
|
DEBUG(DEBUG_ERR,(__location__ " Wrong size of indata. Was %u bytes "
|
||||||
"but should be %u bytes\n",
|
"but should be %u bytes\n",
|
||||||
(unsigned)indata.dsize,
|
(unsigned)indata.dsize,
|
||||||
(unsigned)(offsetof(struct ctdb_control_gratious_arp, iface)+gratious_arp->len)));
|
(unsigned)(offsetof(struct ctdb_control_gratious_arp, iface)+gratious_arp->len)));
|
||||||
|
@ -283,7 +283,7 @@ static void traverse_all_callback(void *p, TDB_DATA key, TDB_DATA data)
|
|||||||
d = ctdb_marshall_record(state, state->reqid, key, NULL, data);
|
d = ctdb_marshall_record(state, state->reqid, key, NULL, data);
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
/* darn .... */
|
/* darn .... */
|
||||||
DEBUG(0,("Out of memory in traverse_all_callback\n"));
|
DEBUG(DEBUG_ERR,("Out of memory in traverse_all_callback\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ static void traverse_all_callback(void *p, TDB_DATA key, TDB_DATA data)
|
|||||||
ret = ctdb_daemon_send_control(state->ctdb, state->srcnode, 0, CTDB_CONTROL_TRAVERSE_DATA,
|
ret = ctdb_daemon_send_control(state->ctdb, state->srcnode, 0, CTDB_CONTROL_TRAVERSE_DATA,
|
||||||
0, CTDB_CTRL_FLAG_NOREPLY, cdata, NULL, NULL);
|
0, CTDB_CTRL_FLAG_NOREPLY, cdata, NULL, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to send traverse data\n"));
|
DEBUG(DEBUG_ERR,("Failed to send traverse data\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.dsize == 0 && data.dsize == 0) {
|
if (key.dsize == 0 && data.dsize == 0) {
|
||||||
@ -314,7 +314,7 @@ int32_t ctdb_control_traverse_all(struct ctdb_context *ctdb, TDB_DATA data, TDB_
|
|||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
|
|
||||||
if (data.dsize != sizeof(struct ctdb_traverse_all)) {
|
if (data.dsize != sizeof(struct ctdb_traverse_all)) {
|
||||||
DEBUG(0,("Invalid size in ctdb_control_traverse_all\n"));
|
DEBUG(DEBUG_ERR,("Invalid size in ctdb_control_traverse_all\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ int32_t ctdb_control_traverse_data(struct ctdb_context *ctdb, TDB_DATA data, TDB
|
|||||||
void *private_data;
|
void *private_data;
|
||||||
|
|
||||||
if (data.dsize < sizeof(uint32_t) || data.dsize != d->length) {
|
if (data.dsize < sizeof(uint32_t) || data.dsize != d->length) {
|
||||||
DEBUG(0,("Bad record size in ctdb_control_traverse_data\n"));
|
DEBUG(DEBUG_ERR,("Bad record size in ctdb_control_traverse_data\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ int32_t ctdb_control_traverse_start(struct ctdb_context *ctdb, TDB_DATA data,
|
|||||||
struct ctdb_db_context *ctdb_db;
|
struct ctdb_db_context *ctdb_db;
|
||||||
|
|
||||||
if (data.dsize != sizeof(*d)) {
|
if (data.dsize != sizeof(*d)) {
|
||||||
DEBUG(0,("Bad record size in ctdb_control_traverse_start\n"));
|
DEBUG(DEBUG_ERR,("Bad record size in ctdb_control_traverse_start\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ int32_t ctdb_control_get_tunable(struct ctdb_context *ctdb, TDB_DATA indata,
|
|||||||
|
|
||||||
if (indata.dsize < sizeof(*t) ||
|
if (indata.dsize < sizeof(*t) ||
|
||||||
t->length > indata.dsize - offsetof(struct ctdb_control_get_tunable, name)) {
|
t->length > indata.dsize - offsetof(struct ctdb_control_get_tunable, name)) {
|
||||||
DEBUG(0,("Bad indata in ctdb_control_get_tunable\n"));
|
DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_get_tunable\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ int32_t ctdb_control_set_tunable(struct ctdb_context *ctdb, TDB_DATA indata)
|
|||||||
|
|
||||||
if (indata.dsize < sizeof(*t) ||
|
if (indata.dsize < sizeof(*t) ||
|
||||||
t->length > indata.dsize - offsetof(struct ctdb_control_set_tunable, name)) {
|
t->length > indata.dsize - offsetof(struct ctdb_control_set_tunable, name)) {
|
||||||
DEBUG(0,("Bad indata in ctdb_control_set_tunable\n"));
|
DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tunable\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ int main(int argc, const char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!options.recovery_lock_file) {
|
if (!options.recovery_lock_file) {
|
||||||
DEBUG(0,("You must specifiy the location of a recovery lock file with --reclock\n"));
|
DEBUG(DEBUG_ALERT,("You must specifiy the location of a recovery lock file with --reclock\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ int main(int argc, const char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(0,("Starting CTDB daemon\n"));
|
DEBUG(DEBUG_NOTICE,("Starting CTDB daemon\n"));
|
||||||
gettimeofday(&ctdb->ctdbd_start_time, NULL);
|
gettimeofday(&ctdb->ctdbd_start_time, NULL);
|
||||||
gettimeofday(&ctdb->last_recovery_time, NULL);
|
gettimeofday(&ctdb->last_recovery_time, NULL);
|
||||||
ctdb->recovery_mode = CTDB_RECOVERY_NORMAL;
|
ctdb->recovery_mode = CTDB_RECOVERY_NORMAL;
|
||||||
@ -168,13 +168,13 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file);
|
ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb)));
|
DEBUG(DEBUG_ALERT,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_set_transport(ctdb, options.transport);
|
ret = ctdb_set_transport(ctdb, options.transport);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)));
|
DEBUG(DEBUG_ALERT,("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ int main(int argc, const char *argv[])
|
|||||||
if (options.myaddress) {
|
if (options.myaddress) {
|
||||||
ret = ctdb_set_address(ctdb, options.myaddress);
|
ret = ctdb_set_address(ctdb, options.myaddress);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb)));
|
DEBUG(DEBUG_ALERT,("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ int main(int argc, const char *argv[])
|
|||||||
/* tell ctdb what nodes are available */
|
/* tell ctdb what nodes are available */
|
||||||
ret = ctdb_set_nlist(ctdb, options.nlist);
|
ret = ctdb_set_nlist(ctdb, options.nlist);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("ctdb_set_nlist failed - %s\n", ctdb_errstr(ctdb)));
|
DEBUG(DEBUG_ALERT,("ctdb_set_nlist failed - %s\n", ctdb_errstr(ctdb)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,27 +198,27 @@ int main(int argc, const char *argv[])
|
|||||||
nodes file
|
nodes file
|
||||||
*/
|
*/
|
||||||
if (options.node_ip != NULL) {
|
if (options.node_ip != NULL) {
|
||||||
DEBUG(0,("IP for this node is %s\n", options.node_ip));
|
DEBUG(DEBUG_NOTICE,("IP for this node is %s\n", options.node_ip));
|
||||||
ret = ctdb_ip_to_nodeid(ctdb, options.node_ip);
|
ret = ctdb_ip_to_nodeid(ctdb, options.node_ip);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("The specified node-ip:%s is not a valid node address. Exiting.\n", options.node_ip));
|
DEBUG(DEBUG_ALERT,("The specified node-ip:%s is not a valid node address. Exiting.\n", options.node_ip));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
ctdb->node_ip = options.node_ip;
|
ctdb->node_ip = options.node_ip;
|
||||||
DEBUG(0,("This is node %d\n", ret));
|
DEBUG(DEBUG_NOTICE,("This is node %d\n", ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.db_dir) {
|
if (options.db_dir) {
|
||||||
ret = ctdb_set_tdb_dir(ctdb, options.db_dir);
|
ret = ctdb_set_tdb_dir(ctdb, options.db_dir);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb)));
|
DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.db_dir_persistent) {
|
if (options.db_dir_persistent) {
|
||||||
ret = ctdb_set_tdb_dir_persistent(ctdb, options.db_dir_persistent);
|
ret = ctdb_set_tdb_dir_persistent(ctdb, options.db_dir_persistent);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("ctdb_set_tdb_dir_persistent failed - %s\n", ctdb_errstr(ctdb)));
|
DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir_persistent failed - %s\n", ctdb_errstr(ctdb)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ int main(int argc, const char *argv[])
|
|||||||
struct ctdb_vnn *svnn;
|
struct ctdb_vnn *svnn;
|
||||||
|
|
||||||
if (options.public_interface == NULL) {
|
if (options.public_interface == NULL) {
|
||||||
DEBUG(0,("--single_public_ip used but --public_interface is not specified. You must specify the public interface when using single public ip. Exiting\n"));
|
DEBUG(DEBUG_ALERT,("--single_public_ip used but --public_interface is not specified. You must specify the public interface when using single public ip. Exiting\n"));
|
||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
if (inet_aton(options.single_public_ip,
|
if (inet_aton(options.single_public_ip,
|
||||||
&svnn->public_address.sin_addr) == 0) {
|
&svnn->public_address.sin_addr) == 0) {
|
||||||
DEBUG(0,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
|
DEBUG(DEBUG_ALERT,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
|
||||||
exit(10);
|
exit(10);
|
||||||
}
|
}
|
||||||
svnn->public_address.sin_family = AF_INET;
|
svnn->public_address.sin_family = AF_INET;
|
||||||
@ -255,14 +255,14 @@ int main(int argc, const char *argv[])
|
|||||||
if (options.public_address_list) {
|
if (options.public_address_list) {
|
||||||
ret = ctdb_set_public_addresses(ctdb, options.public_address_list);
|
ret = ctdb_set_public_addresses(ctdb, options.public_address_list);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("Unable to setup public address list\n"));
|
DEBUG(DEBUG_ALERT,("Unable to setup public address list\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_set_event_script_dir(ctdb, options.event_script_dir);
|
ret = ctdb_set_event_script_dir(ctdb, options.event_script_dir);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0,("Unable to setup event script directory\n"));
|
DEBUG(DEBUG_ALERT,("Unable to setup event script directory\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ static struct {
|
|||||||
*/
|
*/
|
||||||
static void sigterm(int sig)
|
static void sigterm(int sig)
|
||||||
{
|
{
|
||||||
DEBUG(0,("Timed out running script '%s' after %.1f seconds\n",
|
DEBUG(DEBUG_ERR,("Timed out running script '%s' after %.1f seconds\n",
|
||||||
child_state.script_running, timeval_elapsed(&child_state.start)));
|
child_state.script_running, timeval_elapsed(&child_state.start)));
|
||||||
/* all the child processes will be running in the same process group */
|
/* all the child processes will be running in the same process group */
|
||||||
kill(-getpgrp(), SIGKILL);
|
kill(-getpgrp(), SIGKILL);
|
||||||
@ -61,7 +61,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
|
|||||||
char *script;
|
char *script;
|
||||||
|
|
||||||
if (setpgid(0,0) != 0) {
|
if (setpgid(0,0) != 0) {
|
||||||
DEBUG(0,("Failed to create process group for event scripts - %s\n",
|
DEBUG(DEBUG_ERR,("Failed to create process group for event scripts - %s\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
@ -77,7 +77,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
|
|||||||
*/
|
*/
|
||||||
if (stat(ctdb->event_script_dir, &st) != 0 &&
|
if (stat(ctdb->event_script_dir, &st) != 0 &&
|
||||||
errno == ENOENT) {
|
errno == ENOENT) {
|
||||||
DEBUG(0,("No event script directory found at '%s'\n", ctdb->event_script_dir));
|
DEBUG(DEBUG_CRIT,("No event script directory found at '%s'\n", ctdb->event_script_dir));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
|
|||||||
*/
|
*/
|
||||||
dir = opendir(ctdb->event_script_dir);
|
dir = opendir(ctdb->event_script_dir);
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
DEBUG(0,("Failed to open event script directory '%s'\n", ctdb->event_script_dir));
|
DEBUG(DEBUG_CRIT,("Failed to open event script directory '%s'\n", ctdb->event_script_dir));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -122,11 +122,11 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
|
|||||||
/* Make sure the event script is executable */
|
/* Make sure the event script is executable */
|
||||||
str = talloc_asprintf(tree, "%s/%s", ctdb->event_script_dir, de->d_name);
|
str = talloc_asprintf(tree, "%s/%s", ctdb->event_script_dir, de->d_name);
|
||||||
if (stat(str, &st) != 0) {
|
if (stat(str, &st) != 0) {
|
||||||
DEBUG(0,("Could not stat event script %s. Ignoring this event script\n", str));
|
DEBUG(DEBUG_ERR,("Could not stat event script %s. Ignoring this event script\n", str));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(st.st_mode & S_IXUSR)) {
|
if (!(st.st_mode & S_IXUSR)) {
|
||||||
DEBUG(0,("Event script %s is not executable. Ignoring this event script\n", str));
|
DEBUG(DEBUG_ERR,("Event script %s is not executable. Ignoring this event script\n", str));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
|
|||||||
/* store the event script in the tree */
|
/* store the event script in the tree */
|
||||||
script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name));
|
script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name));
|
||||||
if (script != NULL) {
|
if (script != NULL) {
|
||||||
DEBUG(0,("CONFIG ERROR: Multiple event scripts with the same prefix : '%s' and '%s'. Each event script MUST have a unique prefix\n", script, de->d_name));
|
DEBUG(DEBUG_CRIT,("CONFIG ERROR: Multiple event scripts with the same prefix : '%s' and '%s'. Each event script MUST have a unique prefix\n", script, de->d_name));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return -1;
|
return -1;
|
||||||
@ -170,7 +170,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *fmt, va_li
|
|||||||
}
|
}
|
||||||
/* return an error if the script failed */
|
/* return an error if the script failed */
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Event script %s failed with error %d\n", cmdstr, ret));
|
DEBUG(DEBUG_ERR,("Event script %s failed with error %d\n", cmdstr, ret));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
|
|||||||
void *private_data = state->private_data;
|
void *private_data = state->private_data;
|
||||||
struct ctdb_context *ctdb = state->ctdb;
|
struct ctdb_context *ctdb = state->ctdb;
|
||||||
|
|
||||||
DEBUG(0,("event script timed out\n"));
|
DEBUG(DEBUG_ERR,("event script timed out\n"));
|
||||||
talloc_free(state);
|
talloc_free(state);
|
||||||
callback(ctdb, -1, private_data);
|
callback(ctdb, -1, private_data);
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
|
|||||||
*/
|
*/
|
||||||
static int event_script_destructor(struct ctdb_event_script_state *state)
|
static int event_script_destructor(struct ctdb_event_script_state *state)
|
||||||
{
|
{
|
||||||
DEBUG(0,(__location__ " Sending SIGTERM to child pid:%d\n", state->child));
|
DEBUG(DEBUG_ERR,(__location__ " Sending SIGTERM to child pid:%d\n", state->child));
|
||||||
kill(state->child, SIGTERM);
|
kill(state->child, SIGTERM);
|
||||||
waitpid(state->child, NULL, 0);
|
waitpid(state->child, NULL, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -217,7 +217,7 @@ static void ctdb_listen_event(struct event_context *ev, struct fd_event *fde,
|
|||||||
nodeid = ctdb_ip_to_nodeid(ctdb, incoming_node);
|
nodeid = ctdb_ip_to_nodeid(ctdb, incoming_node);
|
||||||
|
|
||||||
if (nodeid == -1) {
|
if (nodeid == -1) {
|
||||||
DEBUG(0, ("Refused connection from unknown node %s\n", incoming_node));
|
DEBUG(DEBUG_WARNING, ("Refused connection from unknown node %s\n", incoming_node));
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
|
|||||||
binds if the first socket is in LISTEN state */
|
binds if the first socket is in LISTEN state */
|
||||||
lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666);
|
lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666);
|
||||||
if (lock_fd == -1) {
|
if (lock_fd == -1) {
|
||||||
DEBUG(0,("Unable to open %s\n", lock_path));
|
DEBUG(DEBUG_CRIT,("Unable to open %s\n", lock_path));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
|
|||||||
lock.l_pid = 0;
|
lock.l_pid = 0;
|
||||||
|
|
||||||
if (fcntl(lock_fd, F_SETLKW, &lock) != 0) {
|
if (fcntl(lock_fd, F_SETLKW, &lock) != 0) {
|
||||||
DEBUG(0,("Unable to lock %s\n", lock_path));
|
DEBUG(DEBUG_CRIT,("Unable to lock %s\n", lock_path));
|
||||||
close(lock_fd);
|
close(lock_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == ctdb->num_nodes) {
|
if (i == ctdb->num_nodes) {
|
||||||
DEBUG(0,("Unable to bind to any of the node addresses - giving up\n"));
|
DEBUG(DEBUG_CRIT,("Unable to bind to any of the node addresses - giving up\n"));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
ctdb->address = ctdb->nodes[i]->address;
|
ctdb->address = ctdb->nodes[i]->address;
|
||||||
|
@ -58,7 +58,7 @@ static int ctdb_tcp_initialise(struct ctdb_context *ctdb)
|
|||||||
|
|
||||||
for (i=0; i<ctdb->num_nodes; i++) {
|
for (i=0; i<ctdb->num_nodes; i++) {
|
||||||
if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) {
|
if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) {
|
||||||
DEBUG(0, ("methods->add_node failed at %d\n", i));
|
DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ static void ctdb_tcp_restart(struct ctdb_node *node)
|
|||||||
struct ctdb_tcp_node *tnode = talloc_get_type(
|
struct ctdb_tcp_node *tnode = talloc_get_type(
|
||||||
node->private_data, struct ctdb_tcp_node);
|
node->private_data, struct ctdb_tcp_node);
|
||||||
|
|
||||||
DEBUG(0,("Tearing down connection to dead node :%d\n", node->pnn));
|
DEBUG(DEBUG_NOTICE,("Tearing down connection to dead node :%d\n", node->pnn));
|
||||||
|
|
||||||
ctdb_tcp_stop_connection(node);
|
ctdb_tcp_stop_connection(node);
|
||||||
|
|
||||||
|
@ -41,31 +41,31 @@ void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cnt < sizeof(*hdr)) {
|
if (cnt < sizeof(*hdr)) {
|
||||||
DEBUG(0,(__location__ " Bad packet length %u\n", (unsigned)cnt));
|
DEBUG(DEBUG_ALERT,(__location__ " Bad packet length %u\n", (unsigned)cnt));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnt & (CTDB_TCP_ALIGNMENT-1)) {
|
if (cnt & (CTDB_TCP_ALIGNMENT-1)) {
|
||||||
DEBUG(0,(__location__ " Length 0x%x not multiple of alignment\n",
|
DEBUG(DEBUG_ALERT,(__location__ " Length 0x%x not multiple of alignment\n",
|
||||||
(unsigned)cnt));
|
(unsigned)cnt));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (cnt != hdr->length) {
|
if (cnt != hdr->length) {
|
||||||
DEBUG(0,(__location__ " Bad header length %u expected %u\n",
|
DEBUG(DEBUG_ALERT,(__location__ " Bad header length %u expected %u\n",
|
||||||
(unsigned)hdr->length, (unsigned)cnt));
|
(unsigned)hdr->length, (unsigned)cnt));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->ctdb_magic != CTDB_MAGIC) {
|
if (hdr->ctdb_magic != CTDB_MAGIC) {
|
||||||
DEBUG(0,(__location__ " Non CTDB packet 0x%x rejected\n",
|
DEBUG(DEBUG_ALERT,(__location__ " Non CTDB packet 0x%x rejected\n",
|
||||||
hdr->ctdb_magic));
|
hdr->ctdb_magic));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->ctdb_version != CTDB_VERSION) {
|
if (hdr->ctdb_version != CTDB_VERSION) {
|
||||||
DEBUG(0, (__location__ " Bad CTDB version 0x%x rejected\n",
|
DEBUG(DEBUG_ALERT, (__location__ " Bad CTDB version 0x%x rejected\n",
|
||||||
hdr->ctdb_version));
|
hdr->ctdb_version));
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ static void test_store_records(struct ctdb_context *ctdb, struct event_context *
|
|||||||
|
|
||||||
ret = ctdb_record_store(h, data);
|
ret = ctdb_record_store(h, data);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to store record\n"));
|
DEBUG(DEBUG_ERR,("Failed to store record\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
talloc_free(h);
|
talloc_free(h);
|
||||||
|
@ -51,7 +51,7 @@ static int control_process_exists(struct ctdb_context *ctdb, int argc, const cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(argv[0], "%u:%u", &pnn, &pid) != 2) {
|
if (sscanf(argv[0], "%u:%u", &pnn, &pid) != 2) {
|
||||||
DEBUG(0, ("Badly formed pnn:pid\n"));
|
DEBUG(DEBUG_ERR, ("Badly formed pnn:pid\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ static int control_statistics_all(struct ctdb_context *ctdb)
|
|||||||
offsetof(struct ctdb_statistics, __last_counter) / sizeof(uint32_t);
|
offsetof(struct ctdb_statistics, __last_counter) / sizeof(uint32_t);
|
||||||
ret = ctdb_ctrl_statistics(ctdb, nodes[i], &s1);
|
ret = ctdb_ctrl_statistics(ctdb, nodes[i], &s1);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get statistics from node %u\n", nodes[i]));
|
DEBUG(DEBUG_ERR, ("Unable to get statistics from node %u\n", nodes[i]));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (j=0;j<num_ints;j++) {
|
for (j=0;j<num_ints;j++) {
|
||||||
@ -187,7 +187,7 @@ static int control_statistics(struct ctdb_context *ctdb, int argc, const char **
|
|||||||
|
|
||||||
ret = ctdb_ctrl_statistics(ctdb, options.pnn, &statistics);
|
ret = ctdb_ctrl_statistics(ctdb, options.pnn, &statistics);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get statistics from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get statistics from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
show_statistics(&statistics);
|
show_statistics(&statistics);
|
||||||
@ -204,7 +204,7 @@ static int control_statistics_reset(struct ctdb_context *ctdb, int argc, const c
|
|||||||
|
|
||||||
ret = ctdb_statistics_reset(ctdb, options.pnn);
|
ret = ctdb_statistics_reset(ctdb, options.pnn);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to reset statistics on node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to reset statistics on node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -228,7 +228,7 @@ static int control_uptime(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_uptime(ctdb, ctdb, TIMELIMIT(), options.pnn, &uptime);
|
ret = ctdb_ctrl_uptime(ctdb, ctdb, TIMELIMIT(), options.pnn, &uptime);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get uptime from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get uptime from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap);
|
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get nodemap from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get nodemap from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &vnnmap);
|
ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &vnnmap);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get vnnmap from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get vnnmap from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (vnnmap->generation == INVALID_GENERATION) {
|
if (vnnmap->generation == INVALID_GENERATION) {
|
||||||
@ -344,14 +344,14 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmode);
|
ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmode);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get recmode from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get recmode from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
|
printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
|
||||||
|
|
||||||
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
|
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get recmaster from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
printf("Recovery master:%d\n",recmaster);
|
printf("Recovery master:%d\n",recmaster);
|
||||||
@ -374,13 +374,13 @@ static int control_get_tickles(struct ctdb_context *ctdb, int argc, const char *
|
|||||||
|
|
||||||
ip.sin_family = AF_INET;
|
ip.sin_family = AF_INET;
|
||||||
if (inet_aton(argv[0], &ip.sin_addr) == 0) {
|
if (inet_aton(argv[0], &ip.sin_addr) == 0) {
|
||||||
DEBUG(0,("Wrongly formed ip address '%s'\n", argv[0]));
|
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.pnn, ctdb, &ip, &list);
|
ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.pnn, ctdb, &ip, &list);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0, ("Unable to list tickles\n"));
|
DEBUG(DEBUG_ERR, ("Unable to list tickles\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,18 +409,18 @@ static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!parse_ip_port(argv[0], &killtcp.src)) {
|
if (!parse_ip_port(argv[0], &killtcp.src)) {
|
||||||
DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
|
DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[0]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parse_ip_port(argv[1], &killtcp.dst)) {
|
if (!parse_ip_port(argv[1], &killtcp.dst)) {
|
||||||
DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
|
DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[1]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.pnn, &killtcp);
|
ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.pnn, &killtcp);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to killtcp from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to killtcp from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,13 +442,13 @@ static int control_gratious_arp(struct ctdb_context *ctdb, int argc, const char
|
|||||||
|
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
if (inet_aton(argv[0], &sin.sin_addr) == 0) {
|
if (inet_aton(argv[0], &sin.sin_addr) == 0) {
|
||||||
DEBUG(0,("Wrongly formed ip address '%s'\n", argv[0]));
|
DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_ctrl_gratious_arp(ctdb, TIMELIMIT(), options.pnn, &sin, argv[1]);
|
ret = ctdb_ctrl_gratious_arp(ctdb, TIMELIMIT(), options.pnn, &sin, argv[1]);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to send gratious_arp from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to send gratious_arp from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ static int regsrvid(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_ctrl_register_server_id(ctdb, TIMELIMIT(), &server_id);
|
ret = ctdb_ctrl_register_server_id(ctdb, TIMELIMIT(), &server_id);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to register server_id from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to register server_id from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -497,7 +497,7 @@ static int unregsrvid(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_ctrl_unregister_server_id(ctdb, TIMELIMIT(), &server_id);
|
ret = ctdb_ctrl_unregister_server_id(ctdb, TIMELIMIT(), &server_id);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to unregister server_id from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to unregister server_id from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -522,7 +522,7 @@ static int chksrvid(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_ctrl_check_server_id(ctdb, TIMELIMIT(), options.pnn, &server_id, &status);
|
ret = ctdb_ctrl_check_server_id(ctdb, TIMELIMIT(), options.pnn, &server_id, &status);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to check server_id from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to check server_id from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +544,7 @@ static int getsrvids(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_ctrl_get_server_id_list(ctdb, ctdb, TIMELIMIT(), options.pnn, &server_ids);
|
ret = ctdb_ctrl_get_server_id_list(ctdb, ctdb, TIMELIMIT(), options.pnn, &server_ids);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get server_id list from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get server_id list from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,18 +571,18 @@ static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!parse_ip_port(argv[0], &src)) {
|
if (!parse_ip_port(argv[0], &src)) {
|
||||||
DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
|
DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[0]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parse_ip_port(argv[1], &dst)) {
|
if (!parse_ip_port(argv[1], &dst)) {
|
||||||
DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
|
DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[1]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = ctdb_sys_open_sending_socket();
|
s = ctdb_sys_open_sending_socket();
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
DEBUG(0, ("Failed to open socket for sending tickle\n"));
|
DEBUG(DEBUG_ERR, ("Failed to open socket for sending tickle\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
if (ret==0) {
|
if (ret==0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DEBUG(0, ("Error while sending tickle ack\n"));
|
DEBUG(DEBUG_ERR, ("Error while sending tickle ack\n"));
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -609,7 +609,7 @@ static int control_ip(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
/* read the public ip list from this node */
|
/* read the public ip list from this node */
|
||||||
ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.pnn, tmp_ctx, &ips);
|
ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.pnn, tmp_ctx, &ips);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get public ips from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get public ips from node %u\n", options.pnn));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -638,7 +638,7 @@ static int control_getpid(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.pnn, &pid);
|
ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.pnn, &pid);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get daemon pid from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get daemon pid from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
printf("Pid:%d\n", pid);
|
printf("Pid:%d\n", pid);
|
||||||
@ -655,7 +655,7 @@ static int control_disable(struct ctdb_context *ctdb, int argc, const char **arg
|
|||||||
|
|
||||||
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
|
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to disable node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to disable node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ static int control_enable(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
|
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to enable node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to enable node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_BAN_NODE, data);
|
ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_BAN_NODE, data);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to ban node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR,("Failed to ban node %u\n", options.pnn));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ static int control_unban(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_UNBAN_NODE, data);
|
ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_UNBAN_NODE, data);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0,("Failed to to unban node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR,("Failed to to unban node %u\n", options.pnn));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,7 +740,7 @@ static int control_shutdown(struct ctdb_context *ctdb, int argc, const char **ar
|
|||||||
|
|
||||||
ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.pnn);
|
ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.pnn);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to shutdown node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to shutdown node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,13 +756,13 @@ static int control_recover(struct ctdb_context *ctdb, int argc, const char **arg
|
|||||||
|
|
||||||
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
|
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to freeze node\n"));
|
DEBUG(DEBUG_ERR, ("Unable to freeze node\n"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.pnn, CTDB_RECOVERY_ACTIVE);
|
ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.pnn, CTDB_RECOVERY_ACTIVE);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to set recovery mode\n"));
|
DEBUG(DEBUG_ERR, ("Unable to set recovery mode\n"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ static int control_getmonmode(struct ctdb_context *ctdb, int argc, const char **
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.pnn, &monmode);
|
ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.pnn, &monmode);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get monmode from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get monmode from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode);
|
printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode);
|
||||||
@ -805,14 +805,14 @@ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
ctdb_db = ctdb_attach(ctdb, db_name, false);
|
ctdb_db = ctdb_attach(ctdb, db_name, false);
|
||||||
|
|
||||||
if (ctdb_db == NULL) {
|
if (ctdb_db == NULL) {
|
||||||
DEBUG(0,("Unable to attach to database '%s'\n", db_name));
|
DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* traverse and dump the cluster tdb */
|
/* traverse and dump the cluster tdb */
|
||||||
ret = ctdb_dump_db(ctdb_db, stdout);
|
ret = ctdb_dump_db(ctdb_db, stdout);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0, ("Unable to dump database\n"));
|
DEBUG(DEBUG_ERR, ("Unable to dump database\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
talloc_free(ctdb_db);
|
talloc_free(ctdb_db);
|
||||||
@ -832,7 +832,7 @@ static int control_getdbmap(struct ctdb_context *ctdb, int argc, const char **ar
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &dbmap);
|
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &dbmap);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get dbids from node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to get dbids from node %u\n", options.pnn));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,7 +917,7 @@ static int control_getvar(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
name = argv[0];
|
name = argv[0];
|
||||||
ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.pnn, name, &value);
|
ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.pnn, name, &value);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0, ("Unable to get tunable variable '%s'\n", name));
|
DEBUG(DEBUG_ERR, ("Unable to get tunable variable '%s'\n", name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,7 +943,7 @@ static int control_setvar(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.pnn, name, value);
|
ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.pnn, name, value);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0, ("Unable to set tunable variable '%s'\n", name));
|
DEBUG(DEBUG_ERR, ("Unable to set tunable variable '%s'\n", name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -960,7 +960,7 @@ static int control_listvars(struct ctdb_context *ctdb, int argc, const char **ar
|
|||||||
|
|
||||||
ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.pnn, ctdb, &list, &count);
|
ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.pnn, ctdb, &list, &count);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
DEBUG(0, ("Unable to list tunable variables\n"));
|
DEBUG(DEBUG_ERR, ("Unable to list tunable variables\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -983,7 +983,7 @@ static int control_getdebug(struct ctdb_context *ctdb, int argc, const char **ar
|
|||||||
|
|
||||||
ret = ctdb_ctrl_get_debuglevel(ctdb, options.pnn, &level);
|
ret = ctdb_ctrl_get_debuglevel(ctdb, options.pnn, &level);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get debuglevel response from node %u\n",
|
DEBUG(DEBUG_ERR, ("Unable to get debuglevel response from node %u\n",
|
||||||
options.pnn));
|
options.pnn));
|
||||||
} else {
|
} else {
|
||||||
printf("Node %u is at debug level %u\n", options.pnn, level);
|
printf("Node %u is at debug level %u\n", options.pnn, level);
|
||||||
@ -1008,7 +1008,7 @@ static int control_setdebug(struct ctdb_context *ctdb, int argc, const char **ar
|
|||||||
|
|
||||||
ret = ctdb_ctrl_set_debuglevel(ctdb, options.pnn, level);
|
ret = ctdb_ctrl_set_debuglevel(ctdb, options.pnn, level);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to set debug level on node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to set debug level on node %u\n", options.pnn));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1023,7 +1023,7 @@ static int control_freeze(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
|
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to freeze node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to freeze node %u\n", options.pnn));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1037,7 +1037,7 @@ static int control_thaw(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.pnn);
|
ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.pnn);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to thaw node %u\n", options.pnn));
|
DEBUG(DEBUG_ERR, ("Unable to thaw node %u\n", options.pnn));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1058,7 +1058,7 @@ static int control_attach(struct ctdb_context *ctdb, int argc, const char **argv
|
|||||||
|
|
||||||
ctdb_db = ctdb_attach(ctdb, db_name, false);
|
ctdb_db = ctdb_attach(ctdb, db_name, false);
|
||||||
if (ctdb_db == NULL) {
|
if (ctdb_db == NULL) {
|
||||||
DEBUG(0,("Unable to attach to database '%s'\n", db_name));
|
DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,7 +1078,7 @@ static int control_dumpmemory(struct ctdb_context *ctdb, int argc, const char **
|
|||||||
ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_DUMP_MEMORY,
|
ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_DUMP_MEMORY,
|
||||||
0, tdb_null, tmp_ctx, &data, &res, NULL, &errmsg);
|
0, tdb_null, tmp_ctx, &data, &res, NULL, &errmsg);
|
||||||
if (ret != 0 || res != 0) {
|
if (ret != 0 || res != 0) {
|
||||||
DEBUG(0,("Failed to dump memory - %s\n", errmsg));
|
DEBUG(DEBUG_ERR,("Failed to dump memory - %s\n", errmsg));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1199,7 +1199,7 @@ int main(int argc, const char *argv[])
|
|||||||
while ((opt = poptGetNextOpt(pc)) != -1) {
|
while ((opt = poptGetNextOpt(pc)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
default:
|
default:
|
||||||
DEBUG(0, ("Invalid option %s: %s\n",
|
DEBUG(DEBUG_ERR, ("Invalid option %s: %s\n",
|
||||||
poptBadOption(pc, 0), poptStrerror(opt)));
|
poptBadOption(pc, 0), poptStrerror(opt)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -1237,7 +1237,7 @@ int main(int argc, const char *argv[])
|
|||||||
/* initialise ctdb */
|
/* initialise ctdb */
|
||||||
ctdb = ctdb_cmdline_client(ev);
|
ctdb = ctdb_cmdline_client(ev);
|
||||||
if (ctdb == NULL) {
|
if (ctdb == NULL) {
|
||||||
DEBUG(0, ("Failed to init ctdb\n"));
|
DEBUG(DEBUG_ERR, ("Failed to init ctdb\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1276,7 +1276,7 @@ int main(int argc, const char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == ARRAY_SIZE(ctdb_commands)) {
|
if (i == ARRAY_SIZE(ctdb_commands)) {
|
||||||
DEBUG(0, ("Unknown control '%s'\n", control));
|
DEBUG(DEBUG_ERR, ("Unknown control '%s'\n", control));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
|
|||||||
/* add the record to the blob ready to send to the nodes */
|
/* add the record to the blob ready to send to the nodes */
|
||||||
rec = ctdb_marshall_record(vdata->list[lmaster], vdata->ctdb->pnn, key, NULL, tdb_null);
|
rec = ctdb_marshall_record(vdata->list[lmaster], vdata->ctdb->pnn, key, NULL, tdb_null);
|
||||||
if (rec == NULL) {
|
if (rec == NULL) {
|
||||||
DEBUG(0,(__location__ " Out of memory\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
|
||||||
vdata->traverse_error = true;
|
vdata->traverse_error = true;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
|
|||||||
vdata->list[lmaster] = talloc_realloc_size(NULL, vdata->list[lmaster],
|
vdata->list[lmaster] = talloc_realloc_size(NULL, vdata->list[lmaster],
|
||||||
old_size + rec->length);
|
old_size + rec->length);
|
||||||
if (vdata->list[lmaster] == NULL) {
|
if (vdata->list[lmaster] == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to expand\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to expand\n"));
|
||||||
vdata->traverse_error = true;
|
vdata->traverse_error = true;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
|
|||||||
|
|
||||||
vdata = talloc_zero(ctdb, struct vacuum_data);
|
vdata = talloc_zero(ctdb, struct vacuum_data);
|
||||||
if (vdata == NULL) {
|
if (vdata == NULL) {
|
||||||
DEBUG(0,(__location__ " Out of memory\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,14 +239,14 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
|
|||||||
vdata->vacuum_limit = vacuum_limit;
|
vdata->vacuum_limit = vacuum_limit;
|
||||||
|
|
||||||
if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, vdata, &name) != 0) {
|
if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, vdata, &name) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", db_id));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", db_id));
|
||||||
talloc_free(vdata);
|
talloc_free(vdata);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_db = ctdb_attach(ctdb, name, persistent);
|
ctdb_db = ctdb_attach(ctdb, name, persistent);
|
||||||
if (ctdb_db == NULL) {
|
if (ctdb_db == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
|
||||||
talloc_free(vdata);
|
talloc_free(vdata);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
|
|||||||
/* the list needs to be of length num_nodes */
|
/* the list needs to be of length num_nodes */
|
||||||
vdata->list = talloc_array(vdata, struct ctdb_control_pulldb_reply *, ctdb->vnn_map->size);
|
vdata->list = talloc_array(vdata, struct ctdb_control_pulldb_reply *, ctdb->vnn_map->size);
|
||||||
if (vdata->list == NULL) {
|
if (vdata->list == NULL) {
|
||||||
DEBUG(0,(__location__ " Out of memory\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
|
||||||
talloc_free(vdata);
|
talloc_free(vdata);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
|
|||||||
talloc_zero_size(vdata->list,
|
talloc_zero_size(vdata->list,
|
||||||
offsetof(struct ctdb_control_pulldb_reply, data));
|
offsetof(struct ctdb_control_pulldb_reply, data));
|
||||||
if (vdata->list[i] == NULL) {
|
if (vdata->list[i] == NULL) {
|
||||||
DEBUG(0,(__location__ " Out of memory\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
|
||||||
talloc_free(vdata);
|
talloc_free(vdata);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
|
|||||||
/* traverse, looking for records that might be able to be vacuumed */
|
/* traverse, looking for records that might be able to be vacuumed */
|
||||||
if (tdb_traverse_read(ctdb_db->ltdb->tdb, vacuum_traverse, vdata) == -1 ||
|
if (tdb_traverse_read(ctdb_db->ltdb->tdb, vacuum_traverse, vdata) == -1 ||
|
||||||
vdata->traverse_error) {
|
vdata->traverse_error) {
|
||||||
DEBUG(0,(__location__ " Traverse error in vacuuming '%s'\n", name));
|
DEBUG(DEBUG_ERR,(__location__ " Traverse error in vacuuming '%s'\n", name));
|
||||||
talloc_free(vdata);
|
talloc_free(vdata);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
|
|||||||
data.dsize = talloc_get_size(vdata->list[i]);
|
data.dsize = talloc_get_size(vdata->list[i]);
|
||||||
data.dptr = (void *)vdata->list[i];
|
data.dptr = (void *)vdata->list[i];
|
||||||
if (ctdb_send_message(ctdb, ctdb->vnn_map->map[i], CTDB_SRVID_VACUUM_FETCH, data) != 0) {
|
if (ctdb_send_message(ctdb, ctdb->vnn_map->map[i], CTDB_SRVID_VACUUM_FETCH, data) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to send vacuum fetch message to %u\n",
|
DEBUG(DEBUG_ERR,(__location__ " Failed to send vacuum fetch message to %u\n",
|
||||||
ctdb->vnn_map->map[i]));
|
ctdb->vnn_map->map[i]));
|
||||||
talloc_free(vdata);
|
talloc_free(vdata);
|
||||||
return -1;
|
return -1;
|
||||||
@ -310,7 +310,7 @@ static int ctdb_vacuum_db(struct ctdb_context *ctdb, uint32_t db_id, struct ctdb
|
|||||||
|
|
||||||
/* for records where we are the lmaster, we can try to delete them */
|
/* for records where we are the lmaster, we can try to delete them */
|
||||||
if (ctdb_vacuum_local(ctdb, vdata->list[i], ctdb_db, &count) != 0) {
|
if (ctdb_vacuum_local(ctdb, vdata->list[i], ctdb_db, &count) != 0) {
|
||||||
DEBUG(0,(__location__ " Deletion error in vacuuming '%s'\n", name));
|
DEBUG(DEBUG_ERR,(__location__ " Deletion error in vacuuming '%s'\n", name));
|
||||||
talloc_free(vdata);
|
talloc_free(vdata);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -344,25 +344,25 @@ int ctdb_vacuum(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
|
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get dbids from local node\n"));
|
DEBUG(DEBUG_ERR, ("Unable to get dbids from local node\n"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap);
|
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get nodemap from local node\n"));
|
DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &ctdb->vnn_map);
|
ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &ctdb->vnn_map);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get vnnmap from local node\n"));
|
DEBUG(DEBUG_ERR, ("Unable to get vnnmap from local node\n"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
|
pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
|
||||||
if (pnn == -1) {
|
if (pnn == -1) {
|
||||||
DEBUG(0, ("Unable to get pnn from local node\n"));
|
DEBUG(DEBUG_ERR, ("Unable to get pnn from local node\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ctdb->pnn = pnn;
|
ctdb->pnn = pnn;
|
||||||
@ -370,7 +370,7 @@ int ctdb_vacuum(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
for (i=0;i<dbmap->num;i++) {
|
for (i=0;i<dbmap->num;i++) {
|
||||||
if (ctdb_vacuum_db(ctdb, dbmap->dbs[i].dbid, nodemap,
|
if (ctdb_vacuum_db(ctdb, dbmap->dbs[i].dbid, nodemap,
|
||||||
dbmap->dbs[i].persistent, vacuum_limit) != 0) {
|
dbmap->dbs[i].persistent, vacuum_limit) != 0) {
|
||||||
DEBUG(0,("Failed to vacuum db 0x%x\n", dbmap->dbs[i].dbid));
|
DEBUG(DEBUG_ERR,("Failed to vacuum db 0x%x\n", dbmap->dbs[i].dbid));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -405,13 +405,13 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
|
|||||||
struct traverse_state state;
|
struct traverse_state state;
|
||||||
|
|
||||||
if (tdb_transaction_start(tdb) != 0) {
|
if (tdb_transaction_start(tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to start transaction\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to start transaction\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb), TDB_INTERNAL, O_RDWR|O_CREAT, 0);
|
tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb), TDB_INTERNAL, O_RDWR|O_CREAT, 0);
|
||||||
if (tmp_db == NULL) {
|
if (tmp_db == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to create tmp_db\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to create tmp_db\n"));
|
||||||
tdb_transaction_cancel(tdb);
|
tdb_transaction_cancel(tdb);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -420,21 +420,21 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
|
|||||||
state.dest_db = tmp_db;
|
state.dest_db = tmp_db;
|
||||||
|
|
||||||
if (tdb_traverse_read(tdb, repack_traverse, &state) == -1) {
|
if (tdb_traverse_read(tdb, repack_traverse, &state) == -1) {
|
||||||
DEBUG(0,(__location__ " Failed to traverse copying out\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to traverse copying out\n"));
|
||||||
tdb_transaction_cancel(tdb);
|
tdb_transaction_cancel(tdb);
|
||||||
tdb_close(tmp_db);
|
tdb_close(tmp_db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.error) {
|
if (state.error) {
|
||||||
DEBUG(0,(__location__ " Error during traversal\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Error during traversal\n"));
|
||||||
tdb_transaction_cancel(tdb);
|
tdb_transaction_cancel(tdb);
|
||||||
tdb_close(tmp_db);
|
tdb_close(tmp_db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdb_wipe_all(tdb) != 0) {
|
if (tdb_wipe_all(tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to wipe database\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to wipe database\n"));
|
||||||
tdb_transaction_cancel(tdb);
|
tdb_transaction_cancel(tdb);
|
||||||
tdb_close(tmp_db);
|
tdb_close(tmp_db);
|
||||||
return -1;
|
return -1;
|
||||||
@ -444,14 +444,14 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
|
|||||||
state.dest_db = tdb;
|
state.dest_db = tdb;
|
||||||
|
|
||||||
if (tdb_traverse_read(tmp_db, repack_traverse, &state) == -1) {
|
if (tdb_traverse_read(tmp_db, repack_traverse, &state) == -1) {
|
||||||
DEBUG(0,(__location__ " Failed to traverse copying back\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to traverse copying back\n"));
|
||||||
tdb_transaction_cancel(tdb);
|
tdb_transaction_cancel(tdb);
|
||||||
tdb_close(tmp_db);
|
tdb_close(tmp_db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.error) {
|
if (state.error) {
|
||||||
DEBUG(0,(__location__ " Error during second traversal\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Error during second traversal\n"));
|
||||||
tdb_transaction_cancel(tdb);
|
tdb_transaction_cancel(tdb);
|
||||||
tdb_close(tmp_db);
|
tdb_close(tmp_db);
|
||||||
return -1;
|
return -1;
|
||||||
@ -460,7 +460,7 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
|
|||||||
tdb_close(tmp_db);
|
tdb_close(tmp_db);
|
||||||
|
|
||||||
if (tdb_transaction_commit(tdb) != 0) {
|
if (tdb_transaction_commit(tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to commit\n"));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to commit\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,19 +477,19 @@ static int ctdb_repack_db(struct ctdb_context *ctdb, uint32_t db_id,
|
|||||||
int size;
|
int size;
|
||||||
|
|
||||||
if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, ctdb, &name) != 0) {
|
if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, ctdb, &name) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", db_id));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", db_id));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctdb_db = ctdb_attach(ctdb, name, persistent);
|
ctdb_db = ctdb_attach(ctdb, name, persistent);
|
||||||
if (ctdb_db == NULL) {
|
if (ctdb_db == NULL) {
|
||||||
DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = tdb_freelist_size(ctdb_db->ltdb->tdb);
|
size = tdb_freelist_size(ctdb_db->ltdb->tdb);
|
||||||
if (size == -1) {
|
if (size == -1) {
|
||||||
DEBUG(0,(__location__ " Failed to get freelist size for '%s'\n", name));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to get freelist size for '%s'\n", name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ static int ctdb_repack_db(struct ctdb_context *ctdb, uint32_t db_id,
|
|||||||
printf("Repacking %s with %u freelist entries\n", name, size);
|
printf("Repacking %s with %u freelist entries\n", name, size);
|
||||||
|
|
||||||
if (ctdb_repack_tdb(ctdb_db->ltdb->tdb) != 0) {
|
if (ctdb_repack_tdb(ctdb_db->ltdb->tdb) != 0) {
|
||||||
DEBUG(0,(__location__ " Failed to repack '%s'\n", name));
|
DEBUG(DEBUG_ERR,(__location__ " Failed to repack '%s'\n", name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,14 +524,14 @@ int ctdb_repack(struct ctdb_context *ctdb, int argc, const char **argv)
|
|||||||
|
|
||||||
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
|
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(0, ("Unable to get dbids from local node\n"));
|
DEBUG(DEBUG_ERR, ("Unable to get dbids from local node\n"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<dbmap->num;i++) {
|
for (i=0;i<dbmap->num;i++) {
|
||||||
if (ctdb_repack_db(ctdb, dbmap->dbs[i].dbid,
|
if (ctdb_repack_db(ctdb, dbmap->dbs[i].dbid,
|
||||||
dbmap->dbs[i].persistent, repack_limit) != 0) {
|
dbmap->dbs[i].persistent, repack_limit) != 0) {
|
||||||
DEBUG(0,("Failed to repack db 0x%x\n", dbmap->dbs[i].dbid));
|
DEBUG(DEBUG_ERR,("Failed to repack db 0x%x\n", dbmap->dbs[i].dbid));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user