summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-03-10 23:17:07 +0000
committerAndrew Tridgell <tridge@samba.org>2002-03-10 23:17:07 +0000
commitbe389e25ddff982a490c2b88c4649ce437a0d4d7 (patch)
tree314e3a99afe6ebf52981a8279dfeb4cf5ff4d972
parent69b395d2c1aff0d53d077d9fcb72adf8a3dbb4d5 (diff)
downloadsamba-be389e25ddff982a490c2b88c4649ce437a0d4d7.tar.gz
samba-be389e25ddff982a490c2b88c4649ce437a0d4d7.tar.bz2
samba-be389e25ddff982a490c2b88c4649ce437a0d4d7.zip
this attempts to handle the rather bizarre lock cache semantics in
w2k. It isn't entirely accurate, but its close (This used to be commit e02d7364707c4939efa4ff0ddf9b6d4f48e5d411)
-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)))