1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

2822 Commits

Author SHA1 Message Date
Jelmer Vernooij
163603f4f4 subunit: Support formatting compatible with upstream subunit, for consistency.
Upstream subunit makes a ":" after commands optional, so I've fixed any
places where we might trigger commands accidently. I've filed a bug
about this in subunit.

(Imported from commit 7da94cc4a6)

(This used to be ctdb commit f1242d9cba676d1d393375bea42613192c70662e)
2010-04-22 13:59:22 +09:30
Simo Sorce
bca9d2764e tdb: update exports and signatures files
(Imported from commit c1f6f61f62)

(This used to be ctdb commit e61ff181085b35cb4aba933350bfe4f64471b359)
2010-04-22 13:58:35 +09:30
Volker Lendecke
bae2979659 tdb: Add a non-blocking version of tdb_transaction_start
(Imported from commit 261c3b4f1b)

(This used to be ctdb commit 87ced00d6d98be4a34719af58694e7c940b4dd68)
2010-04-22 13:58:35 +09:30
Volker Lendecke
67312cefef tdb: Fix indentation in tdb_new_database()
(Imported from commit 59315887a0)

(This used to be ctdb commit fa38f818c71c85918e673ff563bf7a91a0c4cc17)
2010-04-22 13:58:07 +09:30
Volker Lendecke
599cd1045e Fix some nonempty blank lines
(Imported from commit ea8e0d5d54)

(This used to be ctdb commit 7161cb1607bb105cd6f4f32df50f519314e77b3f)
2010-04-22 13:58:07 +09:30
Andrew Tridgell
b52a04d987 python: use '#!/usr/bin/env python' to cope with varying install locations
this should be much more portable

(Imported from commit 088096d1ba)

(This used to be ctdb commit 7f1330adc690360a4a8ce85352df0908a93684a5)
2010-04-22 13:57:17 +09:30
Volker Lendecke
9e29197ca6 tdb: Fix bug 7248, avoid the nanosleep dependency
(Imported from commit e2c7e5c4f7)

(This used to be ctdb commit 3318c74386e202b77ba7e29b4c3e0ce4d88fcd5b)
2010-04-22 13:54:06 +09:30
Volker Lendecke
5a89ab2353 tdb: If tdb_parse_record does not find a record, return -1 instead of 0
(Imported from commit fb98f60594)

(This used to be ctdb commit e90aba9967ea4a8ae7f6bdfc19666c47bd92951e)
2010-04-22 13:54:06 +09:30
Rusty Russell
98b9b1defa tdb: handle processes dying during transaction commit.
tdb transactions were designed to be robust against the machine
powering off, but interestingly were never designed to handle the case
where an administrator kill -9's a process during commit.  Because
recovery is only done on tdb_open, processes with the tdb already
mapped will simply use it despite it being corrupt and needing
recovery.

The solution to this is to check for recovery every time we grab a
data lock: we could have gained the lock because a process just died.
This has no measurable cost: here is the time for tdbtorture -s 0 -n 1
-l 10000:

Before:
	2.75 2.50 2.81 3.19 2.91 2.53 2.72 2.50 2.78 2.77 = Avg 2.75

After:
	2.81 2.57 3.42 2.49 3.02 2.49 2.84 2.48 2.80 2.43 = Avg 2.74

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit ec96ea690e)

(This used to be ctdb commit 4215c7025d2b29439c5acd19ce4e0fc4e67370b3)
2010-04-22 13:54:06 +09:30
Rusty Russell
a617fb4ab1 patch tdb-refactor-tdb_lock-and-tdb_lock_nonblock.patch
(Imported from commit 1bf482b9ef)

(This used to be ctdb commit 52b0f19636565ef633e63d2726a1cc8c41dccedb)
2010-04-22 13:54:06 +09:30
Rusty Russell
5c58560d50 tdb: add -k option to tdbtorture
To test the case of death of a process during transaction commit, add
a -k (kill random) option to tdbtorture.  The easiest way to do this
is to make every worker a child (unless there's only one child), which
is why this patch is bigger than you might expect.

Using -k without -t (always transactions) you expect corruption, though
it doesn't happen every time.  With -t, we currently get corruption but
the next patch fixes that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit ececeffd85)

