The branch, master has been updated
       via  7d9a876 ctdb-tests: Update local daemons tests to use 
CTDB_NOSETSCHED
       via  fc7e863 ctdb-scripts: Add new configuration variable CTDB_NOSETSCHED
       via  da91b70 ctdb-locking: Avoid real-time in lock helper if nosetsched 
option is set
       via  a21a4de ctdb-locking: Conditionally set real-time priority in lock 
helper
       via  2828b9a ctdb-daemon: Explicitly assign boolean values
       via  fd7bad4 ctdb-daemon: Do explicit check for integer values
      from  2d348bd pidl/ws: fix missing $name when generating MAPI dissector

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7d9a8760400c8135374634767691e7a5f7a3a639
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Mon Jun 20 14:24:07 2016 +1000

    ctdb-tests: Update local daemons tests to use CTDB_NOSETSCHED
    
    ... instead of --nosetsched command-line option.
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Michael Adam <ob...@samba.org>
    
    Autobuild-User(master): Michael Adam <ob...@samba.org>
    Autobuild-Date(master): Mon Jun 20 20:22:57 CEST 2016 on sn-devel-144

commit fc7e863ce7ee710159d030b05244879b17d7ceb2
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Mon Jun 20 14:21:18 2016 +1000

    ctdb-scripts: Add new configuration variable CTDB_NOSETSCHED
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit da91b707463193540294609d1ca7e043e34cd8ce
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Jun 17 18:35:18 2016 +1000

    ctdb-locking: Avoid real-time in lock helper if nosetsched option is set
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit a21a4de2cb13d4f762c7c1192d05edf785091910
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Jun 17 18:33:27 2016 +1000

    ctdb-locking: Conditionally set real-time priority in lock helper
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit 2828b9a8c6c067fe5cb9c5c56f2dd20f715682a5
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Jun 17 18:10:16 2016 +1000

    ctdb-daemon: Explicitly assign boolean values
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit fd7bad4229de93dccd82b1499c216fae2cf9ae5e
Author: Amitay Isaacs <ami...@gmail.com>
Date:   Fri Jun 17 18:09:37 2016 +1000

    ctdb-daemon: Do explicit check for integer values
    
    Signed-off-by: Amitay Isaacs <ami...@gmail.com>
    Reviewed-by: Michael Adam <ob...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/config/ctdbd_wrapper                    |  1 +
 ctdb/doc/ctdbd.conf.5.xml                    | 14 ++++++++
 ctdb/server/ctdb_lock.c                      |  8 +++++
 ctdb/server/ctdb_lock_helper.c               | 51 ++++++++++++++++++----------
 ctdb/server/ctdbd.c                          | 10 +++---
 ctdb/tests/simple/scripts/local_daemons.bash |  7 ++--
 6 files changed, 65 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index b6b983c..c007409 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -163,6 +163,7 @@ build_ctdb_options ()
     maybe_set "--start-as-stopped "      "$CTDB_START_AS_STOPPED"     "yes"
     maybe_set "--no-recmaster"           "$CTDB_CAPABILITY_RECMASTER" "no"
     maybe_set "--no-lmaster"             "$CTDB_CAPABILITY_LMASTER"   "no"
+    maybe_set "--nosetsched"             "$CTDB_NOSETSCHED"           "yes"
     maybe_set "--script-log-level"       "$CTDB_SCRIPT_LOG_LEVEL"
     maybe_set "--max-persistent-check-errors" 
"$CTDB_MAX_PERSISTENT_CHECK_ERRORS"
 }
diff --git a/ctdb/doc/ctdbd.conf.5.xml b/ctdb/doc/ctdbd.conf.5.xml
index f69f705..2ec76fd 100644
--- a/ctdb/doc/ctdbd.conf.5.xml
+++ b/ctdb/doc/ctdbd.conf.5.xml
@@ -314,6 +314,20 @@
       </varlistentry>
 
       <varlistentry>
+       <term>CTDB_NOSETSCHED=yes|no</term>
+       <listitem>
+         <para>
+           Defaults to no.  Corresponds to <option>--nosetsched</option>.
+         </para>
+         <para>
+           Usually CTDB runs with real-time priority.  If you are running
+           CTDB on a platform that does not support real-time priority,
+           you can set this.
+         </para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
        <term>CTDB_NOTIFY_SCRIPT=<parameter>FILENAME</parameter></term>
        <listitem>
          <para>
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c
index 7962e94..8f3a18d 100644
--- a/ctdb/server/ctdb_lock.c
+++ b/ctdb/server/ctdb_lock.c
@@ -845,6 +845,14 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
                return;
        }
 
