*/
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;
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");
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;
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;
}