(This used to be ctdb commit e5af0ce79c74f11daae2a8514e398c40535e2e67)
2010-04-22 13:54:06 +09:30
Rusty Russell
90480db96f tdb: don't truncate tdb on recovery
The current recovery code truncates the tdb file on recovery.  This is
fine if recovery is only done on first open, but is a really bad idea
as we move to allowing recovery on "live" databases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 8c3fda4318)

(This used to be ctdb commit 65bc926d1a9cb3af18cae6b1462b832a5bcec561)
2010-04-22 13:54:06 +09:30
Rusty Russell
24532663bf tdb: remove lock ops
Now the transaction code uses the standard allrecord lock, that stops
us from trying to grab any per-record locks anyway.  We don't need to
have special noop lock ops for transactions.

This is a nice simplification: if you see brlock, you know it's really
going to grab a lock.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 9f295eecff)

(This used to be ctdb commit 6d7093cf51d0256245cc6bab24c9550ed3f1d8a5)
2010-04-22 13:54:06 +09:30
Rusty Russell
fa782ab992 tdb: rename tdb_release_extra_locks() to tdb_release_transaction_locks()
tdb_release_extra_locks() is too general: it carefully skips over the
transaction lock, even though the only caller then drops it.  Change
this, and rename it to show it's clearly transaction-specific.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit a84222bbaf)

(This used to be ctdb commit 803035716338170896fee15f15b17c32e7ee777e)
2010-04-22 13:54:05 +09:30
Rusty Russell
80376a7993 tdb: cleanup: remove ltype argument from _tdb_transaction_cancel.
Now the transaction allrecord lock is the standard one, and thus is cleaned
in tdb_release_extra_locks(), _tdb_transaction_cancel() doesn't need to
know what type it is.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit dd1b508c63)

(This used to be ctdb commit 74874ffb2c81e098c1d7935b37557c2151382ca6)
2010-04-22 13:54:05 +09:30
Rusty Russell
ce635cef5b tdb: tdb_allrecord_lock/tdb_allrecord_unlock/tdb_allrecord_upgrade
Centralize locking of all chains of the tdb; rename _tdb_lockall to
tdb_allrecord_lock and _tdb_unlockall to tdb_allrecord_unlock, and
tdb_brlock_upgrade to tdb_allrecord_upgrade.

Then we use this in the transaction code.  Unfortunately, if the transaction
code records that it has grabbed the allrecord lock read-only, write locks
will fail, so we treat this upgradable lock as a write lock, and mark it
as upgradable using the otherwise-unused offset field.

One subtlety: now the transaction code is using the allrecord_lock, the
tdb_release_extra_locks() function drops it for us, so we no longer need
to do it manually in _tdb_transaction_cancel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit fca1621965)

(This used to be ctdb commit d7fdb38ac05b5f2af9eb485e98673280835273dd)
2010-04-22 13:54:05 +09:30
Rusty Russell
6f220bff0f tdb: suppress record write locks when allrecord lock is taken.
Records themselves get (read) locked by the traversal code against delete.
Interestingly, this locking isn't done when the allrecord lock has been
taken, though the allrecord lock until recently didn't cover the actual
records (it now goes to end of file).

The write record lock, grabbed by the delete code, is not suppressed
by the allrecord lock.  This is now bad: it causes us to punch a hole
in the allrecord lock when we release the write record lock.  Make this
consistent: *no* record locks of any kind when the allrecord lock is
taken.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit caaf5c6baa)

(This used to be ctdb commit 7a99cdf5d0a91764a750c1a264e90e5b66f910a1)
2010-04-22 13:54:05 +09:30
Rusty Russell
4ae716d1e9 tdb: cleanup: always grab allrecord lock to infinity.
We were previously inconsistent with our "global" lock: the
transaction code grabbed it from FREELIST_TOP to end of file, and the
rest of the code grabbed it from FREELIST_TOP to end of the hash
chains.  Change it to always grab to end of file for simplicity and
so we can merge the two.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 9341f230f8)

(This used to be ctdb commit 46f2c33357c999c31a8064c159c6162269c28d9d)
2010-04-22 13:54:05 +09:30
Rusty Russell
021b18c0dd tdb: remove num_locks
This was redundant before this patch series: it mirrored num_lockrecs
exactly.  It still does.

Also, skip useless branch when locks == 1: unconditional assignment is
cheaper anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 1ab8776247)

