summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/brlock.c14
-rw-r--r--source3/locking/locking.c2
2 files changed, 15 insertions, 1 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 10c1d5053b..e7fa4022f6 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -285,6 +285,8 @@ NTSTATUS brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum,
struct lock_struct lock, *locks;
char *tp;
NTSTATUS status = NT_STATUS_OK;
+ static int last_failed = -1;
+ static br_off last_failed_start;
kbuf = locking_key(dev,ino);
@@ -348,6 +350,18 @@ NTSTATUS brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum,
return NT_STATUS_OK;
fail:
+ /* this is a nasty hack to try to simulate the lock result cache code in w2k.
+ It isn't completely accurate as I haven't yet worked out the correct
+ semantics (tridge)
+ */
+ if (last_failed == fnum &&
+ last_failed_start == start &&
+ NT_STATUS_EQUAL(status, NT_STATUS_LOCK_NOT_GRANTED)) {
+ status = NT_STATUS_FILE_LOCK_CONFLICT;
+ }
+ last_failed = fnum;
+ last_failed_start = start;
+
SAFE_FREE(dbuf.dptr);
tdb_chainunlock(tdb, kbuf);
return status;
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 97366a1f9b..dd6ca62e70 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -171,7 +171,7 @@ NTSTATUS do_unlock(files_struct *fsp,connection_struct *conn, uint16 lock_pid,
if (!ok) {
DEBUG(10,("do_unlock: returning ERRlock.\n" ));
- return NT_STATUS_LOCK_NOT_GRANTED;
+ return NT_STATUS_RANGE_NOT_LOCKED;
}
if (!lp_posix_locking(SNUM(conn)))