313
313
r->hdr.reqid = dstate->reqid;
314
314
r->datalen = dstate->call->reply_data.dsize;
315
r->status = dstate->call->status;
315
316
memcpy(&r->data[0], dstate->call->reply_data.dptr, r->datalen);
317
318
res = daemon_queue_send(client, &r->hdr);
427
/* Dont do READONLY if we dont have a tracking database */
428
if ((c->flags & CTDB_WANT_READONLY) && !ctdb_db->readonly) {
429
c->flags &= ~CTDB_WANT_READONLY;
432
if (header.flags & CTDB_REC_RO_REVOKE_COMPLETE) {
433
header.flags &= ~(CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE);
434
if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
435
ctdb_fatal(ctdb, "Failed to write header with cleared REVOKE flag");
437
/* and clear out the tracking data */
438
if (tdb_delete(ctdb_db->rottdb, key) != 0) {
439
DEBUG(DEBUG_ERR,(__location__ " Failed to clear out trackingdb record\n"));
443
/* if we are revoking, we must defer all other calls until the revoke
446
if (header.flags & CTDB_REC_RO_REVOKING_READONLY) {
447
talloc_free(data.dptr);
448
ret = ctdb_ltdb_unlock(ctdb_db, key);
450
if (ctdb_add_revoke_deferred_call(ctdb, ctdb_db, key, (struct ctdb_req_header *)c, daemon_incoming_packet, client) != 0) {
451
ctdb_fatal(ctdb, "Failed to add deferred call for revoke child");
456
if ((header.dmaster == ctdb->pnn)
457
&& (!(c->flags & CTDB_WANT_READONLY))
458
&& (header.flags & (CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY)) ) {
459
header.flags |= CTDB_REC_RO_REVOKING_READONLY;
460
if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
461
ctdb_fatal(ctdb, "Failed to store record with HAVE_DELEGATIONS set");
463
ret = ctdb_ltdb_unlock(ctdb_db, key);
465
if (ctdb_start_revoke_ro_record(ctdb, ctdb_db, key, &header, data) != 0) {
466
ctdb_fatal(ctdb, "Failed to start record revoke");
468
talloc_free(data.dptr);
470
if (ctdb_add_revoke_deferred_call(ctdb, ctdb_db, key, (struct ctdb_req_header *)c, daemon_incoming_packet, client) != 0) {
471
ctdb_fatal(ctdb, "Failed to add deferred call for revoke child");
426
477
dstate = talloc(client, struct daemon_call_state);
427
478
if (dstate == NULL) {
428
479
ret = ctdb_ltdb_unlock(ctdb_db, key);