kai/samba-autobuild/.git
3 years agoctdb-ipalloc: Move IP allocation state into its own struct
Martin Schwenke [Thu, 29 Oct 2015 05:49:44 +0000 (16:49 +1100)]
ctdb-ipalloc: Move IP allocation state into its own struct

Most of the IP allocation code does not need a CTDB context.  However,
temporarily hang this off the CTDB context and make only the changes
relating to known/available IP address.  This makes those logic
changes obvious without burying them in function type changes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoctdb-ipalloc: node_ip_coverage() doesn't need CTDB context
Martin Schwenke [Wed, 28 Oct 2015 11:59:18 +0000 (22:59 +1100)]
ctdb-ipalloc: node_ip_coverage() doesn't need CTDB context

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agoselftest: add test for force user and well-known primary group
Uri Simchoni [Tue, 17 Nov 2015 21:14:36 +0000 (23:14 +0200)]
selftest: add test for force user and well-known primary group

Add a test for connecting to a share with a "force user" whos
primary unix gid maps to a well-known alias.

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov 19 23:20:36 CET 2015 on sn-devel-104

3 years agoauth: consistent handling of well-known alias as primary gid
Uri Simchoni [Tue, 17 Nov 2015 21:05:10 +0000 (23:05 +0200)]
auth: consistent handling of well-known alias as primary gid

When a local user has its primary group id mapped to a well-known
alias or a builtin group, smbd accepts logins of such a user, but
fails tree-connects to shares with a "force user" set to this user
with an error of NT_STATUS_INVALID_SID.

This fix causes the connect to succeed and the NT token to resemble
the token that would have been created in a login.

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agoauth: remove a line that has no effect
Uri Simchoni [Tue, 17 Nov 2015 19:43:44 +0000 (21:43 +0200)]
auth: remove a line that has no effect

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

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agowinbind: Don't crash on invalid idmap configs
Volker Lendecke [Thu, 19 Nov 2015 16:00:49 +0000 (17:00 +0100)]
winbind: Don't crash on invalid idmap configs

We should not leave NULL in idmap_domains[]. This will lead to NULL
ptr deferences in idmap_find_domain().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11612
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Nov 19 20:16:44 CET 2015 on sn-devel-104

3 years agobuild:wafsamba: remove check_orphaned_targets
Thomas Nagy [Sat, 14 Nov 2015 14:23:27 +0000 (15:23 +0100)]
build:wafsamba: remove check_orphaned_targets

The function check_orphaned_targets is not used and has
no specification, so it can be removed safely.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Nov 19 13:10:53 CET 2015 on sn-devel-104

3 years agolib: Fix memalign_array overflow protection
Volker Lendecke [Wed, 18 Nov 2015 12:13:57 +0000 (13:13 +0100)]
lib: Fix memalign_array overflow protection

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Nov 19 10:05:08 CET 2015 on sn-devel-104

3 years agoidl: Some CC can't find indented #defines
Volker Lendecke [Mon, 16 Nov 2015 15:23:10 +0000 (16:23 +0100)]
idl: Some CC can't find indented #defines

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoidl: Avoid // style comments
Volker Lendecke [Mon, 16 Nov 2015 15:11:48 +0000 (16:11 +0100)]
idl: Avoid // style comments

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agolibreplace: Only check for malloc.h if needed
Volker Lendecke [Mon, 30 Jun 2014 13:46:21 +0000 (15:46 +0200)]
libreplace: Only check for malloc.h if needed

OpenBSD complains that malloc.h is deprecated on every gcc invocation.
That hides a lot of real warnings. malloc and friends nowadays are
typically defined in stdlib.h, only check there.

