1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

added logic for keeping track of the lacount

(This used to be ctdb commit efda7735a950a129814e6a7de8bbf5432b867c68)
This commit is contained in:
Andrew Tridgell 2006-12-18 14:58:40 +11:00
parent 0ef74421b4
commit 26fd5c44bb

View File

@ -30,7 +30,8 @@
*/
static int ctdb_call_local(struct ctdb_context *ctdb, TDB_DATA key,
struct ctdb_ltdb_header *header, TDB_DATA *data,
int call_id, TDB_DATA *call_data, TDB_DATA *reply_data)
int call_id, TDB_DATA *call_data, TDB_DATA *reply_data,
uint32_t caller)
{
struct ctdb_call *c;
struct ctdb_registered_call *fn;
@ -59,6 +60,18 @@ static int ctdb_call_local(struct ctdb_context *ctdb, TDB_DATA key,
return -1;
}
if (header->laccessor != caller) {
header->lacount = 0;
}
header->laccessor = caller;
header->lacount++;
/* we need to force the record to be written out if this was a remote access,
so that the lacount is updated */
if (c->new_data == NULL && header->laccessor != ctdb->vnn) {
c->new_data = &c->record_data;
}
if (c->new_data) {
if (ctdb_ltdb_store(ctdb, key, header, *c->new_data) != 0) {
ctdb_set_error(ctdb, "ctdb_call tdb_store failed\n");
@ -185,7 +198,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
ctdb_call_local(ctdb, key, &header, &data, c->callid,
call_data.dsize?&call_data:NULL,
&reply_data);
&reply_data, c->hdr.srcnode);
r = talloc_size(ctdb, sizeof(*r) + reply_data.dsize);
r->hdr.length = sizeof(*r) + reply_data.dsize;
@ -336,7 +349,8 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_context *ctdb,
state->node = ctdb->nodes[ctdb->vnn];
ret = ctdb_call_local(ctdb, key, header, data,
call_id, call_data, &state->reply_data);
call_id, call_data, &state->reply_data,
ctdb->vnn);
return state;
}