summaryrefslogtreecommitdiffstats
path: root/source3/locking/locking.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-04-24 20:48:40 +0000
committerJeremy Allison <jra@samba.org>2000-04-24 20:48:40 +0000
commit644f22ac6141f58f2badd3a9761ac156831c16a3 (patch)
tree772d24c3d12fd37ce3401cca60887e25b42c0de0 /source3/locking/locking.c
parente82dbfcbe97c79b1c81915ae949bb2b1763970ba (diff)
downloadsamba-644f22ac6141f58f2badd3a9761ac156831c16a3.tar.gz
samba-644f22ac6141f58f2badd3a9761ac156831c16a3.tar.xz
samba-644f22ac6141f58f2badd3a9761ac156831c16a3.zip
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. (This used to be commit 1df48ed55ee303b6d84d7277fd79761cfe5f7052)
Diffstat (limited to 'source3/locking/locking.c')
-rw-r--r--source3/locking/locking.c59
1 files changed, 23 insertions, 36 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 9f33cba338..a73af8fd07 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -41,42 +41,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 :-).
****************************************************************************/
@@ -417,6 +381,29 @@ static BOOL release_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG
}
/****************************************************************************
+ 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.
****************************************************************************/