(This used to be ctdb commit 587ac01ce836286aab54bfcb7a693a0170c7ebd3)
2010-04-22 13:54:05 +09:30
Rusty Russell
ce0b29c79c tdb: use tdb_nest_lock() for seqnum lock.
This is pure overhead, but it centralizes the locking.  Realloc (esp. as
most implementations are lazy) is fast compared to the fnctl anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit d48c3e4982)

(This used to be ctdb commit 2e8512403525c14c9b776ce28891d09c17ada91d)
2010-04-22 13:54:05 +09:30
Rusty Russell
a3230a83da tdb: use tdb_nest_lock() for active lock.
Use our newly-generic nested lock tracking for the active lock.

Note that the tdb_have_extra_locks() and tdb_release_extra_locks()
functions have to skip over this lock now it is tracked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 4738d474c4)

(This used to be ctdb commit 0a44584963232b0b1c62e30c9bede0439e68ef7d)
2010-04-22 13:53:51 +09:30
Rusty Russell
2d1f088112 tdb: use tdb_nest_lock() for open lock.
This never nests, so it's overkill, but it centralizes the locking into
lock.c and removes the ugly flag in the transaction code to track whether
we have the lock or not.

Note that we have a temporary hack so this places a real lock, despite
the fact that we are in a transaction.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 9136818df3)

(This used to be ctdb commit 6812d81907793299e874f121174d885f6500f374)
2010-04-22 13:53:51 +09:30
Rusty Russell
685473b1cb tdb: use tdb_nest_lock() for transaction lock.
Rather than a boutique lock and a separate nest count, use our
newly-generic nested lock tracking for the transaction lock.

Note that the tdb_have_extra_locks() and tdb_release_extra_locks()
functions have to skip over this lock now it is tracked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit e8fa70a321)

(This used to be ctdb commit 4ca1b96a70048b2eaa0d12fb5f0fdb54ec396aa3)
2010-04-22 13:53:51 +09:30
Rusty Russell
43585f9200 tdb: cleanup: find_nestlock() helper.
Factor out two loops which find locks; we are going to introduce a couple
more so a helper makes sense.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit ce41411c84)

(This used to be ctdb commit cfb154dd0f189f37b937e90144c2eb9e66a26420)
2010-04-22 13:53:51 +09:30
Rusty Russell
12e117952c tdb: cleanup: tdb_release_extra_locks() helper
Move locking intelligence back into lock.c, rather than open-coding the
lock release in transaction.c.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit db270734d8)

(This used to be ctdb commit d2dd720b51c4032e5d77d30212da8117d3f119df)
2010-04-22 13:53:51 +09:30
Rusty Russell
4ceb70ee37 tdb: cleanup: tdb_have_extra_locks() helper
In many places we check whether locks are held: add a helper to do this.

The _tdb_lockall() case has already checked for the allrecord lock, so
the extra work done by tdb_have_extra_locks() is merely redundant.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit fba42f1fb4)

(This used to be ctdb commit dda3587dfee598f387c2e696f3645486fac65052)
2010-04-22 13:53:51 +09:30
Rusty Russell
5f40176e88 tdb: don't suppress the transaction lock because of the allrecord lock.
tdb_transaction_lock() and tdb_transaction_unlock() do nothing if we
hold the allrecord lock.  However, the two locks don't overlap, so
this is wrong.

This simplification makes the transaction lock a straight-forward nested
lock.

There are two callers for these functions:
1) The transaction code, which already makes sure the allrecord_lock
   isn't held.
2) The traverse code, which wants to stop transactions whether it has the
   allrecord lock or not.  There have been deadlocks here before, however
   this should not bring them back (I hope!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit b754f61d23)

(This used to be ctdb commit 495f3554259b9dbf9ee673c4fe420d98e50e4901)
2010-04-22 13:53:51 +09:30
Rusty Russell
dca3421b60 tdb: cleanup: tdb_nest_lock/tdb_nest_unlock
Because fcntl locks don't nest, we track them in the tdb->lockrecs array
and only place/release them when the count goes to 1/0.  We only do this
for record locks, so we simply place the list number (or -1 for the free
list) in the structure.

To generalize this:

1) Put the offset rather than list number in struct tdb_lock_type.
2) Rename _tdb_lock() to tdb_nest_lock, make it non-static and move the
   allrecord check out to the callers (except the mark case which doesn't
   care).
