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

ReadOnly: Check the readonly flag instead of whether the tdb pointer is NULL or not

(This used to be ctdb commit 01314c2cb3a480917d6a632b83c39f0a48bba0e7)
This commit is contained in:
Ronnie Sahlberg 2011-08-23 10:41:52 +10:00
parent 0615ede49d
commit 9729d3e339
4 changed files with 5 additions and 2 deletions

View File

@ -507,7 +507,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
} }
/* Dont do READONLY if we dont have a tracking database */ /* Dont do READONLY if we dont have a tracking database */
if ((c->flags & CTDB_WANT_READONLY) && ctdb_db->rottdb == NULL) { if ((c->flags & CTDB_WANT_READONLY) && !ctdb_db->readonly) {
c->flags &= ~CTDB_WANT_READONLY; c->flags &= ~CTDB_WANT_READONLY;
} }

View File

@ -425,7 +425,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
} }
/* Dont do READONLY if we dont have a tracking database */ /* Dont do READONLY if we dont have a tracking database */
if ((c->flags & CTDB_WANT_READONLY) && ctdb_db->rottdb == NULL) { if ((c->flags & CTDB_WANT_READONLY) && !ctdb_db->readonly) {
c->flags &= ~CTDB_WANT_READONLY; c->flags &= ~CTDB_WANT_READONLY;
} }

View File

@ -937,6 +937,7 @@ again:
ropath = talloc_asprintf(ctdb_db, "%s.RO", ctdb_db->db_path); ropath = talloc_asprintf(ctdb_db, "%s.RO", ctdb_db->db_path);
if (ropath == NULL) { if (ropath == NULL) {
DEBUG(DEBUG_CRIT,("Failed to asprintf the tracking database\n")); DEBUG(DEBUG_CRIT,("Failed to asprintf the tracking database\n"));
ctdb_db->readonly = false;
talloc_free(ctdb_db); talloc_free(ctdb_db);
return -1; return -1;
} }
@ -946,6 +947,7 @@ again:
O_CREAT|O_RDWR, 0); O_CREAT|O_RDWR, 0);
if (ctdb_db->rottdb == NULL) { if (ctdb_db->rottdb == NULL) {
DEBUG(DEBUG_CRIT,("Failed to open/create the tracking database '%s'\n", ropath)); DEBUG(DEBUG_CRIT,("Failed to open/create the tracking database '%s'\n", ropath));
ctdb_db->readonly = false;
talloc_free(ctdb_db); talloc_free(ctdb_db);
return -1; return -1;
} }

View File

@ -497,6 +497,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
ctdb_db->readonly = false; ctdb_db->readonly = false;
tdb_close(ctdb_db->rottdb); tdb_close(ctdb_db->rottdb);
ctdb_db->rottdb = NULL; ctdb_db->rottdb = NULL;
ctdb_db->readonly = false;
} }
while (ctdb_db->revokechild_active != NULL) { while (ctdb_db->revokechild_active != NULL) {
talloc_free(ctdb_db->revokechild_active); talloc_free(ctdb_db->revokechild_active);