We need memalign. On OpenBSD this does not exist, so libreplace replaces
it. The wscript test in libreplace only checks whether memalign can
link. Unfortunately in glibc memalign comes from malloc.h.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agolibreplace: Put the malloc.h check on a line of its own
Volker Lendecke [Mon, 30 Jun 2014 13:15:37 +0000 (15:15 +0200)]
libreplace: Put the malloc.h check on a line of its own

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agolibreplace: Only check malloc.h once
Volker Lendecke [Mon, 30 Jun 2014 11:52:02 +0000 (13:52 +0200)]
libreplace: Only check malloc.h once

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 years agoSet LD_LIBRARY_PATH during tests.
Jelmer Vernooij [Wed, 18 Nov 2015 02:59:37 +0000 (02:59 +0000)]
Set LD_LIBRARY_PATH during tests.

Without this, tests fail ir libtevent is not installed on the system.

Signed-Off-By: Jelmer Vernooij <jelmer@jelmer.uk>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Nov 18 21:40:26 CET 2015 on sn-devel-104

3 years agolib: tevent: Whitespace cleanup.
Jeremy Allison [Tue, 17 Nov 2015 17:13:41 +0000 (09:13 -0800)]
lib: tevent: Whitespace cleanup.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Nov 18 15:54:03 CET 2015 on sn-devel-104

3 years agolib: tevent: Fix bug in poll backend - poll_event_loop_poll()
Jeremy Allison [Tue, 17 Nov 2015 18:28:50 +0000 (10:28 -0800)]
lib: tevent: Fix bug in poll backend - poll_event_loop_poll()

If the (pfd->revents & POLLNVAL) case is triggered,
we do DLIST_REMOVE(ev->fd_events, fde); and then
use fde->next in the loop above.

Save off fde->next for loop interation before
this so we can't use a deleted ->next value.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agoctdb-scripts: Fix CTDB_DBDIR=tmpfs support
Martin Schwenke [Tue, 17 Nov 2015 03:57:44 +0000 (14:57 +1100)]
ctdb-scripts: Fix CTDB_DBDIR=tmpfs support

Various scripts (including debug_locks.sh, 00.ctdb, 05.system) need
CTDB_DBDIR to point to the right place... but it doesn't.

Move the rewriting of CTDB_DBDIR to loadconfig() so that it happens
for all scripts.  Have this code set internal variable
CTDB_DBDIR_TMPFS_OPTIONS so that ctdbd_wrapper can do the mount.

This loses the generality that was present in dbdir_tmpfs_start() but
it wasn't being used anyway.  If it is needed in the future then it
will be in the git history.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Nov 18 11:51:54 CET 2015 on sn-devel-104

3 years agoctdb: Remove unused ctdb_set_process_name
Christof Schmitt [Wed, 23 Sep 2015 23:11:51 +0000 (16:11 -0700)]
ctdb: Remove unused ctdb_set_process_name

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Nov 18 07:12:50 CET 2015 on sn-devel-104

3 years agoctdb: Use prctl_set_comment from lib/util
Christof Schmitt [Wed, 23 Sep 2015 23:10:59 +0000 (16:10 -0700)]
ctdb: Use prctl_set_comment from lib/util

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agolib/util: Move util_process from util to util-core
Christof Schmitt [Wed, 23 Sep 2015 23:02:27 +0000 (16:02 -0700)]
lib/util: Move util_process from util to util-core

Make the common prctl_set_comment function available to both ctdb
builds.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
3 years agolibcli/smb: Use helper function for finding session
Christof Schmitt [Wed, 21 Oct 2015 19:04:47 +0000 (12:04 -0700)]
libcli/smb: Use helper function for finding session

This removes some duplicated code.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Nov 18 04:04:17 CET 2015 on sn-devel-104

3 years agosmbd: Simplify check_access()
Volker Lendecke [Tue, 17 Nov 2015 14:19:31 +0000 (15:19 +0100)]
smbd: Simplify check_access()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Nov 17 22:58:10 CET 2015 on sn-devel-104

3 years agosmbd: Use check_access_fsp where appropriate
Volker Lendecke [Tue, 17 Nov 2015 14:13:41 +0000 (15:13 +0100)]
smbd: Use check_access_fsp where appropriate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Factor out check_access_fsp() from check_access()
Volker Lendecke [Tue, 17 Nov 2015 14:10:42 +0000 (15:10 +0100)]
smbd: Factor out check_access_fsp() from check_access()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Refactor check_access()
Volker Lendecke [Tue, 17 Nov 2015 13:57:50 +0000 (14:57 +0100)]
smbd: Refactor check_access()