+       if (! ctdb->do_setsched) {
+               ret = setenv("CTDB_NOSETSCHED", "1", 1);
+               if (ret != 0) {
+                       DEBUG(DEBUG_WARNING,
+                             ("Failed to set CTDB_NOSETSCHED variable\n"));
+               }
+       }
+
        /* Create arguments for lock helper */
        if (!lock_helper_args(tmp_ctx, lock_ctx, lock_ctx->fd[1],
                              &argc, &args)) {
diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c
index cdcbb4a..e41d230 100644
--- a/ctdb/server/ctdb_lock_helper.c
+++ b/ctdb/server/ctdb_lock_helper.c
@@ -28,6 +28,35 @@
 #include "common/system.h"
 
 static char *progname = NULL;
+static bool realtime = true;
+
+static void set_priority(void)
+{
+       const char *ptr;
+
+       ptr = getenv("CTDB_NOSETSCHED");
+       if (ptr != NULL) {
+               realtime = false;
+       }
+
+       if (! realtime) {
+               return;
+       }
+
+       realtime = set_scheduler();
+       if (! realtime) {
+               fprintf(stderr,
+                       "%s: Unable to set real-time scheduler priority\n",
+                       progname);
+       }
+}
+
+static void reset_priority(void)
+{
+       if (realtime) {
+               reset_scheduler();
+       }
+}
 
 static void send_result(int fd, char result)
 {
@@ -69,7 +98,6 @@ static int lock_record(const char *dbpath, const char 
*dbflags, const char *dbke
        TDB_DATA key;
        struct tdb_context *tdb;
        int tdb_flags;
-       bool realtime;
 
        /* No error checking since CTDB always passes sane values */
        tdb_flags = strtol(dbflags, NULL, 0);
@@ -88,11 +116,7 @@ static int lock_record(const char *dbpath, const char 
*dbflags, const char *dbke
                return 1;
        }
 
-       realtime = set_scheduler();
-       if (! realtime) {
-               fprintf(stderr, "%s: Unable to set real-time scheduler 
priority\n",
-                       progname);
-       }
+       set_priority();
 
        if (tdb_chainlock(tdb, key) < 0) {
                fprintf(stderr, "%s: Error getting record lock (%s)\n",
@@ -100,9 +124,7 @@ static int lock_record(const char *dbpath, const char 
*dbflags, const char *dbke
                return 1;
        }
 
-       if (realtime) {
-               reset_scheduler();
-       }
+       reset_priority();
 
        return 0;
 
@@ -113,7 +135,6 @@ static int lock_db(const char *dbpath, const char *dbflags)
 {
        struct tdb_context *tdb;
        int tdb_flags;
-       bool realtime;
 
        /* No error checking since CTDB always passes sane values */
        tdb_flags = strtol(dbflags, NULL, 0);
@@ -124,11 +145,7 @@ static int lock_db(const char *dbpath, const char *dbflags)
                return 1;
        }
 
-       realtime = set_scheduler();
-       if (! realtime) {
-               fprintf(stderr, "%s: Unable to set real-time scheduler 
priority\n",
-                       progname);
-       }
+       set_priority();
 
        if (tdb_lockall(tdb) < 0) {
                fprintf(stderr, "%s: Error getting db lock (%s)\n",
@@ -136,9 +153,7 @@ static int lock_db(const char *dbpath, const char *dbflags)
                return 1;
        }
 
-       if (realtime) {
-               reset_scheduler();
-       }
+       reset_priority();
 
        return 0;
 }
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index a075c49..420add4 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -293,15 +293,15 @@ int main(int argc, const char *argv[])
                }
        }
 
-       ctdb->valgrinding = options.valgrinding;
-       if (options.valgrinding || options.nosetsched) {
-               ctdb->do_setsched = 0;
+       ctdb->valgrinding = (options.valgrinding == 1);
+       if ((options.valgrinding == 1) || (options.nosetsched == 1)) {
+               ctdb->do_setsched = false;
        } else {
-               ctdb->do_setsched = 1;
+               ctdb->do_setsched = true;
        }
 
        ctdb->public_addresses_file = options.public_address_list;
-       ctdb->do_checkpublicip = !options.no_publicipcheck;
+       ctdb->do_checkpublicip = (options.no_publicipcheck == 0);
 
        if (options.max_persistent_check_errors < 0) {
                ctdb->max_persistent_check_errors = 0xFFFFFFFFFFFFFFFFLL;
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash 
b/ctdb/tests/simple/scripts/local_daemons.bash
index fc0e47d..765655e 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -30,7 +30,7 @@ daemons_stop ()
     echo "Sleeping for a while..."
     sleep_for 1
 
-    local pat="ctdbd --sloppy-start --nopublicipcheck --nosetsched"
+    local pat="ctdbd --sloppy-start --nopublicipcheck"
     if pgrep -f "$pat" >/dev/null ; then
        echo "Killing remaining daemons..."
        pkill -f "$pat"
@@ -129,6 +129,7 @@ CTDB_DBDIR_PERSISTENT="${TEST_VAR_DIR}/test.db/persistent"
 CTDB_DBDIR_STATE="${TEST_VAR_DIR}/test.db/state"
 CTDB_PUBLIC_ADDRESSES="${public_addresses}"
 CTDB_SOCKET="${TEST_VAR_DIR}/sock.$pnn"
+CTDB_NOSETSCHED=yes
 EOF
 
     # Override from the environment.  This would be easier if env was
@@ -138,8 +139,8 @@ EOF
     sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@' >>"$conf"
 
     # We'll use "pkill -f" to kill the daemons with
-    # "ctdbd --sloppy-start --nopublicipcheck --nosetsched" as context.
-    CTDBD="${VALGRIND} ctdbd --sloppy-start --nopublicipcheck --nosetsched" \
+    # "ctdbd --sloppy-start --nopublicipcheck" as context.
+    CTDBD="${VALGRIND} ctdbd --sloppy-start --nopublicipcheck" \
         CTDBD_CONF="$conf" \
         ctdbd_wrapper "$pidfile" start
 }


-- 
Samba Shared Repository

Reply via email to