summaryrefslogtreecommitdiffstats
path: root/source/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-02-22 01:09:57 +0000
committerJeremy Allison <jra@samba.org>2003-02-22 01:09:57 +0000
commit1698092ba5a169de369ad1182a6f270de174c3f5 (patch)
tree4816418ff5b14bcadc74ce778c17c4a15e4f5df1 /source/locking
parentde6a2d154e0e863a7628f18cca8fdcaa49d9c0ff (diff)
downloadsamba-1698092ba5a169de369ad1182a6f270de174c3f5.tar.gz
samba-1698092ba5a169de369ad1182a6f270de174c3f5.tar.xz
samba-1698092ba5a169de369ad1182a6f270de174c3f5.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.
Diffstat (limited to 'source/locking')
-rw-r--r--source/locking/brlock.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/locking/brlock.c b/source/locking/brlock.c
index 8c22f7d7ab2..9902c7bbd7b 100644
--- a/source/locking/brlock.c
+++ b/source/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;