From 1df48ed55ee303b6d84d7277fd79761cfe5f7052 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 24 Apr 2000 20:48:40 +0000 Subject: Added the code that keeps fd's open across a close if there are other fsp's open on the same dev/inode pair with existing POSIX locks. This is done at the smbd/open layer, so smbd just calls fd_close() and the transfer of any open fd's is done under the covers of fd_close(). When an fsp is closed and no other fsp's open on the same dev/inode pair have existing POSIX locks then all fd's associated with this fsp are closed. Now only the hard part of doing the POSIX range unlock code when read locks overlap remains for full POSIX/SMB lock integration.... Jeremy. --- source/locking/locking.c | 59 +++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) (limited to 'source/locking') diff --git a/source/locking/locking.c b/source/locking/locking.c index 9f33cba338f..a73af8fd076 100644 --- a/source/locking/locking.c +++ b/source/locking/locking.c @@ -40,42 +40,6 @@ 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; - - if(lp_posix_locking(SNUM(fsp->conn))) { - /* - * We need to release all POSIX locks we have on this - * fd. - */ - } - - /* - * Now release all the tdb locks. - */ - - /* Placeholder for code here.... */ -#if 0 - brl_close(fsp->dev, fsp->inode, getpid(), fsp->conn->cnum, fsp->fnum); - - /* - * We now need to search our open file list for any other - * fd open on this file with outstanding POSIX locks. If we - * don't find one, great, just return. If we do find one then - * we have to add this file descriptor to the 'pending close' - * list of that fd, to stop the POSIX problem where the locks - * on *that* fd will get lost when we close this one. POSIX - * braindamage... JRA. - */ -#endif -} - /**************************************************************************** Debugging aid :-). ****************************************************************************/ @@ -416,6 +380,29 @@ static BOOL release_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG return True; } +/**************************************************************************** + Remove any locks on this fd. Called from file_close(). +****************************************************************************/ + +void locking_close_file(files_struct *fsp) +{ + if (!lp_locking(SNUM(fsp->conn))) + return; + + if(lp_posix_locking(SNUM(fsp->conn))) { + /* + * We need to release all POSIX locks we have on this + * fd. + */ + } + + /* + * Now release all the tdb locks. + */ + + brl_close(fsp->dev, fsp->inode, getpid(), fsp->conn->cnum, fsp->fnum); +} + /**************************************************************************** Utility function called to see if a file region is locked. ****************************************************************************/ -- cgit