diff options
author | Jeremy Allison <jra@samba.org> | 2001-06-30 01:59:48 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-06-30 01:59:48 +0000 |
commit | d1f38ac53107d818b88cae9ee4d4442381dc4702 (patch) | |
tree | 3eeedd75a07466ad4055b5bf6ce1cbd7ea544b15 /source3/locking/locking.c | |
parent | 51b83860a17cc04d7a7cab345b24af88e14f805e (diff) | |
download | samba-d1f38ac53107d818b88cae9ee4d4442381dc4702.tar.gz samba-d1f38ac53107d818b88cae9ee4d4442381dc4702.tar.bz2 samba-d1f38ac53107d818b88cae9ee4d4442381dc4702.zip |
Fixed the first locking error (test #8 found by locktest code from
Clarion locktest.
Jeremy.
(This used to be commit 5c42845b5bb6fafd0ebf93fbdd23d9bf861da865)
Diffstat (limited to 'source3/locking/locking.c')
-rw-r--r-- | source3/locking/locking.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index c77a86cbf4..68c3c5b653 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -53,11 +53,14 @@ static const char *lock_type_name(enum brl_type lock_type) /**************************************************************************** Utility function called to see if a file region is locked. + If check_self is True, then checks on our own fd with the same locking context + are still made. If check_self is False, then checks are not made on our own fd + with the same locking context are not made. ****************************************************************************/ BOOL is_locked(files_struct *fsp,connection_struct *conn, SMB_BIG_UINT count,SMB_BIG_UINT offset, - enum brl_type lock_type) + enum brl_type lock_type, BOOL check_self) { int snum = SNUM(conn); BOOL ret; @@ -70,16 +73,25 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn, ret = !brl_locktest(fsp->dev, fsp->inode, fsp->fnum, global_smbpid, sys_getpid(), conn->cnum, - offset, count, lock_type); + offset, count, lock_type, check_self); + + DEBUG(10,("is_locked: brl start=%.0f len=%.0f %s for file %s\n", + (double)offset, (double)count, ret ? "locked" : "unlocked", + fsp->fsp_name )); /* * There is no lock held by an SMB daemon, check to * see if there is a POSIX lock from a UNIX or NFS process. */ - if(!ret && lp_posix_locking(snum)) + if(!ret && lp_posix_locking(snum)) { ret = is_posix_locked(fsp, offset, count, lock_type); + DEBUG(10,("is_locked: posix start=%.0f len=%.0f %s for file %s\n", + (double)offset, (double)count, ret ? "locked" : "unlocked", + fsp->fsp_name )); + } + return ret; } |