[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Fri Mar 9 11:25:04 UTC 2018


The branch, master has been updated
       via  9e954bc ctdb-tests: Don't use nc -d or -w options
       via  bd66445 Revert "ctdb-doc: Fix monitoring bug in example NFS Ganesha call-out"
       via  98bd5b6 ctdb-tests: Depend on setup_ctdb_base() to install events.d/
       via  8559848 ctdb-tests: Make fake ssh script set CTDB_BASE
       via  a7a5216 ctdb-tests: Use setup_ctdb_base() for simple tests
       via  caf6b1c ctdb-tests: Reindent setup_ctdb() function
       via  670668f ctdb-tests: Clean up nodes and public address file setup
       via  2b09dc9 ctdb-tests: Use SIMPLE_TESTS_VAR_DIR for data for local daemons tests
       via  ee9051b ctdb-tests: New directory for simple test state
       via  2b38b82 ctdb-tests: Use setup_ctdb_base() for onnode unit tests
       via  258e1e0 ctdb-tests: Use setup_ctdb_base() for eventscript unit tests
       via  b1c87b2 ctdb-tests: Factor out setup of fake CTDB_BASE
       via  52cdb03 ctdb-scripts: Drop PID file argument from wrapper
       via  b0d892b ctdb-daemon: CTDB_PIDFILE environment variable overrides default
       via  6a54738 ctdb-daemon: Provide default location for ctdbd PID file
       via  a2c6c98 ctdb-scripts: Drop init script PID directory backward compatibility
       via  0e5d537 ctdb-scripts: Don't create directory for PID file
       via  9fe85f4 ctdb-packaging: Package up relevant /var subdirectories
       via  bf250fe ctdb-scripts: Drop unnecessary complexity from wrapper
       via  a821306 ctdb-scripts: Drop broken wrapper code that uses PID
       via  914c877 ctdb-tests: Rework simple tests daemon start/stop
       via  5a99835 ctdb-packaging: Use RPM's local state directory
       via  b416ed7 ctdb-scripts: Simplify the names of NFS fail counter files
       via  bcadab7 ctdb-scripts: Move failure counters to the service state directory
       via  e6aae12 ctdb-scripts: Move the reconfigure flag to the script state directory
       via  ef0962a ctdb-scripts: Drop unused function ctdb_setup_service_state_dir()
       via  eed0e3f ctdb-scripts: Use ctdb_setup_state_dir()
       via  fac6d23 ctdb-scripts: Factor out function ctdb_setup_state_dir()
       via  2089961 ctdb-scripts: Move script state to its own directory
       via  ba71230 ctdb-tools: Fix documentation for ctdb ping command
       via  8053f65 ctdb-tools: Event script commands cannot be run without daemon
       via  53c550d ctdb-common: Drop unused function ctdb_sys_find_ifname()
       via  efe3a72 ctdb-tools: Drop ipiface command from ctdb tool
       via  35cc786 ctdb-tools: Wait for ctdb daemon to go away in shutdown
       via  376e979 ctdb-client: Client code should never free the client context
       via  f70164d ctdb-ib: Avoid fall through case statements
      from  f0bebcc ldb_tdb: Remove unnecessary call to tdb_get_seqnum

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


- Log -----------------------------------------------------------------
commit 9e954bcbf43d67a18ee55f84cda0b09028f96b92
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 8 11:49:56 2018 +1100

    ctdb-tests: Don't use nc -d or -w options
    
    nmap-ncat is used in some distributions to replace netcat.  It has a
    different meaning for these options.
    
    We can get the same effect as the current combination of -d and -w by
    piping a sleep process to nc.  Subsequent use of $! works because it
    gets the last process in pipeline.
    
    Note that redirecting from /dev/null doesn't work with some versions
    of nc.  They just exit when they get EOF.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Fri Mar  9 12:24:13 CET 2018 on sn-devel-144

commit bd66445eddd1273da034df703f6aba7864e8e542
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 31 17:07:46 2018 +1100

    Revert "ctdb-doc: Fix monitoring bug in example NFS Ganesha call-out"
    
    The check action should be there.  It is used by 20.nfs_ganesha.check.
    
    This reverts commit 4fa9026bbd9f67348d3203e0205c59ff4fb51d2d.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 98bd5b6a41f656802d075c50be7c5b766333080c
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 16 14:27:39 2018 +1100

    ctdb-tests: Depend on setup_ctdb_base() to install events.d/
    
    This directory is only used by simple tests when running against local
    daemons.  Moving it to simple/etc-ctdb/events.d/ means that it is
    automatically copied by setup_ctdb_base().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 85598480fbb3a994b853bcd44438d6da85d8f4f3
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Mar 2 20:36:39 2018 +1100

    ctdb-tests: Make fake ssh script set CTDB_BASE
    
    The local daemons code puts the socket in the CTDB_BASE directory.
    This means CTDB_NODES_SOCKETS can be replaced by CTDB_BASES, a list of
    base directories.  The fake ssh script can first determine the correct
    CTDB_BASE directory and then use it to set CTDB_SOCKET and
    CTDB_PIDFILE.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a7a5216968086cef406700af9192d3e37313158c
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 7 18:38:04 2018 +1100

    ctdb-tests: Use setup_ctdb_base() for simple tests
    
    The comment in local.bash is incorrect.  CTDB_BASE will never be set
    here because this script is not run under onnode.  Instead, this where
    CTDB_BASE needs to be set when running against a real cluster.
    
    For local daemons, the check for CTDB_BASE being inconsistent with
    node_dir is temporary.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit caf6b1c684f3df4b4fc67a3cf08ea66025b21bd3
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 14:50:59 2018 +1100

    ctdb-tests: Reindent setup_ctdb() function
    
    This could have been done earlier but previous movement of lines out
    to new functions has made the job easier.
    
    Best viewed with show/diff -w.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 670668f4c1598cffe5db51e53f81a0fff389495b
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Feb 22 20:24:20 2018 +1100

    ctdb-tests: Clean up nodes and public address file setup
    
    Untangle a single loop into two separate, clear functions.  Create a
    separate, empty file for the node with no public IPs instead of
    pointing the configuration at /dev/null.
    
    Leave the indentation in setup_ctdb() in the old style to make this
    commit comprehensible.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2b09dc9d8e130d4a5b3e8b7df61507ba1da7c6e8
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Feb 22 19:56:08 2018 +1100

    ctdb-tests: Use SIMPLE_TESTS_VAR_DIR for data for local daemons tests
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ee9051b7f7884a3beead841ef2a7684d8ab48784
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 1 15:39:44 2018 +1100

    ctdb-tests: New directory for simple test state
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2b38b82303e077c388897362b59b8bbdb30dd849
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 7 14:09:45 2018 +1100

    ctdb-tests: Use setup_ctdb_base() for onnode unit tests
    
    The nodes file is now in the CTDB_BASE directory so no CTDB_NODES_FILE
    variable is needed.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 258e1e04ae43a50ffd16e17153c8b0a20b21c481
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 7 11:58:51 2018 +1100

    ctdb-tests: Use setup_ctdb_base() for eventscript unit tests
    
    There is currently a directory of symlinks that are copied during test
    setup.  These symlinks are updated during installation so they point
    to the right place when copied.
    
    Instead, use setup_ctdb_base() during test setup.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit b1c87b26090fd357da1f0bce3ede025d03ffb96a
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 7 13:56:34 2018 +1100

    ctdb-tests: Factor out setup of fake CTDB_BASE
    
    Several test suites need the CTDB_BASE directory to contain a subset
    of the regular contents of that subdirectory.  In some cases there are
    symbolic links in the test directory (or a subdirectory) and these
    symbolic links need to be fixed at installation time.
    
    Instead, add new function setup_ctdb_base() to set CTDB_BASE, create
    the directory and populate it as specified.  This relies on
    script_install_paths.sh so it can copy the specified targets.  It also
    copies any files from the test directory's etc-ctdb/ subdirectory.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 52cdb03c65504534043311a5afbc43a51ba672af
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 21:02:40 2018 +1100

    ctdb-scripts: Drop PID file argument from wrapper
    
    Use the default compile-time PID file.
    
    Use a CTDB_PIDFILE environment variable when testing.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit b0d892b9ad7491ae6d3c897b6a224a0e697b0c30
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 21:19:30 2018 +1100

    ctdb-daemon: CTDB_PIDFILE environment variable overrides default
    
    Use environment variables for test-only options.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 6a5473854f28b6fbe6e0c269fca752c7e7fff2dc
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 7 12:11:53 2018 +1100

    ctdb-daemon: Provide default location for ctdbd PID file
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a2c6c98302ea5630a18c4aa296a0a57b303e7c88
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 21:01:17 2018 +1100

    ctdb-scripts: Drop init script PID directory backward compatibility
    
    This tries to be backward compatible with very old versions of CTDB,
    so don't bother.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 0e5d537323bfb7aabbd6ba6919d30c8fdce003b7
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 20:40:08 2018 +1100

    ctdb-scripts: Don't create directory for PID file
    
    This is already created by installation and/or packaging.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 9fe85f4cc935313af6b65f80c7fbfc9d7ebc3916
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 20:38:51 2018 +1100

    ctdb-packaging: Package up relevant /var subdirectories
    
    They're already created at installation time.  This way they don't
    need to be created at startup.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit bf250fe5957581adda60d2f9ae2014dd556e92b4
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 20:26:08 2018 +1100

    ctdb-scripts: Drop unnecessary complexity from wrapper
    
    All of this logic was necessary when ctdbd did poor PID file and
    socket handling.  Those things are now solid, so remove this
    unnecessary logic.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a821306ec33076afc61195da2c022fe6f5f05a5a
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 20:16:00 2018 +1100

    ctdb-scripts: Drop broken wrapper code that uses PID
    
    The code has been broken since commit
    4b652c1527afe7eff4075c95946abfa114d74015.
    
    If ctdbd isn't all the way up in time just make a basic attempt to
    shut it down.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 914c877860ecc19f4375eab031fdd2a33bd6ded6
Author: Martin Schwenke <martin at meltin.net>
Date:   Sat Mar 3 20:04:17 2018 +1100

    ctdb-tests: Rework simple tests daemon start/stop
    
    Separate stopping and starting of daemons during restart
    
    This allows actions to be taken after stopping and allows the init
    testcase to be clearer about what it is doing.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5a99835c386d34d995c82aa491fae87995ead7db
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 5 20:34:48 2018 +1100

    ctdb-packaging: Use RPM's local state directory
    
    Instead of fixed /var.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit b416ed72d43242432a0a151ec5cb5c3509e33a43
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 6 13:56:05 2018 +1100

    ctdb-scripts: Simplify the names of NFS fail counter files
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit bcadab714987b375b3ab4379bef23514e12ad24f
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 6 13:51:23 2018 +1100

    ctdb-scripts: Move failure counters to the service state directory
    
    Scripts that use these counters must call ctdb_setup_state_dir().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit e6aae12ba2b9218d8ca89b3b3c73905f9dba22b9
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 6 13:50:47 2018 +1100

    ctdb-scripts: Move the reconfigure flag to the script state directory
    
    Scripts that use these functions must call ctdb_setup_state_dir().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ef0962acf0d214ec6ef50d3195494773f4f14107
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 7 11:43:18 2018 +1100

    ctdb-scripts: Drop unused function ctdb_setup_service_state_dir()
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit eed0e3f6d7a4403a14a659b308267e04aee67623
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 7 11:12:29 2018 +1100

    ctdb-scripts: Use ctdb_setup_state_dir()
    
    Replace all uses of ctdb_setup_service_state_dir() by
    ctdb_setup_state_dir().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit fac6d23d2758428cefdabb8bb07bd83cd76deace
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 6 13:49:46 2018 +1100

    ctdb-scripts: Factor out function ctdb_setup_state_dir()
    
    This allows state directories for scripts other than services.
    ctdb_setup_state_dir() takes 2 mandatory arguments.
    
    Unlike ctdb_setup_service_state_dir(), this does not print the
    directory name but sets a global variable.  The intention is to go
    back to a more sensible style of usage.
    
    This will require a shellcheck directive before the first use, such
    as:
    
      # Set by ctdb_setup_state_dir
      # shellcheck disable=SC2154
      foo="${script_state_dir}/bar"
    
    An alternative would be something like the following, which tricks
    shellcheck into believing the variable is set:
    
      ctdb_setup_state_dir "service" "foo"
      # Shellcheck
      script_state_dir="$script_state_dir"
    
    However, this is more cryptic.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 208996134632cfa99654238a089849fc19ddca52
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 6 11:42:26 2018 +1100

    ctdb-scripts: Move script state to its own directory
    
    Don't use the same directory as temporary databases.
    
    Make associated test consistent.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit ba7123021a3c6a707480614e621d1a1c7082ed9f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 8 14:24:27 2018 +1100

    ctdb-tools: Fix documentation for ctdb ping command
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 8053f652cd987b3911f8871bcff2f4146527d27e
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 8 14:23:38 2018 +1100

    ctdb-tools: Event script commands cannot be run without daemon
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 53c550d894de660f20336c78bee42db7a52024d0
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 8 14:20:43 2018 +1100

    ctdb-common: Drop unused function ctdb_sys_find_ifname()
    
    The ioctl SIOCGIFCONF does not return IPv6 addresses, so this function
    does not work for IPv6 addresses.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit efe3a7279ee43d1bd774b7ca22ec14dc233b9c97
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 8 14:19:19 2018 +1100

    ctdb-tools: Drop ipiface command from ctdb tool
    
    This command is not used anywhere and also does not work for IPv6
    addresses.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 35cc786d1083cba944b91775982c6a403fe8be20
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 6 14:28:43 2018 +1100

    ctdb-tools: Wait for ctdb daemon to go away in shutdown
    
    This can only be done on the local node.  For remote node, exit as
    soon as the control returns.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 376e9794e2d19e8d17b0bdde36ce8a1a205986c6
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 8 11:35:55 2018 +1100

    ctdb-client: Client code should never free the client context
    
    This should never have been done.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit f70164d65958956c689f0e2ee3bdd0c7634c146f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Sun Mar 4 02:09:33 2018 +1100

    ctdb-ib: Avoid fall through case statements
    
    This is clearly unintended.  Noticed with gcc 7.3.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 ctdb/client/client_connect.c                       |   1 -
 ctdb/common/system.h                               |   1 -
 ctdb/common/system_common.c                        |  84 ---------
 ctdb/config/ctdb.init                              |  43 ++---
 ctdb/config/ctdb.service                           |   4 +-
 ctdb/config/ctdbd_wrapper                          | 109 ++---------
 ctdb/config/events.d/01.reclock                    |   2 +
 ctdb/config/events.d/05.system                     |   8 +-
 ctdb/config/events.d/06.nfs                        |   9 +-
 ctdb/config/events.d/11.natgw                      |  14 +-
 ctdb/config/events.d/13.per_ip_routing             |  10 +-
 ctdb/config/events.d/20.multipathd                 |   8 +-
 ctdb/config/events.d/40.vsftpd                     |   2 +
 ctdb/config/events.d/41.httpd                      |   2 +
 ctdb/config/events.d/50.samba                      |   8 +-
 ctdb/config/events.d/60.nfs                        |  17 +-
 ctdb/config/functions                              |  45 +++--
 ctdb/config/statd-callout                          |  10 +-
 ctdb/doc/ctdb.1.xml                                |   2 +-
 ctdb/doc/examples/nfs-ganesha-callout              |   6 +-
 ctdb/ib/ibwrapper.c                                |   3 +
 ctdb/packaging/RPM/ctdb.spec.in                    |   8 +-
 ctdb/server/ctdbd.c                                |   6 +
 ctdb/tests/complex/30_nfs_tickle_killtcp.sh        |   2 +-
 ctdb/tests/complex/31_nfs_tickle.sh                |   2 +-
 ctdb/tests/complex/32_cifs_tickle.sh               |   2 +-
 ctdb/tests/complex/34_nfs_tickle_restart.sh        |   2 +-
 ctdb/tests/complex/36_smb_reset_server.sh          |   2 +-
 ctdb/tests/complex/37_nfs_reset_server.sh          |   2 +-
 ctdb/tests/eventscripts/etc-ctdb/events.d          |   1 -
 ctdb/tests/eventscripts/etc-ctdb/functions         |   1 -
 ctdb/tests/eventscripts/etc-ctdb/nfs-checks.d      |   1 -
 .../eventscripts/etc-ctdb/nfs-linux-kernel-callout |   1 -
 ctdb/tests/eventscripts/etc-ctdb/statd-callout     |   1 -
 ctdb/tests/eventscripts/scripts/local.sh           |  47 ++---
 ctdb/tests/onnode/{ => etc-ctdb}/nodes             |   0
 ctdb/tests/onnode/functions                        |   1 -
 ctdb/tests/onnode/scripts/local.sh                 |  20 +-
 ctdb/tests/scripts/common.sh                       |  35 ++++
 ctdb/tests/scripts/integration.bash                |  31 ++--
 ctdb/tests/simple/00_ctdb_init.sh                  |   5 +-
 ctdb/tests/{ => simple/etc-ctdb}/events.d/00.test  |   0
 ctdb/tests/simple/functions                        |   1 -
 ctdb/tests/simple/scripts/local.bash               |  18 +-
 ctdb/tests/simple/scripts/local_daemons.bash       | 206 ++++++++++++---------
 ctdb/tests/simple/scripts/ssh_local_daemons.sh     |  16 +-
 ctdb/tools/ctdb.c                                  |  54 +++---
 ctdb/wscript                                       |  26 ---
 48 files changed, 372 insertions(+), 507 deletions(-)
 delete mode 120000 ctdb/tests/eventscripts/etc-ctdb/events.d
 delete mode 120000 ctdb/tests/eventscripts/etc-ctdb/functions
 delete mode 120000 ctdb/tests/eventscripts/etc-ctdb/nfs-checks.d
 delete mode 120000 ctdb/tests/eventscripts/etc-ctdb/nfs-linux-kernel-callout
 delete mode 120000 ctdb/tests/eventscripts/etc-ctdb/statd-callout
 rename ctdb/tests/onnode/{ => etc-ctdb}/nodes (100%)
 delete mode 120000 ctdb/tests/onnode/functions
 rename ctdb/tests/{ => simple/etc-ctdb}/events.d/00.test (100%)
 delete mode 120000 ctdb/tests/simple/functions


Changeset truncated at 500 lines:

diff --git a/ctdb/client/client_connect.c b/ctdb/client/client_connect.c
index 89a602d..1e4157e 100644
--- a/ctdb/client/client_connect.c
+++ b/ctdb/client/client_connect.c
@@ -297,7 +297,6 @@ static void client_dead_handler(void *private_data)
 	ctdb_client_callback_func_t callback = client->callback;
 	void *callback_data = client->private_data;
 
-	talloc_free(client);
 	if (callback != NULL) {
 		callback(callback_data);
 		return;
diff --git a/ctdb/common/system.h b/ctdb/common/system.h
index e6f65b5..5865a1a 100644
--- a/ctdb/common/system.h
+++ b/ctdb/common/system.h
@@ -26,7 +26,6 @@
 
 uint32_t uint16_checksum(uint16_t *data, size_t n);
 bool ctdb_sys_have_ip(ctdb_sock_addr *_addr);
-char *ctdb_sys_find_ifname(ctdb_sock_addr *addr);
 
 /* From system_<os>.c */
 
diff --git a/ctdb/common/system_common.c b/ctdb/common/system_common.c
index a80189c..49afbf3 100644
--- a/ctdb/common/system_common.c
+++ b/ctdb/common/system_common.c
@@ -80,87 +80,3 @@ bool ctdb_sys_have_ip(ctdb_sock_addr *_addr)
 	close(s);
 	return ret == 0;
 }
-
-
-/* find which interface an ip address is currently assigned to */
-char *ctdb_sys_find_ifname(ctdb_sock_addr *addr)
-{
-	int s;
-	int size;
-	struct ifconf ifc;
-	char *ptr;
-
-	s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
-	if (s == -1) {
-		DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
-			 strerror(errno)));
-		return NULL;
-	}
-
-
-	size = sizeof(struct ifreq);
-	ifc.ifc_buf = NULL;
-	ifc.ifc_len = size;
-
-	while(ifc.ifc_len > (size - sizeof(struct ifreq))) {
-		size *= 2;
-
-		free(ifc.ifc_buf);	
-		ifc.ifc_len = size;
-		ifc.ifc_buf = malloc(size);
-		memset(ifc.ifc_buf, 0, size);
-		if (ioctl(s, SIOCGIFCONF, (caddr_t)&ifc) < 0) {
-			DEBUG(DEBUG_CRIT,("Failed to read ifc buffer from socket\n"));
-			free(ifc.ifc_buf);	
-			close(s);
-			return NULL;
-		}
-	}
-
-	for (ptr =(char *)ifc.ifc_buf; ptr < ((char *)ifc.ifc_buf) + ifc.ifc_len; ) {
-		char *ifname;
-		struct ifreq *ifr;
-
-		ifr = (struct ifreq *)ptr;
-
-#ifdef HAVE_SOCKADDR_LEN
-		if (ifr->ifr_addr.sa_len > sizeof(struct sockaddr)) {
-			ptr += sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len;
-		} else {
-			ptr += sizeof(ifr->ifr_name) + sizeof(struct sockaddr);
-		}
-#else
-		ptr += sizeof(struct ifreq);
-#endif
-
-		if (ifr->ifr_addr.sa_family != addr->sa.sa_family) {
-			continue;
-		}
-
-		switch (addr->sa.sa_family) {
-		case AF_INET:
-
-
-			if (memcmp(&addr->ip.sin_addr, &((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr, sizeof(addr->ip.sin_addr))) {
-				continue;
-			}
-			break;
-		case AF_INET6:
-			if (memcmp(&addr->ip6.sin6_addr, &((struct sockaddr_in6 *)&ifr->ifr_addr)->sin6_addr, sizeof(addr->ip6.sin6_addr))) {
-				continue;
-			}
-			break;
-		}
-
-		ifname = strdup(ifr->ifr_name);
-		free(ifc.ifc_buf);	
-		close(s);
-		return ifname;
-	}
-
-
-	free(ifc.ifc_buf);	
-	close(s);
-
-	return NULL;
-}
diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init
index b9c0a6d..e55c4e6 100755
--- a/ctdb/config/ctdb.init
+++ b/ctdb/config/ctdb.init
@@ -65,12 +65,12 @@ start()
     case "$CTDB_INIT_STYLE" in
 	suse)
 	    startproc \
