]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
added logic for keeping track of the lacount
authorAndrew Tridgell <tridge@samba.org>
Mon, 18 Dec 2006 03:58:40 +0000 (14:58 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 18 Dec 2006 03:58:40 +0000 (14:58 +1100)
(This used to be ctdb commit efda7735a950a129814e6a7de8bbf5432b867c68)

ctdb/common/ctdb_call.c

index 5b09815b411cd59f915e2a92a4763a0444eac87e..406e8cd8f09d73b3a6ad50d0954694b39514da05 100644 (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;
 }