Rev 58: merging tridge's code... in
http://samba.org/~tridge/psomogyi/
psomogyi at gamax.hu
psomogyi at gamax.hu
Wed Jan 31 11:24:55 GMT 2007
------------------------------------------------------------
revno: 58
revision-id: psomogyi at gamax.hu-20070131112455-cl0rqp0e34fxxr1e
parent: psomogyi at gamax.hu-20070130174726-v2l2oxyv3j9ozs9t
parent: tridge at samba.org-20070129113006-nh3cfnyd3g3zuxra
committer: Peter Somogyi <psomogyi at gamax.hu>
branch nick: ctdb
timestamp: Wed 2007-01-31 12:24:55 +0100
message:
merging tridge's code...
modified:
common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1
include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11
include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
------------------------------------------------------------
revno: 44.1.8
merged: tridge at samba.org-20070129113006-nh3cfnyd3g3zuxra
parent: tridge at samba.org-20070129111116-ykmnhtzqda13o5ou
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2007-01-29 22:30:06 +1100
message:
merge status code changes from samba4 ctdb
------------------------------------------------------------
revno: 44.1.7
merged: tridge at samba.org-20070129111116-ykmnhtzqda13o5ou
parent: tridge at samba.org-20070125051317-0ar5t90i0d1nd3lq
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2007-01-29 22:11:16 +1100
message:
fix a bug in new structure handling
=== modified file 'common/ctdb_call.c'
--- a/common/ctdb_call.c 2007-01-25 11:31:33 +0000
+++ b/common/ctdb_call.c 2007-01-31 11:24:55 +0000
@@ -61,6 +61,7 @@
CTDB_NO_MEMORY(ctdb, c->record_data.dptr);
c->new_data = NULL;
c->reply_data = NULL;
+ c->status = 0;
for (fn=ctdb->calls;fn;fn=fn->next) {
if (fn->id == call->call_id) break;
@@ -101,6 +102,7 @@
call->reply_data.dptr = NULL;
call->reply_data.dsize = 0;
}
+ call->status = c->status;
talloc_free(c);
@@ -299,6 +301,7 @@
/* determine if we are the dmaster for this key. This also
fetches the record data (if any), thus avoiding a 2nd fetch of the data
if the call will be answered locally */
+
ret = ctdb_ltdb_fetch(ctdb, call.key, &header, &data);
if (ret != 0) {
ctdb_send_error(ctdb, hdr, ret, "ltdb fetch failed in ctdb_request_call");
@@ -332,12 +335,15 @@
r->hdr.destnode = hdr->srcnode;
r->hdr.srcnode = hdr->destnode;
r->hdr.reqid = hdr->reqid;
+ r->status = call.status;
r->datalen = call.reply_data.dsize;
- memcpy(&r->data[0], call.reply_data.dptr, call.reply_data.dsize);
+ if (call.reply_data.dsize) {
+ memcpy(&r->data[0], call.reply_data.dptr, call.reply_data.dsize);
+ talloc_free(call.reply_data.dptr);
+ }
ctdb_queue_packet(ctdb, &r->hdr);
- talloc_free(call.reply_data.dptr);
talloc_free(r);
}
@@ -367,15 +373,13 @@
{
struct ctdb_reply_call *c = (struct ctdb_reply_call *)hdr;
struct ctdb_call_state *state;
- TDB_DATA reply_data;
state = idr_find(ctdb->idr, hdr->reqid);
if (state == NULL) return;
- reply_data.dptr = c->data;
- reply_data.dsize = c->datalen;
-
- state->call.reply_data = reply_data;
+ state->call.reply_data.dptr = c->data;
+ state->call.reply_data.dsize = c->datalen;
+ state->call.status = c->status;
talloc_steal(state, c);
@@ -505,8 +509,10 @@
state->state = CTDB_CALL_DONE;
state->node = ctdb->nodes[ctdb->vnn];
-
- ret = ctdb_call_local(ctdb, call, header, data, ctdb->vnn);
+ state->call = *call;
+
+ ret = ctdb_call_local(ctdb, &state->call, header, data, ctdb->vnn);
+
return state;
}
@@ -557,11 +563,9 @@
memcpy(&state->c->data[0], call->key.dptr, call->key.dsize);
memcpy(&state->c->data[call->key.dsize],
call->call_data.dptr, call->call_data.dsize);
+ state->call = *call;
state->call.call_data.dptr = &state->c->data[call->key.dsize];
- state->call.call_data.dsize = call->call_data.dsize;
-
- state->call.key.dptr = &state->c->data[0];
- state->call.key.dsize = call->key.dsize;
+ state->call.key.dptr = &state->c->data[0];
state->node = ctdb->nodes[header.dmaster];
state->state = CTDB_CALL_WAIT;
@@ -593,10 +597,16 @@
talloc_free(state);
return -1;
}
- call->reply_data.dptr = talloc_memdup(state->node->ctdb,
- state->call.reply_data.dptr,
- state->call.reply_data.dsize);
- call->reply_data.dsize = state->call.reply_data.dsize;
+ if (state->call.reply_data.dsize) {
+ call->reply_data.dptr = talloc_memdup(state->node->ctdb,
+ state->call.reply_data.dptr,
+ state->call.reply_data.dsize);
+ call->reply_data.dsize = state->call.reply_data.dsize;
+ } else {
+ call->reply_data.dptr = NULL;
+ call->reply_data.dsize = 0;
+ }
+ call->status = state->call.status;
talloc_free(state);
return 0;
}
=== modified file 'include/ctdb.h'
--- a/include/ctdb.h 2007-01-25 05:13:17 +0000
+++ b/include/ctdb.h 2007-01-29 11:30:06 +0000
@@ -26,6 +26,7 @@
TDB_DATA key;
TDB_DATA call_data;
TDB_DATA reply_data;
+ uint32_t status;
};
/*
@@ -37,6 +38,7 @@
TDB_DATA *new_data; /* optionally updated record data */
TDB_DATA *call_data; /* optionally passed from caller */
TDB_DATA *reply_data; /* optionally returned by function */
+ uint32_t status; /* optional reply status - defaults to zero */
};
#define CTDB_ERR_INVALID 1
=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h 2007-01-25 11:31:33 +0000
+++ b/include/ctdb_private.h 2007-01-31 11:24:55 +0000
@@ -162,6 +162,7 @@
struct ctdb_reply_call {
struct ctdb_req_header hdr;
+ uint32_t status;
uint32_t datalen;
uint8_t data[1];
};
More information about the samba-cvs
mailing list