-		"$ctdbd_wrapper" "$pidfile" "start"
+		"$ctdbd_wrapper" "start"
 	    rc_status -v
 	    ;;
 	redhat)
 	    daemon --pidfile "$pidfile" \
-		"$ctdbd_wrapper" "$pidfile" "start"
+		"$ctdbd_wrapper" "start"
 	    RETVAL=$?
 	    echo
 	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ctdb || RETVAL=1
@@ -78,7 +78,7 @@ start()
 	    ;;
 	debian)
 	    eval start-stop-daemon --start --quiet --background --exec \
-		"$ctdbd_wrapper" "$pidfile" "start"
+		"$ctdbd_wrapper" "start"
 	    ;;
     esac
 }
@@ -89,11 +89,11 @@ stop()
 
     case "$CTDB_INIT_STYLE" in
 	suse)
-	    "$ctdbd_wrapper" "$pidfile" "stop"
+	    "$ctdbd_wrapper" "stop"
 	    rc_status -v
 	    ;;
 	redhat)
-	    "$ctdbd_wrapper" "$pidfile" "stop"
+	    "$ctdbd_wrapper" "stop"
 	    RETVAL=$?
 	    # Common idiom in Red Hat init scripts - success() always
 	    # succeeds so this does behave like if-then-else
@@ -104,7 +104,7 @@ stop()
 	    return $RETVAL
 	    ;;
 	debian)
