From 17222261895b8c82eb5458bc66dab6712930d5a3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 12 Jul 2006 16:32:02 +0000 Subject: r16987: Fix the logic errors in ref-counting Windows locks. Hopefully will fix the build farm. Still a few errors in RAW-LOCK to look at though... Jeremy. (This used to be commit edd72d37de570fdad09f7ee983b5b22a1613e558) --- source3/locking/brlock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/locking/brlock.c') diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index eb325fe053..e99d4ab900 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -1225,6 +1225,7 @@ void brl_close_fnum(struct byte_range_lock *br_lck) uint16 tid = fsp->conn->cnum; int fnum = fsp->fnum; unsigned int i, j, dcount=0; + int num_deleted_windows_locks = 0; struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data; struct process_id pid = procid_self(); BOOL unlock_individually = False; @@ -1289,6 +1290,7 @@ void brl_close_fnum(struct byte_range_lock *br_lck) if (lock->context.tid == tid && procid_equal(&lock->context.pid, &pid)) { if ((lock->lock_flav == WINDOWS_LOCK) && (lock->fnum == fnum)) { del_this_lock = True; + num_deleted_windows_locks++; } else if (lock->lock_flav == POSIX_LOCK) { del_this_lock = True; } @@ -1334,8 +1336,10 @@ void brl_close_fnum(struct byte_range_lock *br_lck) } } - /* Reduce the lock reference count on this dev/ino pair. */ - reduce_windows_lock_ref_count(fsp, dcount); + if (num_deleted_windows_locks) { + /* Reduce the Windows lock reference count on this dev/ino pair. */ + reduce_windows_lock_ref_count(fsp, num_deleted_windows_locks); + } } /**************************************************************************** -- cgit