This is a micro-patch to make the next ones just obvious

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Early return from dos_mode_debug_print
Volker Lendecke [Tue, 17 Nov 2015 12:49:30 +0000 (13:49 +0100)]
smbd: Early return from dos_mode_debug_print

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Add hex value to dos_mode_debug_print
Volker Lendecke [Tue, 17 Nov 2015 12:44:30 +0000 (13:44 +0100)]
smbd: Add hex value to dos_mode_debug_print

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Use dos_mode_debug_print in get_ea_dos_attribute
Volker Lendecke [Tue, 17 Nov 2015 12:43:10 +0000 (13:43 +0100)]
smbd: Use dos_mode_debug_print in get_ea_dos_attribute

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Use dos_mode_debug_print in dos_mode_from_sbuf
Volker Lendecke [Tue, 17 Nov 2015 12:41:29 +0000 (13:41 +0100)]
smbd: Use dos_mode_debug_print in dos_mode_from_sbuf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Use dos_mode_debug_print in dos_mode_msdfs
Volker Lendecke [Tue, 17 Nov 2015 12:37:14 +0000 (13:37 +0100)]
smbd: Use dos_mode_debug_print in dos_mode_msdfs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agosmbd: Streamline dos_mode_debug_print
Volker Lendecke [Tue, 17 Nov 2015 12:21:13 +0000 (13:21 +0100)]
smbd: Streamline dos_mode_debug_print

One line per flag is a bit overkill

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
3 years agos4-backupkey: Don't use deprecated data structures
Andreas Schneider [Wed, 11 Nov 2015 10:49:12 +0000 (11:49 +0100)]
s4-backupkey: Don't use deprecated data structures

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Nov 17 19:52:33 CET 2015 on sn-devel-104

3 years agos4-torture: Rename issuer unique id in backupkey test
Andreas Schneider [Thu, 12 Nov 2015 10:35:39 +0000 (11:35 +0100)]
s4-torture: Rename issuer unique id in backupkey test

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
3 years agos3-vfs_snapper: Fix a possible use without init warning
Andreas Schneider [Fri, 13 Nov 2015 13:14:10 +0000 (14:14 +0100)]
s3-vfs_snapper: Fix a possible use without init warning

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
3 years agos4-param: Make sure newname is not used uninitialized
Andreas Schneider [Fri, 13 Nov 2015 12:40:25 +0000 (13:40 +0100)]
s4-param: Make sure newname is not used uninitialized

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agosmbd: Move a message_send_all to the cleanupd
Volker Lendecke [Mon, 16 Nov 2015 07:11:20 +0000 (08:11 +0100)]
smbd: Move a message_send_all to the cleanupd

message_send_all traverses serverid.tdb, which can be expensive

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Nov 16 17:55:36 CET 2015 on sn-devel-104

4 years agosmbd: Move cleanupd revalidate to a separate fn
Volker Lendecke [Mon, 16 Nov 2015 07:08:46 +0000 (08:08 +0100)]
smbd: Move cleanupd revalidate to a separate fn

Simple preparation for the next patch...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Move brl_validate to the cleanupd
Volker Lendecke [Sat, 7 Nov 2015 19:18:52 +0000 (20:18 +0100)]
smbd: Move brl_validate to the cleanupd

This walks brlock.tdb, which can be time-consuming.

This adds a new includes.h include. It's too much of a pain for me now to
make locking/proto.h clean to include on its own.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Move serverid_deregister() to the cleanupd
Volker Lendecke [Fri, 6 Nov 2015 16:01:02 +0000 (17:01 +0100)]
smbd: Move serverid_deregister() to the cleanupd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Move messaging_cleanup() to the cleanupd
Volker Lendecke [Fri, 6 Nov 2015 14:32:46 +0000 (15:32 +0100)]
smbd: Move messaging_cleanup() to the cleanupd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Move smbprofile_cleanup() to the cleanupd
Volker Lendecke [Fri, 6 Nov 2015 14:21:59 +0000 (15:21 +0100)]
smbd: Move smbprofile_cleanup() to the cleanupd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbprofile: Add dst pid to smbprofile_cleanup
Volker Lendecke [Fri, 6 Nov 2015 13:55:35 +0000 (14:55 +0100)]
smbprofile: Add dst pid to smbprofile_cleanup