-	    "$ctdbd_wrapper" "$pidfile" "stop"
+	    "$ctdbd_wrapper" "stop"
 	    log_end_msg $?
 	    ;;
     esac
@@ -118,31 +118,18 @@ restart()
 
 check_status ()
 {
-    # Backward compatibility.  When we arrange to pass --pidfile to
-    # ctdbd we also create the directory that will contain it.  If
-    # that directory is missing then we don't use the pidfile to check
-    # status.  Note that this probably won't work if
-    # $CTDB_VALGRIND="yes" but this doesn't need full backward
-    # compatibility because it is a debug option.
-    _d=$(dirname "$pidfile")
-    if [ -d "$_d" ] ; then
-	_pf_opt="-p $pidfile"
-    else
-	_pf_opt=""
-    fi
-
-    case "$CTDB_INIT_STYLE" in
+	case "$CTDB_INIT_STYLE" in
 	suse)
-	    checkproc $_pf_opt "$ctdbd"
-	    rc_status -v
-	    ;;
+		checkproc -p "$pidfile" "$ctdbd"
+		rc_status -v
+		;;
 	redhat)
-	    status $_pf_opt -l "ctdb" "$ctdbd"
-	    ;;
+		status -p "$pidfile" -l "ctdb" "$ctdbd"
+		;;
 	debian)
