summaryrefslogtreecommitdiff
path: root/source4/ntvfs/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-18 09:16:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:00:00 -0500
commit43a80e1d83dad9450014b2a7e0ad5a5e495f69ce (patch)
tree64f0abd7998874cd067bd20c15504b93324d6906 /source4/ntvfs/common
parent0ca4a7700509b399e04ac93105962b1739c7a13c (diff)
downloadsamba-43a80e1d83dad9450014b2a7e0ad5a5e495f69ce.tar.gz
samba-43a80e1d83dad9450014b2a7e0ad5a5e495f69ce.tar.bz2
samba-43a80e1d83dad9450014b2a7e0ad5a5e495f69ce.zip
r3031: added support for lock cancelation, which effectively just triggers an early lock timeout
added support for more of the bizarre special lock offset semantics of w2k3 (This used to be commit d5bfc910b1200fb283e26572dc57fcf93652fd32)
Diffstat (limited to 'source4/ntvfs/common')
-rw-r--r--source4/ntvfs/common/brlock.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c
index 792ee52ad5..2da32891fb 100644
--- a/source4/ntvfs/common/brlock.c
+++ b/source4/ntvfs/common/brlock.c
@@ -117,8 +117,16 @@ static BOOL brl_same_context(struct lock_context *ctx1, struct lock_context *ctx
static BOOL brl_overlap(struct lock_struct *lck1,
struct lock_struct *lck2)
{
- if (lck1->start >= (lck2->start + lck2->size) ||
- lck2->start >= (lck1->start + lck1->size)) {
+ /* this extra check is not redundent - it copes with locks
+ that go beyond the end of 64 bit file space */
+ if (lck1->size != 0 &&
+ lck1->start == lck2->start &&
+ lck1->size == lck2->size) {
+ return True;
+ }
+
+ if (lck1->start >= (lck2->start+lck2->size) ||
+ lck2->start >= (lck1->start+lck1->size)) {
return False;
}
return True;
@@ -193,11 +201,12 @@ static NTSTATUS brl_lock_failed(struct brl_context *brl, struct lock_struct *loc
return NT_STATUS_FILE_LOCK_CONFLICT;
}
brl->last_lock_failure = *lock;
- if (lock->start >= 0xEF000000) {
+ if (lock->start >= 0xEF000000 &&
+ (lock->start >> 63) == 0) {
/* amazing the little things you learn with a test
suite. Locks beyond this offset (as a 64 bit
- number!) always generate the conflict error
- code. */
+ number!) always generate the conflict error code,
+ unless the top bit is set */
return NT_STATUS_FILE_LOCK_CONFLICT;
}
return NT_STATUS_LOCK_NOT_GRANTED;