The consolidation will soon be done by a separate process. We need to
avoid the getpid() call in smbprofile_cleanup().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Implement a cleanup daemon
Volker Lendecke [Mon, 2 Nov 2015 11:47:13 +0000 (12:47 +0100)]
smbd: Implement a cleanup daemon

We do way too much stuff in the parent smbd in remove_child_pid(). In
particular accessing ctdbd is not a good idea when ctdbd is stuck in something.
We've had a case where smbd exited itself with "ctdb timeout" being set to 60
seconds. ctdb was just stuck doing recoveries, and the parent smbd was sitting
in serverid_exists trying to retrieve a record for a child that had exited. Not
good.

This daemon sits there as parent->cleanupd and receives MSG_SMB_NOTIFY_CLEANUP
messages that hold the serverid and exit status of a former child. The next
commits will step by step empty remove_child_pid in the parent and move the
tasks to the helper.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agobuild:wafsamba: Waf 1.8 compatible declaration of 'mandatory' configuration tests
Thomas Nagy [Wed, 11 Nov 2015 23:27:31 +0000 (00:27 +0100)]
build:wafsamba: Waf 1.8 compatible declaration of 'mandatory' configuration tests

The configuration tests raise exceptions by default in later Waf versions,
but the samba tests do not specify whether the errors should be raised or
not. This changes lifts the ambiguity.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Nov 16 14:50:39 CET 2015 on sn-devel-104

4 years agobuild:wafsamba: Install named.conf only once
Thomas Nagy [Sun, 8 Nov 2015 17:50:55 +0000 (18:50 +0100)]
build:wafsamba: Install named.conf only once

The wildcard *.conf already lists named.conf. Adding files
more than once will cause unnecessary rebuilds and raise
errors in later Waf versions.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agobuild:wafsamba: Replace Options.is_install by bld.is_install
Thomas Nagy [Fri, 6 Nov 2015 23:57:36 +0000 (00:57 +0100)]
build:wafsamba: Replace Options.is_install by bld.is_install

Options.is_install is a deprecated module variable that is more
verbose than bld.is_install and complicates the Waf 1.8 upgrade.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-recoverd: Factor out recovery master validation
Martin Schwenke [Tue, 27 Oct 2015 05:43:07 +0000 (16:43 +1100)]
ctdb-recoverd: Factor out recovery master validation

Starting to untangle cluster management, database recovery and public
IP allocation.  This is a non-trivial subset of the cluster management
code that runs in the recovery daemon on all nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Nov 16 11:47:45 CET 2015 on sn-devel-104

4 years agoctdb-recmaster: Update capabilities before calling first election
Martin Schwenke [Tue, 27 Oct 2015 04:09:33 +0000 (15:09 +1100)]
ctdb-recmaster: Update capabilities before calling first election

Capabilities are used when computing an election result so having them
up-to-date seems like a good idea.

Also update several instances of an ambiguous comment.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Move VNN map retrieval to where it is needed
Martin Schwenke [Tue, 27 Oct 2015 03:35:09 +0000 (14:35 +1100)]
ctdb-recoverd: Move VNN map retrieval to where it is needed

The VNN map is only needed on the recovery master, so no need for all
recovery daemons to retrieve it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Drop explicit check for recovery lock
Martin Schwenke [Tue, 27 Oct 2015 03:32:48 +0000 (14:32 +1100)]
ctdb-recoverd: Drop explicit check for recovery lock

This is already handled in update_recovery_lock(), which is called
immediately before.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Simplify using TALLOC_FREE()
Martin Schwenke [Fri, 23 Oct 2015 05:00:55 +0000 (16:00 +1100)]
ctdb-recoverd: Simplify using TALLOC_FREE()

