summaryrefslogtreecommitdiff
path: root/source3/locking/locking.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-01-14 04:32:57 +0000
committerAndrew Tridgell <tridge@samba.org>2000-01-14 04:32:57 +0000
commit82af221e4a7e456f580f16bc5d2fd904fc018c96 (patch)
tree1b0818867ea76a25e578345364186566c4f167c4 /source3/locking/locking.c
parent7cd74b07ef283a4ce2e6f6c98cc7096189a74f20 (diff)
downloadsamba-82af221e4a7e456f580f16bc5d2fd904fc018c96.tar.gz
samba-82af221e4a7e456f580f16bc5d2fd904fc018c96.tar.bz2
samba-82af221e4a7e456f580f16bc5d2fd904fc018c96.zip
we now pass all byte range locking tests
the last piece was to use a smb timeout slightly larger than the locking timeout in bloking locks to prevent a race (This used to be commit 1b54cb4a33a65e62c2e3189b78ef073869a60c75)
Diffstat (limited to 'source3/locking/locking.c')
-rw-r--r--source3/locking/locking.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index e95ec08c58..350057d1a7 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -40,6 +40,19 @@ static TDB_CONTEXT *tdb;
int global_smbpid;
+
+/****************************************************************************
+remove any locks on this fd
+****************************************************************************/
+void locking_close_file(files_struct *fsp)
+{
+ if (!lp_locking(SNUM(fsp->conn))) return;
+
+ brl_close(fsp->fd_ptr->dev, fsp->fd_ptr->inode,
+ getpid(), fsp->conn->cnum, fsp->fnum);
+}
+
+
/****************************************************************************
Utility function called to see if a file region is locked.
****************************************************************************/
@@ -83,7 +96,7 @@ BOOL do_lock(files_struct *fsp,connection_struct *conn,
lock_type, (double)offset, (double)count, fsp->fsp_name ));
if (OPEN_FSP(fsp) && fsp->can_lock && (fsp->conn == conn)) {
- ok = brl_lock(fsp->fd_ptr->dev, fsp->fd_ptr->inode,
+ ok = brl_lock(fsp->fd_ptr->dev, fsp->fd_ptr->inode, fsp->fnum,
global_smbpid, getpid(), conn->cnum,
offset, count,
lock_type);
@@ -114,7 +127,7 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn,
(double)offset, (double)count, fsp->fsp_name ));
if (OPEN_FSP(fsp) && fsp->can_lock && (fsp->conn == conn)) {
- ok = brl_unlock(fsp->fd_ptr->dev, fsp->fd_ptr->inode,
+ ok = brl_unlock(fsp->fd_ptr->dev, fsp->fd_ptr->inode, fsp->fnum,
global_smbpid, getpid(), conn->cnum,
offset, count);
}