summaryrefslogtreecommitdiff
path: root/source3/locking/posix.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-07-12 16:32:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:19:16 -0500
commit17222261895b8c82eb5458bc66dab6712930d5a3 (patch)
treedc267b6d2123a9fdca033ba1e4ba036e18029345 /source3/locking/posix.c
parent297df32751fbc64a053700241dae2ac9c0fc4968 (diff)
downloadsamba-17222261895b8c82eb5458bc66dab6712930d5a3.tar.gz
samba-17222261895b8c82eb5458bc66dab6712930d5a3.tar.bz2
samba-17222261895b8c82eb5458bc66dab6712930d5a3.zip
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)
Diffstat (limited to 'source3/locking/posix.c')
-rw-r--r--source3/locking/posix.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 10845f9575..475ab61a2f 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -981,6 +981,7 @@ BOOL set_posix_lock_windows_flavour(files_struct *fsp,
*/
if(!posix_lock_in_range(&offset, &count, u_offset, u_count)) {
+ increment_windows_lock_ref_count(fsp);
return True;
}
@@ -1004,13 +1005,13 @@ BOOL set_posix_lock_windows_flavour(files_struct *fsp,
if ((l_ctx = talloc_init("set_posix_lock")) == NULL) {
DEBUG(0,("set_posix_lock_windows_flavour: unable to init talloc context.\n"));
- return True; /* Not a fatal error. */
+ return False;
}
if ((ll = TALLOC_P(l_ctx, struct lock_list)) == NULL) {
DEBUG(0,("set_posix_lock_windows_flavour: unable to talloc unlock list.\n"));
talloc_destroy(l_ctx);
- return True; /* Not a fatal error. */
+ return False;
}
/*
@@ -1108,6 +1109,9 @@ BOOL release_posix_lock_windows_flavour(files_struct *fsp,
DEBUG(5,("release_posix_lock_windows_flavour: File %s, offset = %.0f, count = %.0f\n",
fsp->fsp_name, (double)u_offset, (double)u_count ));
+ /* Remember the number of Windows locks we have on this dev/ino pair. */
+ decrement_windows_lock_ref_count(fsp);
+
/*
* If the requested lock won't fit in the POSIX range, we will
* pretend it was successful.
@@ -1117,18 +1121,15 @@ BOOL release_posix_lock_windows_flavour(files_struct *fsp,
return True;
}
- /* Remember the number of Windows locks we have on this dev/ino pair. */
- decrement_windows_lock_ref_count(fsp);
-
if ((ul_ctx = talloc_init("release_posix_lock")) == NULL) {
DEBUG(0,("release_posix_lock_windows_flavour: unable to init talloc context.\n"));
- return True; /* Not a fatal error. */
+ return False;
}
if ((ul = TALLOC_P(ul_ctx, struct lock_list)) == NULL) {
DEBUG(0,("release_posix_lock_windows_flavour: unable to talloc unlock list.\n"));
talloc_destroy(ul_ctx);
- return True; /* Not a fatal error. */
+ return False;
}
/*