The only non-obvious part here is dropping the setting of the nodemap
local variable to NULL.  If the following control succeeds then it is
set, otherwise return and it doesn't matter.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Clarify that recmaster is being set on the current node
Martin Schwenke [Fri, 23 Oct 2015 04:27:12 +0000 (15:27 +1100)]
ctdb-recoverd: Clarify that recmaster is being set on the current node

That is, using CTDB_CURRENT_NODE makes this more obvious.

Also fix incorrect error messages.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Do not sanity check recovery master with local daemon
Martin Schwenke [Fri, 23 Oct 2015 04:05:08 +0000 (15:05 +1100)]
ctdb-recoverd: Do not sanity check recovery master with local daemon

Each recovery daemon knows who the recmaster is and is in sync with
its local daemon.  The recovery master is running this check so do not
bother checking with its local daemon - both agree that it is the
recovery master.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Don't retrieve recovery master from local daemon
Martin Schwenke [Fri, 23 Oct 2015 04:33:01 +0000 (15:33 +1100)]
ctdb-recoverd: Don't retrieve recovery master from local daemon

The recovery daemon already knows which node is the master.  This
relies on rec->recmaster being correctly initialised and correctly set
during elections.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Explicitly set initial recovery master to unknown
Martin Schwenke [Tue, 10 Nov 2015 02:54:47 +0000 (13:54 +1100)]
ctdb-recoverd: Explicitly set initial recovery master to unknown

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Do not set recovery master during recovery
Martin Schwenke [Thu, 22 Oct 2015 10:54:58 +0000 (21:54 +1100)]
ctdb-recoverd: Do not set recovery master during recovery

Recovery should not do cluster management functions.  Setting the
recovery master should only be done via an election.

Main loop will determine if recovery master is inconsistent across the
cluster and force an election if necessary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Have recovery daemon remember election result
Martin Schwenke [Fri, 23 Oct 2015 03:32:41 +0000 (14:32 +1100)]
ctdb-recoverd: Have recovery daemon remember election result

The recovery daemon pushes knowledge of recovery master election
progress/result to local daemon.  It then retrieves that information
again.

Instead, have the recovery daemon reliably track election
progress/result in rec->recmaster so it doesn't need to be retrieved.
Be careful to maintain consistency by only doing this when the local
daemon has been updated.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-recoverd: Clarify recovery master validation logic
Martin Schwenke [Wed, 21 Oct 2015 05:19:00 +0000 (16:19 +1100)]
ctdb-recoverd: Clarify recovery master validation logic

There can be no holes in the nodemap.  Even if a node has been deleted
it will take a slot in the nodemap.  The only exception is that the
nodemap shrinks if nodes are deleted from the end.  That should never
include the master because a node should be shutdown before being
deleted, and an election should already have take place.

To avoid walking off the end of the nodemap nodes array just confirm
that the master node's PNN is a valid index into the array.  No need
to walk through the nodemap.

After this, in this section of the code j is now invalid.  So use the
master's PNN to index into the nodemap.  This is safe.

In the process, clean up some log messages to avoid saying "Force
reelection".  It's just an "election".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoWHATSNEW: Document CTDB tunable change
Martin Schwenke [Fri, 13 Nov 2015 04:23:14 +0000 (15:23 +1100)]
WHATSNEW: Document CTDB tunable change

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Rename EventScriptTimeoutCount to MonitorTimeoutCount
Martin Schwenke [Wed, 28 Oct 2015 06:03:01 +0000 (17:03 +1100)]
ctdb-daemon: Rename EventScriptTimeoutCount to MonitorTimeoutCount

This only applies to monitor events so renaming clarifies this.

Note that this change is not backward compatible.  Users with

  CTDB_SET_EventScriptTimeoutCount=<n>

in their configuration will get failures when starting CTDB but the
cause will be clearly logged.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Move script timeout count into monitor state
Martin Schwenke [Wed, 28 Oct 2015 05:51:59 +0000 (16:51 +1100)]
ctdb-daemon: Move script timeout count into monitor state