3) Rename _tdb_unlock() to tdb_nest_unlock(), make it non-static and
   move the allrecord out to the callers (except mark again).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 5d9de604d9)

(This used to be ctdb commit 28576ddbd9bf91049db8a4f9e9e7856ac5b8f48a)
2010-04-22 13:53:51 +09:30
Rusty Russell
9a1c172139 tdb: cleanup: rename global_lock to allrecord_lock.
The word global is overloaded in tdb.  The global_lock inside struct
tdb_context is used to indicate we hold a lock across all the chains.

Rename it to allrecord_lock.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit e9114a7585)

(This used to be ctdb commit a912657fb50a78b9b328c4564281fb9f7f1b3766)
2010-04-22 13:53:51 +09:30
Rusty Russell
6fec65ac2c tdb: cleanup: rename GLOBAL_LOCK to OPEN_LOCK.
The word global is overloaded in tdb.  The GLOBAL_LOCK offset is used at
open time to serialize initialization (and by the transaction code to block
open).

Rename it to OPEN_LOCK.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 7ab422d6fb)

(This used to be ctdb commit a4f83910a485cf56f9b3df1dcf2ad36ebec57473)
2010-04-22 13:53:51 +09:30
Rusty Russell
db7a4fedc9 tdb: make _tdb_transaction_cancel static.
Now tdb_open() calls tdb_transaction_cancel() instead of
_tdb_transaction_cancel, we can make it static.

Signed-off-by: Rusty Russell<rusty@rustcorp.com.au>

(Imported from commit a6e0ef87d2)

(This used to be ctdb commit d728a7f65bcd5f1aedbee41d6db5c35f10cb417e)
2010-04-22 13:53:42 +09:30
Rusty Russell
25c9eba372 tdb: cleanup: split brlock and brunlock methods.
This is taken from the CCAN code base: rather than using tdb_brlock for
locking and unlocking, we split it into brlock and brunlock functions.

For extra debugging information, brunlock says what kind of lock it is
unlocking (even though fnctl locks don't need this).  This requires an
extra argument to tdb_transaction_unlock() so we know whether the
lock was upgraded to a write lock or not.

We also use a "flags" argument tdb_brlock:
1) TDB_LOCK_NOWAIT replaces lck_type = F_SETLK (vs F_SETLKW).
2) TDB_LOCK_MARK_ONLY replaces setting TDB_MARK_LOCK bit in ltype.
3) TDB_LOCK_PROBE replaces the "probe" argument.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 452b4a5a6e)

(This used to be ctdb commit 7b5fdc9c588237c83a1e70e5437e2e5510055b92)
2010-04-22 13:53:42 +09:30
Brad Hards
69f5519898 Spelling fixes for tdb.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>

(Imported from commit 09e756b1d6)

(This used to be ctdb commit b0dff4ed35ab2423b8fcc801cdaaebaa0d7654bb)
2010-04-22 13:53:42 +09:30
Andrew Tridgell
ff2e1c9fd6 tdb: use fdatasync() instead of fsync() in transactions
This might help on some filesystems

(Imported from commit 1373e748aa)

(This used to be ctdb commit e9ee4aaeb471a7f5ba4c97d3f76f406c1fe9b92f)
2010-04-22 13:53:42 +09:30
Volker Lendecke
9f003c2b54 tdb: Apply some const, just for clarity
(Imported from commit 6824c6f46b)

(This used to be ctdb commit 8b0a8a96edf8611257e58ea81ed872dc03ca5da6)
2010-04-22 13:53:42 +09:30
Rusty Russell
e552df6fa6 tdb: fix recovery reuse after crash
If a process (or the machine) dies after just after writing the
recovery head (pointing at the end of file), the recovery record will filled
with 0x42.  This will not invoke a recovery on open, since rec.magic
!= TDB_RECOVERY_MAGIC.

Unfortunately, the first transaction commit will happily reuse that
area: tdb_recovery_allocate() doesn't check the magic.  The recovery
record has length 0x42424242, and it writes that back into the
now-valid-looking transaction header) for the next comer (which
happens to be tdb_wipe_all in my tests).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit b37b452cb8)

(This used to be ctdb commit 8c8782ecbb347e026f67d82a39555c0e43b1e9f8)
2010-04-22 13:53:41 +09:30
Rusty Russell
60ae9dfe5d tdb: give a name to the invalid recovery area constant (0)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(Imported from commit 6269cdcd15)

