summaryrefslogtreecommitdiffstats
path: root/ctdb/libctdb
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2010-06-18 15:15:11 +0930
committerRusty Russell <rusty@rustcorp.com.au>2010-06-18 15:15:11 +0930
commit841518d677fdca5cd0faca1316e00def23bef551 (patch)
tree0510b85adbf9009b2f726a5aeff81f588fed789a /ctdb/libctdb
parent8e82448a5a242f3e6beed525194984fda3c434ab (diff)
downloadsamba-841518d677fdca5cd0faca1316e00def23bef551.tar.gz
samba-841518d677fdca5cd0faca1316e00def23bef551.tar.xz
samba-841518d677fdca5cd0faca1316e00def23bef551.zip
libctdb: check ctdb_request_free & ctdb_cancel used appropriately.
Since I made this mistake myself, we should check for it. We could have one function that does both, but from a user's point of view they are very different and it's quite possibly a bug if they think the request is finished/unfinished when it's not. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 70f6ed2634fb10749cdad3deffa96a1aa439c235)
Diffstat (limited to 'ctdb/libctdb')
-rw-r--r--ctdb/libctdb/ctdb.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ctdb/libctdb/ctdb.c b/ctdb/libctdb/ctdb.c
index 527cb7891b..1c16d36a7c 100644
--- a/ctdb/libctdb/ctdb.c
+++ b/ctdb/libctdb/ctdb.c
@@ -201,6 +201,13 @@ struct ctdb_request *new_ctdb_request(size_t len,
void ctdb_request_free(struct ctdb_connection *ctdb, struct ctdb_request *req)
{
+ if (req->next || req->prev) {
+ DEBUG(ctdb, LOG_ALERT,
+ "ctdb_request_free: request not complete! ctdb_cancel? %p (id %u)",
+ req, req->hdr.hdr ? req->hdr.hdr->reqid : 0);
+ ctdb_cancel(ctdb, req);
+ return;
+ }
if (req->extra_destructor) {
req->extra_destructor(ctdb, req);
}
@@ -456,6 +463,14 @@ void ctdb_cancel_callback(struct ctdb_connection *ctdb,
void ctdb_cancel(struct ctdb_connection *ctdb, struct ctdb_request *req)
{
+ if (!req->next && !req->prev) {
+ DEBUG(ctdb, LOG_ALERT,
+ "ctdb_cancel: request completed! ctdb_request_free? %p (id %u)",
+ req, req->hdr.hdr ? req->hdr.hdr->reqid : 0);
+ ctdb_request_free(ctdb, req);
+ return;
+ }
+
DEBUG(ctdb, LOG_DEBUG, "ctdb_cancel: %p (id %u)",
req, req->hdr.hdr ? req->hdr.hdr->reqid : 0);