It is only used by the monitoring code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Reset script timeout count in monitor code
Martin Schwenke [Wed, 28 Oct 2015 05:42:41 +0000 (16:42 +1100)]
ctdb-daemon: Reset script timeout count in monitor code

This is the only place it is used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-daemon: Do not bother printing script timeout count
Martin Schwenke [Wed, 28 Oct 2015 05:39:18 +0000 (16:39 +1100)]
ctdb-daemon: Do not bother printing script timeout count

It is only updated for monitor events, so it is meaningless here.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-doc: Correct documentation for tunables for script timeout
Martin Schwenke [Tue, 27 Oct 2015 04:18:25 +0000 (15:18 +1100)]
ctdb-doc: Correct documentation for tunables for script timeout

* The defaults for EventScriptTimeout and EventScriptTimeoutCount are
  wrong.

* EventScriptTimeout is the total time for all enabled scripts that
  are run for an event, not a single event script.

* EventScriptTimeoutCount only applies to monitor events.

* EventScriptUnhealthyOnTimeout is obsolete, so remove it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-ipalloc: Don't consider runstates in the IP takeover code
Martin Schwenke [Wed, 28 Oct 2015 11:15:00 +0000 (22:15 +1100)]
ctdb-ipalloc: Don't consider runstates in the IP takeover code

Checking runstates is unnecessary now that nodes that are not RUNNING
will return no available IP addresses.  I have no idea why I didn't do
it this way originally.

Tweak the test code to cope with this.

Note that this is a backward-incompatible change.  If new and old
versions of CTDB are running together in a cluster and a new node
takes over as recovery master then old nodes will be able to host
public IP addresses before they are in RUNNING runstate.  This is
mitigated by the bias towards recovery master stability in elections.
If it is important that nodes do not host IPs until they are RUNNING
then do not restart nodes running the old version.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-ipalloc: Check for available IPs, not runstate, in takeover run
Martin Schwenke [Wed, 28 Oct 2015 11:11:33 +0000 (22:11 +1100)]
ctdb-ipalloc: Check for available IPs, not runstate, in takeover run

The available IPs list is now only non-empty for nodes that are in
RUNNING runstate.  So, to avoid running the IP allocation algorithm
when there are no available available IPs, explicitly check for
available IPs rather than checking runstates.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-ipalloc: A VNN can only host IPs if node is in RUNNING runstate
Martin Schwenke [Wed, 28 Oct 2015 09:41:08 +0000 (20:41 +1100)]
ctdb-ipalloc: A VNN can only host IPs if node is in RUNNING runstate

This will allow wonderful simplification (i.e. removal) of some of the
runstate checking in the takeover run code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-build: Remove ctdb-common-util subsystem
Amitay Isaacs [Wed, 11 Nov 2015 05:52:30 +0000 (16:52 +1100)]
ctdb-build: Remove ctdb-common-util subsystem

Include system_util.c in ctdb-system subsystem.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Nov 16 03:51:36 CET 2015 on sn-devel-104

