1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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 e02d736470)
This commit is contained in:
Andrew Tridgell 2002-03-10 23:17:07 +00:00
parent 69b395d2c1
commit be389e25dd
2 changed files with 15 additions and 1 deletions

View File

@ -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;

View File

@ -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)))