summaryrefslogtreecommitdiff
path: root/source3/locking/brlock.c
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2008-01-16 18:53:16 +0300
committerAlexander Bokovoy <ab@samba.org>2008-01-16 18:53:16 +0300
commit02680bd75d803c1b54b39e95af5224fb98d1b723 (patch)
tree43516dab9b60fa5e5aadc79ee5c54c64687aadb8 /source3/locking/brlock.c
parent587a2dbf8d000640109c2b36a924cd4c2694897f (diff)
parent024741500abd30ac74adfdfa88694026792ba284 (diff)
downloadsamba-02680bd75d803c1b54b39e95af5224fb98d1b723.tar.gz
samba-02680bd75d803c1b54b39e95af5224fb98d1b723.tar.bz2
samba-02680bd75d803c1b54b39e95af5224fb98d1b723.zip
Merge branch 'ctdb-merge' into v3-2-test
(This used to be commit 175662b5bbb5c8ecd81a60539f5846a938c26a3a)
Diffstat (limited to 'source3/locking/brlock.c')
-rw-r--r--source3/locking/brlock.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index eb42d081fe..4191871bb1 100644
--- a/source3/locking/brlock.c
+++ b/source3/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);