From fc73bc5c242b721c9f161dcf21c24691c729e167 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 13 Jul 2007 08:47:02 +1000 Subject: [PATCH] added --nosetsched option to ctdbd (This used to be ctdb commit 4cbbb88c1735c7d112e751e22da1c1c69e09bf4a) --- ctdb/config/functions | 1 + ctdb/include/ctdb_private.h | 1 + ctdb/server/ctdb_daemon.c | 6 ++++-- ctdb/server/ctdbd.c | 4 ++++ ctdb/server/eventscript.c | 4 +++- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ctdb/config/functions b/ctdb/config/functions index 7ca7327ab69..d7818e0c469 100644 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -43,6 +43,7 @@ ctdb_wait_command() { echo "ctdb daemon has died. Exiting wait for $service_name" exit 1 } + [ $all_ok -eq 1 ] || sleep 1 done echo "`/bin/date` Local service $service_name is up" } diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index bd64f978eb6..b584794f1c9 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -307,6 +307,7 @@ struct ctdb_context { struct ctdb_takeover takeover; struct ctdb_tcp_list *tcp_list; struct ctdb_client_ip *client_ip_list; + bool do_setsched; }; struct ctdb_db_context { diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 25779700750..ce84db3e685 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -644,8 +644,10 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork) } block_signal(SIGPIPE); - /* try to set us up as realtime */ - ctdb_set_realtime(true); + if (ctdb->do_setsched) { + /* try to set us up as realtime */ + ctdb_set_realtime(true); + } /* ensure the socket is deleted on exit of the daemon */ domain_socket_name = talloc_strdup(talloc_autofree_context(), ctdb->daemon.name); diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 2c4a23b6739..91e4d8f70b2 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -47,6 +47,7 @@ static struct { const char *logfile; const char *recovery_lock_file; const char *db_dir; + int no_setsched; } options = { .nlist = ETCDIR "/ctdb/nodes", .transport = "tcp", @@ -108,6 +109,7 @@ int main(int argc, const char *argv[]) { "transport", 0, POPT_ARG_STRING, &options.transport, 0, "protocol transport", NULL }, { "dbdir", 0, POPT_ARG_STRING, &options.db_dir, 0, "directory for the tdb files", NULL }, { "reclock", 0, POPT_ARG_STRING, &options.recovery_lock_file, 0, "location of recovery lock file", "filename" }, + { "nosetsched", 0, POPT_ARG_NONE, &options.no_setsched, 0, "disable setscheduler SCHED_FIFO call", NULL }, POPT_TABLEEND }; int opt, ret; @@ -224,6 +226,8 @@ int main(int argc, const char *argv[]) talloc_free(name); } + ctdb->do_setsched = !!options.no_setsched; + /* start the protocol running (as a child) */ return ctdb_start_daemon(ctdb, interactive?False:True); } diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index e23157056c8..fab9175ed29 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -166,7 +166,9 @@ int ctdb_event_script_callback(struct ctdb_context *ctdb, if (state->child == 0) { close(state->fd[0]); - ctdb_set_realtime(false); + if (ctdb->do_setsched) { + ctdb_set_realtime(false); + } set_close_on_exec(state->fd[1]); va_start(ap, fmt); ret = ctdb_event_script_v(ctdb, fmt, ap); -- 2.47.3