[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-310-gfaf3b15
Ronnie Sahlberg
sahlberg at samba.org
Wed Feb 16 19:45:21 MST 2011
The branch, 1.2 has been updated
via faf3b1542fd27b3ad32ac7b362ef39d8cb0b05ff (commit)
from bd556db13a84327f5a6d20cc22a5fc794980a6d1 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.2
- Log -----------------------------------------------------------------
commit faf3b1542fd27b3ad32ac7b362ef39d8cb0b05ff
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Feb 17 13:14:41 2011 +1100
Dont allow client processes to attach to databases while we are still in recovery mode.
The exception is the local recovery daemon which needs to be able to attach (==create) any missing databases during recovery. This process requires the use of the attach control.
-----------------------------------------------------------------------
Summary of changes:
include/ctdb_private.h | 2 +-
server/ctdb_control.c | 4 ++--
server/ctdb_ltdb_server.c | 20 ++++++++++++++++++--
3 files changed, 21 insertions(+), 5 deletions(-)
Changeset truncated at 500 lines:
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 4dcf9a5..5a1c15b 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -799,7 +799,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
void *private_data);
int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
- TDB_DATA *outdata, uint64_t tdb_flags, bool persistent);
+ TDB_DATA *outdata, uint64_t tdb_flags, bool persistent, uint32_t client_id);
int ctdb_daemon_set_call(struct ctdb_context *ctdb, uint32_t db_id,
ctdb_fn_t fn, int id);
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 90900c9..488b3e9 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -221,10 +221,10 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
}
case CTDB_CONTROL_DB_ATTACH:
- return ctdb_control_db_attach(ctdb, indata, outdata, srvid, false);
+ return ctdb_control_db_attach(ctdb, indata, outdata, srvid, false, client_id);
case CTDB_CONTROL_DB_ATTACH_PERSISTENT:
- return ctdb_control_db_attach(ctdb, indata, outdata, srvid, true);
+ return ctdb_control_db_attach(ctdb, indata, outdata, srvid, true, client_id);
case CTDB_CONTROL_SET_CALL: {
struct ctdb_control_set_call *sc =
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index ba2a9cb..8340c37 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -750,11 +750,27 @@ again:
*/
int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
TDB_DATA *outdata, uint64_t tdb_flags,
- bool persistent)
+ bool persistent, uint32_t client_id)
{
const char *db_name = (const char *)indata.dptr;
struct ctdb_db_context *db;
- struct ctdb_node *node = ctdb->nodes[ctdb->pnn];
+ struct ctdb_node *node;
+
+ /* dont allow any local clients to attach while we are in recovery mode
+ * except for the recovery daemon.
+ * allow all attach from the network since these are always from remote
+ * recovery daemons.
+ */
+ if (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE && client_id != 0) {
+ struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
+
+ if (client != NULL && client->pid != ctdb->recoverd_pid) {
+ DEBUG(DEBUG_ERR,("DB Attach to database %s refused for client with pid:%d since node is in recovery mode.\n", db_name, client->pid));
+ return -1;
+ }
+ }
+
+ node = ctdb->nodes[ctdb->pnn];
/* the client can optionally pass additional tdb flags, but we
only allow a subset of those on the database in ctdb. Note
--
CTDB repository
More information about the samba-cvs
mailing list