4 years agoctdb-daemon: Remove unused ctdb_logging.[ch]
Amitay Isaacs [Wed, 11 Nov 2015 05:43:44 +0000 (16:43 +1100)]
ctdb-daemon: Remove unused ctdb_logging.[ch]

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-tool: Use new debug level API
Amitay Isaacs [Wed, 11 Nov 2015 05:40:41 +0000 (16:40 +1100)]
ctdb-tool: Use new debug level API

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-common: Use new debug level API
Amitay Isaacs [Wed, 11 Nov 2015 04:19:41 +0000 (15:19 +1100)]
ctdb-common: Use new debug level API

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-tests: Build in common/logging.c
Amitay Isaacs [Wed, 11 Nov 2015 05:33:43 +0000 (16:33 +1100)]
ctdb-tests: Build in common/logging.c

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-tests: Replace ctdb_logging.h with common/logging.h
Amitay Isaacs [Wed, 11 Nov 2015 05:00:23 +0000 (16:00 +1100)]
ctdb-tests: Replace ctdb_logging.h with common/logging.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-transport: Replace ctdb_logging.h with common/logging.h
Amitay Isaacs [Wed, 11 Nov 2015 04:22:52 +0000 (15:22 +1100)]
ctdb-transport: Replace ctdb_logging.h with common/logging.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-server: Replace ctdb_logging.h with common/logging.h
Amitay Isaacs [Wed, 11 Nov 2015 04:41:10 +0000 (15:41 +1100)]
ctdb-server: Replace ctdb_logging.h with common/logging.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-common: Replace ctdb_logging.h with common/logging.h
Amitay Isaacs [Wed, 11 Nov 2015 04:19:17 +0000 (15:19 +1100)]
ctdb-common: Replace ctdb_logging.h with common/logging.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-client: Replace ctdb_logging.h with common/logging.h
Amitay Isaacs [Wed, 11 Nov 2015 04:17:56 +0000 (15:17 +1100)]
ctdb-client: Replace ctdb_logging.h with common/logging.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-system: Replace ctdb_logging.h with common/logging.h
Amitay Isaacs [Wed, 11 Nov 2015 03:43:56 +0000 (14:43 +1100)]
ctdb-system: Replace ctdb_logging.h with common/logging.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-logging: Remove duplicate definitions
Amitay Isaacs [Wed, 11 Nov 2015 04:10:38 +0000 (15:10 +1100)]
ctdb-logging: Remove duplicate definitions

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-tests: Update test to set numeric debug levels
Amitay Isaacs [Fri, 13 Nov 2015 01:03:43 +0000 (12:03 +1100)]
ctdb-tests: Update test to set numeric debug levels

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-logging: Allow numeric specification of debug level
Amitay Isaacs [Wed, 11 Nov 2015 22:15:08 +0000 (09:15 +1100)]
ctdb-logging: Allow numeric specification of debug level

This makes the function compatible with parse_debug().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-logging: Allow sub-string matching for debug level strings
Amitay Isaacs [Wed, 11 Nov 2015 05:17:51 +0000 (16:17 +1100)]
ctdb-logging: Allow sub-string matching for debug level strings

This allows for backward compatibility with the current code where
DEBUG_ERR corresponds to "ERR".

Fix the test that relies on "ERR" instead of "ERROR".

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-logging: Fix for loop condition
Amitay Isaacs [Wed, 11 Nov 2015 22:14:32 +0000 (09:14 +1100)]
ctdb-logging: Fix for loop condition

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-logging: Add APIs to convert debug_level to and from integer
Amitay Isaacs [Wed, 11 Nov 2015 03:45:08 +0000 (14:45 +1100)]
ctdb-logging: Add APIs to convert debug_level to and from integer

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-logging: Move debug_extra definition to server/ctdb_logging.c
Amitay Isaacs [Wed, 11 Nov 2015 03:31:41 +0000 (14:31 +1100)]
ctdb-logging: Move debug_extra definition to server/ctdb_logging.c

This variable is used for adding a prefix to log entries from various
child processes.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-daemon: Move ctdb_fork.c to server
Amitay Isaacs [Wed, 11 Nov 2015 03:26:53 +0000 (14:26 +1100)]
ctdb-daemon: Move ctdb_fork.c to server

These functions are only used in the ctdb daemon code.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoctdb-daemon: Move switch_from_server_to_client() to ctdb_daemon.c
Amitay Isaacs [Wed, 11 Nov 2015 03:18:51 +0000 (14:18 +1100)]
ctdb-daemon: Move switch_from_server_to_client() to ctdb_daemon.c

This function can only called from ctdb daemon.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agoWHATSNEW: Add async SMB2 flush and new aio parameter
Christof Schmitt [Fri, 13 Nov 2015 18:47:32 +0000 (11:47 -0700)]
WHATSNEW: Add async SMB2 flush and new aio parameter

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Nov 14 00:39:17 CET 2015 on sn-devel-104

