summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-02-22 01:09:42 +0000
committerJeremy Allison <jra@samba.org>2003-02-22 01:09:42 +0000
commit4fdb86eb3b9b7eb01a90e3f3a846fb9f223d7208 (patch)
tree343946b72cf32aaaf82b68d5ef88d7b123ff4c4c /source3/locking
parentca2e9955764fa0bec3ace1fc049f13bb8e2961ac (diff)
downloadsamba-4fdb86eb3b9b7eb01a90e3f3a846fb9f223d7208.tar.gz
samba-4fdb86eb3b9b7eb01a90e3f3a846fb9f223d7208.tar.bz2
samba-4fdb86eb3b9b7eb01a90e3f3a846fb9f223d7208.zip
When checking is_locked() new WRITE locks conflict with existing READ locks even
if the context is the same. See LOCKTEST7 in smbtorture. Jeremy. (This used to be commit b362cc241b829f585a96b5d285ed12db50b21e2e)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/brlock.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 8c22f7d7ab..9902c7bbd7 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -151,9 +151,16 @@ static BOOL brl_conflict_other(struct lock_struct *lck1, struct lock_struct *lck
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK)
return False;
- if (brl_same_context(&lck1->context, &lck2->context) &&
- lck1->fnum == lck2->fnum)
- return False;
+ /*
+ * Incoming WRITE locks conflict with existing READ locks even
+ * if the context is the same. JRA. See LOCKTEST7 in smbtorture.
+ */
+
+ if (!(lck2->lock_type == WRITE_LOCK && lck1->lock_type == READ_LOCK)) {
+ if (brl_same_context(&lck1->context, &lck2->context) &&
+ lck1->fnum == lck2->fnum)
+ return False;
+ }
if (lck1->start >= (lck2->start + lck2->size) ||
lck2->start >= (lck1->start + lck1->size)) return False;