1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

- fixed a crash bug after client disconnect in ctdb_control

- added total memory used to ctdb_control status output

(This used to be ctdb commit a99ffe4372edc63d83d8c8ebf9a60b3413301f5a)
This commit is contained in:
Andrew Tridgell 2007-05-05 08:33:35 +10:00
parent d8f4e6b209
commit adc64aed0a
3 changed files with 10 additions and 2 deletions

View File

@ -158,6 +158,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
case CTDB_CONTROL_STATUS: {
CHECK_CONTROL_DATA_SIZE(0);
ctdb->status.controls.status++;
ctdb->status.memory_used = talloc_total_size(ctdb);
outdata->dptr = (uint8_t *)&ctdb->status;
outdata->dsize = sizeof(ctdb->status);
return 0;
@ -499,8 +500,11 @@ void ctdb_reply_control(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
data.dptr = &c->data[0];
data.dsize = c->datalen;
/* make state a child of the packet, so it goes away when the packet
is freed. */
talloc_steal(hdr, state);
state->callback(ctdb, c->status, data, state->private_data);
talloc_free(state);
}
static int ctdb_control_destructor(struct ctdb_control_state *state)
@ -528,7 +532,9 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
return -1;
}
state = talloc(ctdb, struct ctdb_control_state);
/* the state is made a child of private_data if possible. This means any reply
will be discarded if the private_data goes away */
state = talloc(private_data?private_data:ctdb, struct ctdb_control_state);
CTDB_NO_MEMORY(ctdb, state);
state->reqid = ctdb_reqid_new(ctdb, state);

View File

@ -175,6 +175,7 @@ struct ctdb_status {
uint32_t lockwait_calls;
uint32_t traverse_calls;
uint32_t pending_lockwait_calls;
uint32_t memory_used;
uint32_t __last_counter; /* hack for control_status_all */
uint32_t max_hop_count;
double max_call_latency;

View File

@ -135,6 +135,7 @@ static void show_status(struct ctdb_status *s)
STATUS_FIELD(lockwait_calls),
STATUS_FIELD(traverse_calls),
STATUS_FIELD(pending_lockwait_calls),
STATUS_FIELD(memory_used),
STATUS_FIELD(max_hop_count),
};
printf("CTDB version %u\n", CTDB_VERSION);