------------------------------------------------------------
revno: 427
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: tridge
timestamp: Sat 2007-06-02 08:46:49 +1000
message:
  disable realtime scheduler in event scripts
modified:
  common/ctdb_daemon.c           ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
  common/ctdb_util.c             ctdb_util.c-20061128065342-to93h6eejj5kon81-3
  include/ctdb_private.h         
ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
  takeover/system.c              system.c-20070525071636-a5n1ihghjtppy08r-3
=== modified file 'common/ctdb_daemon.c'
--- a/common/ctdb_daemon.c      2007-06-01 09:05:41 +0000
+++ b/common/ctdb_daemon.c      2007-06-01 22:46:49 +0000
@@ -766,7 +766,7 @@
        block_signal(SIGPIPE);
 
        /* try to set us up as realtime */
-       ctdb_set_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);

=== modified file 'common/ctdb_util.c'
--- a/common/ctdb_util.c        2007-05-31 03:50:53 +0000
+++ b/common/ctdb_util.c        2007-06-01 22:46:49 +0000
@@ -204,16 +204,20 @@
 /*
   if possible, make this task real time
  */
-void ctdb_set_realtime(void)
+void ctdb_set_realtime(bool enable)
 {
 #if HAVE_SCHED_SETSCHEDULER
        struct sched_param p;
        p.__sched_priority = 1;
 
-       if (sched_setscheduler(getpid(), SCHED_FIFO, &p) == -1) {
-               DEBUG(0,("Unable to set scheduler to SCHED_FIFO (%s)\n", 
strerror(errno)));
+       if (enable) {
+               if (sched_setscheduler(getpid(), SCHED_FIFO, &p) == -1) {
+                       DEBUG(0,("Unable to set scheduler to SCHED_FIFO 
(%s)\n", strerror(errno)));
+               } else {
+                       DEBUG(0,("Set scheduler to SCHED_FIFO\n"));
+               }
        } else {
-               DEBUG(0,("Set scheduler to SCHED_FIFO\n"));
+               sched_setscheduler(getpid(), SCHED_OTHER, &p);
        }
 #endif
 }

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h    2007-06-01 22:41:19 +0000
+++ b/include/ctdb_private.h    2007-06-01 22:46:49 +0000
@@ -928,7 +928,7 @@
                               uint32_t destnode, uint32_t db_id, uint64_t rsn);
 int ctdb_ctrl_delete_low_rsn(struct ctdb_context *ctdb, struct timeval 
timeout, 
                             uint32_t destnode, uint32_t db_id, uint64_t rsn);
-void ctdb_set_realtime(void);
+void ctdb_set_realtime(bool enable);
 int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, 
                                 struct ctdb_req_control *c,
                                 TDB_DATA indata, 

=== modified file 'takeover/system.c'
--- a/takeover/system.c 2007-06-01 13:25:33 +0000
+++ b/takeover/system.c 2007-06-01 22:46:49 +0000
@@ -385,6 +385,7 @@
 
        if (state->child == 0) {
                close(state->fd[0]);
+               ctdb_set_realtime(false);
                va_start(ap, fmt);
                ret = ctdb_event_script_v(ctdb, fmt, ap);
                va_end(ap);

Reply via email to