4 years agodocs: Update doc for 'strict sync' parameter for async SMB2 flush
Christof Schmitt [Fri, 13 Nov 2015 18:46:33 +0000 (11:46 -0700)]
docs: Update doc for 'strict sync' parameter for async SMB2 flush

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: Change aio_pending_size static variable to a new "aio max threads" smb...
Jeremy Allison [Thu, 12 Nov 2015 21:23:30 +0000 (13:23 -0800)]
s3: smbd: Change aio_pending_size static variable to a new "aio max threads" smb.conf parameter.

Removes accessor functions as now this parameter is set
under user control in smb.conf. Default is 100.

Note that this doesn't limit the number of outstanding
aio requests, it just causes them to go onto the
pthreadpool queue.

Now we need to prioritize pthreadpool pipe replies
ahead of incoming SMB2 requests, but that's a patch
for another day.

Based on ideas from Volker.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agos3: smbd: Remove checks causing fallback to sync on pread/pwrite/fsync.
Jeremy Allison [Thu, 12 Nov 2015 21:07:21 +0000 (13:07 -0800)]
s3: smbd: Remove checks causing fallback to sync on pread/pwrite/fsync.

Rely on pthreadpool queueing instead of falling back.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agos3: smbd: Remove --with-aio-support. We no longer would ever prefer POSIX-RT aio...
Jeremy Allison [Thu, 12 Nov 2015 20:44:50 +0000 (12:44 -0800)]
s3: smbd: Remove --with-aio-support. We no longer would ever prefer POSIX-RT aio, use pthread_aio instead.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
4 years agodocs: correct the name of the idmap config group of parameters
Michael Adam [Fri, 13 Nov 2015 15:30:33 +0000 (16:30 +0100)]
docs: correct the name of the idmap config group of parameters

"idmap config DOMAIN : OPTION" is the pattern used.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Nov 13 19:55:33 CET 2015 on sn-devel-104

4 years agoctdb: Fix the O3 developer build
Volker Lendecke [Sat, 7 Nov 2015 19:18:32 +0000 (20:18 +0100)]
ctdb: Fix the O3 developer build

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Nov 13 12:42:22 CET 2015 on sn-devel-104

4 years agoselftest: Use strict sync = yes
Christof Schmitt [Wed, 11 Nov 2015 20:28:09 +0000 (13:28 -0700)]
selftest: Use strict sync = yes

This enables the codepaths calling fsync for FLUSH requests during
selftest.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Fri Nov 13 04:47:00 CET 2015 on sn-devel-104

4 years agosmbd: Issue fsync for SMB2 FLUSH asynchronously
Christof Schmitt [Wed, 11 Nov 2015 20:31:15 +0000 (13:31 -0700)]
smbd: Issue fsync for SMB2 FLUSH asynchronously

SMB2 FLUSH mainly calls fsync and there is already code in place to
handle fsync asynchronously, so use the asynchronous code path for SMB2
FLUSH. This avoids a SMB2 FLUSH stalling other requests processing.

Signed-off-by: Christof Schmitt <cs@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: Remove outstanding_aio_calls from globals.
Jeremy Allison [Thu, 12 Nov 2015 17:25:41 +0000 (09:25 -0800)]
s3: smbd: Remove outstanding_aio_calls from globals.

Access via functions only.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Christof Schmitt <cs@samab.org>
4 years agos3: smbd: Remove aio_pending_size from globals.
Jeremy Allison [Thu, 12 Nov 2015 17:20:05 +0000 (09:20 -0800)]
s3: smbd: Remove aio_pending_size from globals.

Access via functions only.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Christof Schmitt <cs@samba.org>
4 years agos4-auth: Fix some debugging and crash in error cases
Günther Deschner [Thu, 24 Sep 2015 18:45:04 +0000 (20:45 +0200)]
s4-auth: Fix some debugging and crash in error cases

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov 13 01:43:36 CET 2015 on sn-devel-104

4 years agosmbd: Remove dead code
Volker Lendecke [Thu, 12 Nov 2015 20:09:35 +0000 (21:09 +0100)]
smbd: Remove dead code

94f0716fff has removed the dcelogin_atmost_once variable.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>