ctdb-locking: Run debug locks script only if the node is active

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Talloc lock request from client specified context

This makes sure that when the client context is destroyed, the lock
request goes away.  If the lock requests is already scheduled, then the
lock child process will be terminated.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Remove unused function ctdb_free_lock_request_context

There is no need for a special function to free lock request and
corresponding lock context.  Freeing lock request will free lock
context also.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-include: Remove declaration of non-existent function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Refactor code to convert TDB_DATA key to aligned uint32 array

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Remove duplicate code with refactored function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Defer all calls when processing dmaster packets

When CTDB receives DMASTER_REQUEST or DMASTER_REPLY packet, the specified
record needs to be updated as soon as possible to avoid inconsistent
dmaster information between nodes.  During this time, queue up all calls
for that record and process them only after dmaster request/reply has
been processed.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Do not reset real-time priority for lock helpers

When using TDB robust mutexes, the kernel wakes waiting processes one
by one, in the priority list order.  To ensure that ctdb lock helper
processes do not starve, lock helper processes need to run at a higher
priority than smbd.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-call: Drop all deferred requests from older generation

Deferring packets has a nasty interaction with recovery.  All deferred
packets must be dropped when recovery happens, since those packets are
tracked as pending requests and will be re-sent with new generation.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Sep  5 09:30:50 CEST 2014 on sn-devel-104
wafsamba: remove unused variable from copy_and_fix_python_path

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
wafsamba: improve wording in a comment

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
wafsamba: fix dependency calculation for SAMBA_GENERATOR()

We need to checksum the rule as string command of the
sourcecode of the python function.

This is stored in the 'ruledeps' envariable on the waf Task.
See exec_rule() in wafadmin/TaskGen.py.

    dep_vars = getattr(self, 'dep_vars', ['ruledeps'])
    if dep_vars:
        tsk.dep_vars = dep_vars
    if isinstance(self.rule, str):
        tsk.env.ruledeps = self.rule
    else:
        # only works if the function is in a global module such as a waf tool
        tsk.env.ruledeps = Utils.h_fun(self.rule)

If there's no 'dep_vars' it defaults to ['ruledeps'].
As we pass our own 'dep_vars' we need to explicitly add
'ruledeps'.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
wafsamba: fix dependency for SAMBA_GENERATOR() when passing vars!=None

vars can only be a dictionary as that's the only thing bld.EXPAND_VARIABLES()
accepts.

We need to checksum the whole vars dictionary into the dependencies.

We set task.env.SAMBA_GENERATOR_VARS = vars and add SAMBA_GENERATOR_VARS
to the dep_vars.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
wafsamba: allow an optional dep_vars list to be passed to SAMBA_GENERATOR()

This can be used to checksum variables used in the rule function.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
wafsamba: fix dependencies on environment variables for python_fixup

We now checksum the sourcecode of copy_and_fix_python_path()
and the env variables used by this function.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
wafsamba: let SAMBA_BLDOPTIONS() use dep_vars=['defines'] instead of always=True

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/wscript: pass dep_vars=['VERSION'] to SAMBA_GENERATOR()

This avoid the use of always=True.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
dynconfig/wscript: add dynconfig_varnames()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
docs-xml/wscript_build: pass dep_vars=bld.dynconfig_varnames() to SAMBA_GENERATOR()

This avoids the use of always=True.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/ldb/wscript: pass dep_vars=['LDB_VERSION'] to SAMBA_GENERATOR()

bld.add_manual_dependency() only works for files not for environment variables.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>