summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-08-19 16:36:20 +0200
committerMichael Adam <obnox@samba.org>2011-08-22 17:11:06 +0200
commitb0706be89ec8aaa55845bde662cc930303fe8dd4 (patch)
treea407e7fec46f58021d105d7b39240bc2e820039e
parent8638b5f5d25ae0ddd1524c94a0498ee1056041f7 (diff)
downloadsamba-b0706be89ec8aaa55845bde662cc930303fe8dd4.tar.gz
samba-b0706be89ec8aaa55845bde662cc930303fe8dd4.tar.xz
samba-b0706be89ec8aaa55845bde662cc930303fe8dd4.zip
libctdb: Make sure ctdb_request->ctdb is filled correctly
Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 06433d20a43d41f05b96a9dda6dc5931539feaa3)
-rw-r--r--ctdb/libctdb/ctdb.c13
-rw-r--r--ctdb/libctdb/libctdb_private.h3
-rw-r--r--ctdb/libctdb/messages.c5
3 files changed, 14 insertions, 7 deletions
diff --git a/ctdb/libctdb/ctdb.c b/ctdb/libctdb/ctdb.c
index 8ede2a274b..30211d511e 100644
--- a/ctdb/libctdb/ctdb.c
+++ b/ctdb/libctdb/ctdb.c
@@ -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");
diff --git a/ctdb/libctdb/libctdb_private.h b/ctdb/libctdb/libctdb_private.h
index 26fdaf0e25..d572aeabde 100644
--- a/ctdb/libctdb/libctdb_private.h
+++ b/ctdb/libctdb/libctdb_private.h
@@ -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,
diff --git a/ctdb/libctdb/messages.c b/ctdb/libctdb/messages.c
index d5c450833d..b69428baf0 100644
--- a/ctdb/libctdb/messages.c
+++ b/ctdb/libctdb/messages.c
@@ -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;