summaryrefslogtreecommitdiffstats
path: root/source3/include/locking.h
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-07-29 19:14:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:25 -0500
commit2c6030415e0b1f421ea6e85fe6ffe7389ee7a941 (patch)
tree3cd4c3c78862d48be0653db5e7c34314bf607e45 /source3/include/locking.h
parent4e9df2fba37e4b1422bfda9781c7c486cfec7ed1 (diff)
downloadsamba-2c6030415e0b1f421ea6e85fe6ffe7389ee7a941.tar.gz
samba-2c6030415e0b1f421ea6e85fe6ffe7389ee7a941.tar.xz
samba-2c6030415e0b1f421ea6e85fe6ffe7389ee7a941.zip
r17314: Optimisation for POSIX locking. If we're downgrading
a POSIX lock (applying a read-lock) and we overlap pending read locks then send them an unlock message, we may have allowed them to proceed. Jeremy. (This used to be commit a7a0b6ba50f4cf7c5a0a29809fdff9e1266a29e7)
Diffstat (limited to 'source3/include/locking.h')
-rw-r--r--source3/include/locking.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/include/locking.h b/source3/include/locking.h
index 9e70411fa6..a09e7d1aff 100644
--- a/source3/include/locking.h
+++ b/source3/include/locking.h
@@ -23,11 +23,15 @@
#define _LOCKING_H
/* passed to br lock code - the UNLOCK_LOCK should never be stored into the tdb
- and is used in calculating POSIX unlock ranges only. */
+ and is used in calculating POSIX unlock ranges only. We differentiate between
+ PENDING read and write locks to allow posix lock downgrades to trigger a lock
+ re-evaluation. */
-enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_LOCK, UNLOCK_LOCK};
+enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK, UNLOCK_LOCK};
enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1};
+#define IS_PENDING_LOCK(type) ((type) == PENDING_READ_LOCK || (type) == PENDING_WRITE_LOCK)
+
/* This contains elements that differentiate locks. The smbpid is a
client supplied pid, and is essentially the locking context for
this client */