summaryrefslogtreecommitdiffstats
path: root/source/locking
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2008-01-16 12:09:48 +0300
committerAlexander Bokovoy <ab@samba.org>2008-01-16 12:09:48 +0300
commit0c8e23afbbb2d081fc23908bafcad04650bfacea (patch)
tree91b27fcfe72995c9b345fddc0d301f6a97ae00f3 /source/locking
parent4ff2101c69a0cfcfdc5f775493cb6e88c57e4bbe (diff)
downloadsamba-0c8e23afbbb2d081fc23908bafcad04650bfacea.tar.gz
samba-0c8e23afbbb2d081fc23908bafcad04650bfacea.tar.xz
samba-0c8e23afbbb2d081fc23908bafcad04650bfacea.zip
Merge CTDB-related fixes from samba-ctdb 3.0 branch (http://samba.org/~tridge/3_0-ctdb)
Signed-off-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source/locking')
-rw-r--r--source/locking/brlock.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/source/locking/brlock.c b/source/locking/brlock.c
index eb42d081fed..4191871bb1a 100644
--- a/source/locking/brlock.c
+++ b/source/locking/brlock.c
@@ -41,11 +41,11 @@ static struct db_context *brlock_db;
static void print_lock_struct(unsigned int i, struct lock_struct *pls)
{
- DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %s, ",
+ DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %u, ",
i,
(unsigned int)pls->context.smbpid,
(unsigned int)pls->context.tid,
- procid_str_static(&pls->context.pid) ));
+ (unsigned int)procid_to_pid(&pls->context.pid) ));
DEBUG(10,("start = %.0f, size = %.0f, fnum = %d, %s %s\n",
(double)pls->start,
@@ -263,10 +263,9 @@ void brl_init(bool read_only)
if (brlock_db) {
return;
}
- brlock_db = db_open(NULL, lock_path("brlock.tdb"), 0,
- TDB_DEFAULT
- |TDB_VOLATILE
- |(read_only?0x0:TDB_CLEAR_IF_FIRST),
+ brlock_db = db_open(NULL, lock_path("brlock.tdb"),
+ lp_open_files_db_hash_size(),
+ TDB_DEFAULT | TDB_CLEAR_IF_FIRST,
read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644 );
if (!brlock_db) {
DEBUG(0,("Failed to open byte range locking database %s\n",
@@ -1495,14 +1494,16 @@ static int traverse_fn(struct db_record *rec, void *state)
}
}
- for ( i=0; i<num_locks; i++) {
- cb->fn(*key,
- locks[i].context.pid,
- locks[i].lock_type,
- locks[i].lock_flav,
- locks[i].start,
- locks[i].size,
- cb->private_data);
+ if (cb->fn) {
+ for ( i=0; i<num_locks; i++) {
+ cb->fn(*key,
+ locks[i].context.pid,
+ locks[i].lock_type,
+ locks[i].lock_flav,
+ locks[i].start,
+ locks[i].size,
+ cb->private_data);
+ }
}
SAFE_FREE(locks);