(This used to be ctdb commit e0ca2e02120258aabca1e1586a58a8d672484fb5)
2010-04-22 13:53:26 +09:30
Simo Sorce
d15deef18b release-scripts: parametrize scripts
This should make it easier to keep all release scripts alined as it will reduce
the difference between them to ideally a few variables

Also moves the tdb script in the scripts directory.

(Imported from commit 6339de7f4f)

(This used to be ctdb commit 8885b2206fba41ec289fda5dfd653ee676aa0dd3)
2010-04-22 13:53:21 +09:30
Simo Sorce
b68642d51c tdb: raise version to 1.2.1
after recent fixes we need to raise the version to 1.2.1 so that
we can require also the right patched version.

(Imported from commit 70534adee1)

(This used to be ctdb commit 84c971f33c24d32e5599aba7ba83bb474f7ac922)
2010-04-22 13:45:58 +09:30
Martin Schwenke
f765f0ceca Fix a thinko in 2ea0a9f1a93781a0d036feb9fcc0d120b182922f.
If the driver is virtio_net then we assume that the link is up rather
than ignoring the check altogether.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3044d07da2a58260fa06bf489890b279bcf3ec39)
2010-04-20 10:52:31 +10:00
Ralph Wuerthner
d2f7bf804c ethtool does not support virtio_net devices.
Skip link test for this type of devices

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2ea0a9f1a93781a0d036feb9fcc0d120b182922f)
2010-04-15 16:38:19 +10:00
Ronnie Sahlberg
dec6ad765a Fix a compiler warning
(This used to be ctdb commit 8825a8e3936e4ddfc1482d07a63a620249f01fe7)
2010-04-08 14:28:52 +10:00
Ronnie Sahlberg
06885ea9a7 In the recovery daemon, keep track of which node we have assigned public ip
addresses and verify that the remote nodes have/keep a consistent view of
assigned addresses.

If a remote node has an inconsistent view of addresses visavi the recovery
master this will trigger a full ip reallocation.

(This used to be ctdb commit f3bf2ab61f8dbbc806ec23a68a87aaedd458e712)
2010-04-08 14:25:26 +10:00
Ronnie Sahlberg
3f226d0c8e Lower the loglevel for "Recovery lock successfully taken"
from ERR to NOTICE

BZ62086

(This used to be ctdb commit 7fa8486f9ffe2a039360b07423f734bdd884fe1d)
2010-04-07 10:45:03 +10:00
Ronnie Sahlberg
e179910136 When we forcefully abort a running eventscript, dont log this as is
the script timedout.

Instead send a different signal (SIGABRT) to the child process to silently
kill the process group for the script and its children without logging
anything.

We abort any running "monitor" script anytime any other event is generated
either by ctdbd itself or by "ctdb eventscript ..."

BZ61043

(This used to be ctdb commit 9dd25cb751919799af9d8a23a0725343a8400e58)
2010-03-30 12:47:54 +11:00
Ronnie Sahlberg
eeeb89e3e2 Reduce the loglevel for two log messages for Registering and Deregistering server ids.
BZ61890

(This used to be ctdb commit 944434eb6420774e42e58984c6ddaa326a6853bd)
2010-03-30 11:57:25 +11:00
Volker Lendecke
029d7a9b33 In ctdb catdb, print the payload data length without the ctdb header length
(This used to be ctdb commit 45b3fe253c1d00c571b351fc73415bc799df3083)
2010-03-29 17:06:29 +11:00
Volker Lendecke
184ca81bcd Fix a typo in run_startrecovery_eventscript
(This used to be ctdb commit 4f807b3a2d859f13c3e59e1ae737e9b145d7d613)
2010-03-29 17:06:28 +11:00
Michael Adam
df77489477 events:50.samba: wipe the local part of the serverid db before starting winbind/smnd/nmbd
This is necessary for the new serverid approach.

Michael

(This used to be ctdb commit 8956f32e571093db7f285b83e4dd32960f8afc7c)
2010-03-29 17:05:06 +11:00
Ronnie Sahlberg
8ed2e059f5 new version 1.0.114
(This used to be ctdb commit b07beb68bf2adf65e837669be0c7464852f829ac)
2010-03-24 17:21:10 +11:00