-	    status_of_proc $_pf_opt "$ctdbd" "ctdb"
-	    ;;
-    esac
+		status_of_proc -p "$pidfile" "$ctdbd" "ctdb"
+		;;
+	esac
 }
 
 ############################################################
diff --git a/ctdb/config/ctdb.service b/ctdb/config/ctdb.service
index 189f2f4..627803c 100644
--- a/ctdb/config/ctdb.service
+++ b/ctdb/config/ctdb.service
@@ -7,8 +7,8 @@ After=network-online.target time-sync.target
 Type=forking
 LimitCORE=infinity
 PIDFile=/run/ctdb/ctdbd.pid
-ExecStart=/usr/sbin/ctdbd_wrapper /run/ctdb/ctdbd.pid start
-ExecStop=/usr/sbin/ctdbd_wrapper /run/ctdb/ctdbd.pid stop
+ExecStart=/usr/sbin/ctdbd_wrapper start
+ExecStop=/usr/sbin/ctdbd_wrapper stop
 KillMode=control-group
 Restart=no
 
diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index a958786..d56fbef 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -4,14 +4,13 @@
 
 usage ()
 {
-    echo "usage: ctdbd_wrapper <pidfile> { start | stop }"
+    echo "usage: ctdbd_wrapper { start | stop }"
     exit 1
 }
 
