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

libctdb: Make sure ctdb_request->ctdb is filled correctly

Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 06433d20a43d41f05b96a9dda6dc5931539feaa3)
This commit is contained in:
Volker Lendecke 2011-08-19 16:36:20 +02:00 committed by Michael Adam
parent 8638b5f5d2
commit b0706be89e
3 changed files with 14 additions and 7 deletions

View File

@ -232,7 +232,7 @@ int ctdb_which_events(struct ctdb_connection *ctdb)
return events;
}
struct ctdb_request *new_ctdb_request(size_t len,
struct ctdb_request *new_ctdb_request(struct ctdb_connection *ctdb, size_t len,
ctdb_callback_t cb, void *cbdata)
{
struct ctdb_request *req = malloc(sizeof(*req));
@ -243,6 +243,7 @@ struct ctdb_request *new_ctdb_request(size_t len,
free(req);
return NULL;
}
req->ctdb = ctdb;
req->hdr.hdr = io_elem_data(req->io, NULL);
req->reply = NULL;
req->callback = cb;
@ -509,7 +510,9 @@ struct ctdb_request *new_ctdb_control_request(struct ctdb_connection *ctdb,
struct ctdb_request *req;
struct ctdb_req_control *pkt;
req = new_ctdb_request(offsetof(struct ctdb_req_control, data) + extra, callback, cbdata);
req = new_ctdb_request(
ctdb, offsetof(struct ctdb_req_control, data) + extra,
callback, cbdata);
if (!req)
return NULL;
@ -870,8 +873,10 @@ ctdb_readrecordlock_async(struct ctdb_db *ctdb_db, TDB_DATA key,
}
/* Slow path: create request. */
req = new_ctdb_request(offsetof(struct ctdb_req_call, data)
+ key.dsize, readrecordlock_retry, cbdata);
req = new_ctdb_request(
ctdb_db->ctdb,
offsetof(struct ctdb_req_call, data) + key.dsize,
readrecordlock_retry, cbdata);
if (!req) {
DEBUG(ctdb_db->ctdb, LOG_ERR,
"ctdb_readrecordlock_async: allocation failed");

View File

@ -80,7 +80,8 @@ struct ctdb_connection {
};
/* ctdb.c */
struct ctdb_request *new_ctdb_request(size_t len, ctdb_callback_t, void *);
struct ctdb_request *new_ctdb_request(struct ctdb_connection *ctdb, size_t len,
ctdb_callback_t cb, void *cbdata);
struct ctdb_request *new_ctdb_control_request(struct ctdb_connection *ctdb,
uint32_t opcode,
uint32_t destnode,

View File

@ -216,8 +216,9 @@ bool ctdb_send_message(struct ctdb_connection *ctdb,
struct ctdb_req_message *pkt;
/* We just discard it once it's finished: no reply. */
req = new_ctdb_request(offsetof(struct ctdb_req_message, data) + data.dsize,
ctdb_cancel_callback, NULL);
req = new_ctdb_request(
ctdb, offsetof(struct ctdb_req_message, data) + data.dsize,
ctdb_cancel_callback, NULL);
if (!req) {
DEBUG(ctdb, LOG_ERR, "ctdb_set_message: allocating message");
return false;