-[ $# -eq 2 ] || usage
+[ $# -eq 1 ] || usage
 
-pidfile="$1"
-action="$2"
+action="$1"
 
 ############################################################
 
@@ -28,32 +27,6 @@ ctdbd="${CTDBD:-/usr/local/sbin/ctdbd}"
 
 ############################################################
 
-# ctdbd_is_running()
-
-# Check if ctdbd is running.  ctdbd is only considered to running if
-# the PID in the PID file is active and is called "ctdbd".  Return
-# true if this is the case.  Print the PID regardless, since it can be
-# used to kill stale processes in the session.
-
-ctdbd_is_running ()
-{
-	if read _pid 2>/dev/null <"$pidfile" ; then
-		echo "$_pid"
-
-		# This could be optimised with ps options -q and -h.
-		# However, -q is not generally available because it is
-		# fairly new and -h is not in some older distros.  The
-		# options below are portable.
-		_cmd=$(ps -p "$_pid" -o comm | tail -n +2)
-		[ "$_cmd" = "ctdbd" ]
-	else
-		# Missing/empty PID file
-		return 1
-	fi
-}
-
-############################################################
-
 # If necessary, mount volatile database directory on tmpfs
 dbdir_tmpfs_start ()
 {
@@ -120,9 +93,8 @@ build_ctdb_options ()
     fi
     maybe_set "--reclock"                "$CTDB_RECOVERY_LOCK"
 
-    maybe_set "--pidfile"                "$pidfile"
-
     # build up ctdb_options variable from optional parameters
+    maybe_set "--pidfile"                "$CTDB_PIDFILE"
     maybe_set "--logging"                "$CTDB_LOGGING"
     maybe_set "--nlist"                  "$CTDB_NODES"
     maybe_set "--socket"                 "$CTDB_SOCKET"
@@ -151,28 +123,10 @@ export_debug_variables ()
     [ -n "$CTDB_DEBUG_LOCKS" ] && export CTDB_DEBUG_LOCKS
 }
 
-kill_ctdbd ()
-{
-    _session="$1"
-
-    if [ -n "$_session" ] ; then
-	pkill -9 -s "$_session" 2>/dev/null
-    fi
-}
-
 ############################################################
 
 start()
 {
-    if _session=$(ctdbd_is_running) ; then
-	echo "CTDB is already running"
-	return 0
-    fi
-
-    # About to start new $ctdbd.  The main daemon is not running but
-    # there may still be other processes around, so do some cleanup.
-    kill_ctdbd "$_session"
-
     dbdir_tmpfs_start
 
     # build_ctdb_options() takes no arguments
@@ -195,9 +149,6 @@ start()
 	ulimit -n "$CTDB_MAX_OPEN_FILES"
     fi
 
-    _d=$(dirname "$pidfile")
-    mkdir -p "$_d"
-
     if [ -n "$CTDB_VALGRIND" -a "$CTDB_VALGRIND" != "no" ] ; then
 	if [ "$CTDB_VALGRIND" = "yes" ] ; then
 	    ctdbd="valgrind -q --log-file=/usr/local/var/log/ctdb_valgrind ${ctdbd}"
@@ -222,7 +173,6 @@ start()
     eval "$ctdbd" "$ctdb_options" || return 1
 
     # Wait until ctdbd has started and is ready to respond to clients.
-    _pid=""
     _timeout="${CTDB_STARTUP_TIMEOUT:-10}"
     _count=0
     while [ "$_count" -lt "$_timeout" ] ; do
@@ -234,52 +184,29 @@ start()
 	sleep 1
     done
 
-    echo "Timed out waiting for initialisation - check logs - killing CTDB"
-    kill_ctdbd "$_pid"
+    echo "Timed out waiting for initialisation - check logs"
+    # Attempt a shutdown just in case things are still running
+    $CTDB shutdown >/dev/null 2>&1
     drop_all_public_ips >/dev/null 2>&1
     return 1
 }
 
 stop()
 {
-    if ! _session=$(ctdbd_is_running) ; then
-	echo "CTDB is not running"
-	return 0
-    fi
-
-    $CTDB shutdown
-
-    # Wait for remaining CTDB processes to exit...
-    _timeout=${CTDB_SHUTDOWN_TIMEOUT:-30}
-    _count=0
-    _terminated=false
-    while [ "$_count" -lt "$_timeout" ] ; do
-	if ! pkill -0 -s "$_session" 2>/dev/null ; then
-	    _terminated=true
-	    break
-	fi
-
-	_count=$((_count + 1))
-	sleep 1
-    done
-
-    if ! $_terminated ; then
-	echo "Timed out waiting for CTDB to shutdown.  Killing CTDB processes."
-	kill_ctdbd "$_session"
-	drop_all_public_ips >/dev/null 2>&1
-
-	sleep 1
-
-	if pkill -0 -s "$_session" ; then
-	    # If SIGKILL didn't work then things are bad...
-	    echo "Failed to kill all CTDB processes.  Giving up."
-	    return 1
+	$CTDB shutdown
+
+	# The above command is important and needs to stand out, so
+	# post-check exit status
+	# shellcheck disable=SC2181
+	if [ $? -ne 0 ] ; then
+		echo "Error while shutting down CTDB"
+		drop_all_public_ips >/dev/null 2>&1
+		return 1
 	fi
-    fi
 
-    dbdir_tmpfs_stop
+	dbdir_tmpfs_stop
 
-    return 0
+	return 0
 }
 
 ############################################################
diff --git a/ctdb/config/events.d/01.reclock b/ctdb/config/events.d/01.reclock
index cceb672..44e49f4 100755
--- a/ctdb/config/events.d/01.reclock
+++ b/ctdb/config/events.d/01.reclock
@@ -8,6 +8,8 @@
 
 loadconfig
 
+ctdb_setup_state_dir "service" "reclock"
+
 # If CTDB_RECOVERY_LOCK specifies a helper then exit because this
 # script can't do anything useful.
 case "$CTDB_RECOVERY_LOCK" in
diff --git a/ctdb/config/events.d/05.system b/ctdb/config/events.d/05.system
index 3931eac..41c582e 100755
--- a/ctdb/config/events.d/05.system
+++ b/ctdb/config/events.d/05.system
@@ -8,7 +8,7 @@
 
 loadconfig
 
-service_state_dir=$(ctdb_setup_service_state_dir "system-monitoring") || exit $?
+ctdb_setup_state_dir "service" "system-monitoring"
 
 validate_percentage ()
 {
@@ -38,7 +38,9 @@ check_thresholds ()
     esac
 
     _t=$(echo "$_thing" | sed -e 's@/@SLASH_ at g' -e 's@ @_ at g')
-    _cache="${service_state_dir}/cache_${_t}"
+    # script_state_dir set by ctdb_setup_state_dir()
+    # shellcheck disable=SC2154
+    _cache="${script_state_dir}/cache_${_t}"
     if validate_percentage "$_unhealthy_threshold" "$_thing" ; then
         if [ "$_usage" -ge "$_unhealthy_threshold" ] ; then
 	    echo "ERROR: ${_thing} utilization ${_usage}% >= threshold ${_unhealthy_threshold}%"
@@ -70,7 +72,7 @@ check_thresholds ()
 
 set_monitor_filsystem_usage_defaults ()
 {
-    _fs_defaults_cache="${service_state_dir}/cache_monitor_filsystem_usage_defaults"
+    _fs_defaults_cache="${script_state_dir}/cache_filsystem_usage_defaults"
 
     if [ ! -r "$_fs_defaults_cache" ] ; then
 	# Determine filesystem for each database directory, generate
diff --git a/ctdb/config/events.d/06.nfs b/ctdb/config/events.d/06.nfs
index e59f265..833ae39 100755
--- a/ctdb/config/events.d/06.nfs
+++ b/ctdb/config/events.d/06.nfs
@@ -6,12 +6,11 @@
 
 . "${CTDB_BASE}/functions"
 
-# service_name is used by various functions
-# shellcheck disable=SC2034
 service_name="nfs"
 
 loadconfig
-service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
+
+ctdb_setup_state_dir "service" "$service_name"
 
 ######################################################################
 
@@ -25,7 +24,9 @@ nfs_callout_pre ()
 
 ######################################################################
 
-nfs_callout_init "$service_state_dir"
+# script_state_dir set by ctdb_setup_state_dir()
+# shellcheck disable=SC2154
+nfs_callout_init "$script_state_dir"
 
 is_ctdb_managed_service || exit 0
 
diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw
index 4dc023a..b256d37 100755
--- a/ctdb/config/events.d/11.natgw
+++ b/ctdb/config/events.d/11.natgw
@@ -10,20 +10,20 @@
 
 . "${CTDB_BASE}/functions"
 
-# service_name is used by various functions
-# shellcheck disable=SC2034
-service_name=natgw
+service_name="natgw"
 
 loadconfig
 
 [ -n "$CTDB_NATGW_NODES" ] || exit 0
 export CTDB_NATGW_NODES
 
-service_state_dir=$(ctdb_setup_service_state_dir) || exit $?
+ctdb_setup_state_dir "failover" "$service_name"
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list