summaryrefslogtreecommitdiff
path: root/source3/locking
AgeCommit message (Collapse)AuthorFilesLines
2000-12-06tdb_unlockchain() no longer returns a valueTim Potter1-4/+4
(This used to be commit aee52c7acf138f8fd651aeb3d9bef79f99d1a2a9)
2000-12-06Changed to sourceforge tdb code. This includes spinlocks (so we now haveJeremy Allison2-17/+17
a --with-spinlocks option to configure, this does mean the on-disk tdb format has changed, so 2.2alphaX sites will need to re-create their tdb's. The upside is no more tdb fragmentation and a +5% on netbench. Swings and roundabouts.... Jeremy. (This used to be commit 9dea7b7c257db487f8ced7dad3fce92fba03ea91)
2000-11-17Fix from John Reilly for equivalence tests.Jeremy Allison1-1/+1
Jeremy. (This used to be commit b456274a7ba22d512bab5ede979cd9363398825b)
2000-10-06Herb's warning fixes. Also the POSIX locking fix.Jeremy Allison1-1/+1
We now use our own vfs layer to do get/set acl calls (hurrah!). Jeremy. (This used to be commit dfe77c7046cbd65ee52aea7439f21503c1eac41d)
2000-10-06Restructuring of vfs layer to include a "this" pointer - can be an fsp orJeremy Allison1-6/+6
a conn struct depending on the call. We need this to have a clean NT ACL call interface. This will break any existing VFS libraries (that's why this is pre-release code). Andrew gets credit for this one :-) :-). In addition - added Herb's WITH_PROFILE changes - Herb - please examine the changes I've made to the smbd/reply.c code you added. The original code was very ugly and I have replaced it with a START_PROFILE(x)/END_PROFILE(x) pair using the preprocessor. Please check this compiles ok with the --with-profile switch. Jeremy. (This used to be commit b07611f8159b0b3f42e7e02611be9f4d56de96f5)
2000-09-11the first cut of the internal messaging system.Andrew Tridgell1-1/+1
The motivation for this system is to replace the UDP message for oplocks, but this commit only does the "set debug level" message. (This used to be commit 2a34ee95f3929cff131db6c5a2b4820194c05b2d)
2000-06-13allow posix locking database to be opened read-only (for smbstatus)Andrew Tridgell2-11/+11
(This used to be commit b9d78738bb30da3d989dfacc95cfde529f2afca5)
2000-06-13add some bracketsAndrew Tridgell1-1/+1
(This used to be commit bf67721ef5cc6d5ad1762fca320ef612025b4593)
2000-05-25Fixed misunderstanding found during CIFS conference. Overlapping lockJeremy Allison1-340/+278
ranges (not just included lock ranges) should be handled correctly. UNIT test still needed. Jeremy. (This used to be commit 07872298e3ee8b4b50b69cb4e49b88635792128e)
2000-05-10Using a structure for a tdb key can lead to insideous, hardHerb Lewis3-20/+25
to find bugs. On 64 bit IRIX, structure packing means that a struct { SMB_DEV_T dev /* 4 bytes */ SMB_INO_T ino /* 8 bytes */ } has 4 bytes of padding between the two members. If you don't null the memory before using it as a tdb key, you randomly can't find keys depending on what is in the padding. This caused me immense pain and was hard to track down.... :-) Jeremy. (This used to be commit f2a5ba3f0939f59097f0ef6a25f1cf9b5574f157)
2000-05-05Fix for uninitialized memory read in brlock code. brl_locktest now needsJeremy Allison2-2/+3
to correctly set the fnum, as the brl_conflict code looks at it. Jeremy. (This used to be commit df87259a356b91989604a10b3691480dcd16cf3f)
2000-05-05Two fixes. Added missong logic & case in lock split code.Jeremy Allison1-4/+12
Fixed range split into two, as DLIST_ADD has the wrong semantics... Jeremy. (This used to be commit 82681edda14dcc3d58bb303cfac5452072de67df)
2000-05-04Updated to fix overlapping problem.Jeremy Allison1-68/+142
Jeremy. (This used to be commit 9bdfe0f5023988962f8a8b4d847de7a0ee27f85c)
2000-05-04Fix for debug statement crash.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 57bf92d90147b207664152d44ce4bfb5235dc7d8)
2000-05-03Fix based on Elrond's code to reduce the store size on removing dead records.Jeremy Allison1-0/+1
Jeremy. (This used to be commit 09e92a61a966d09f543ba541ddb3240cc4718579)
2000-05-03Fixed the bug locktest.c found, it was an off-by-one error in the non-overlapJeremy Allison1-1/+1
case. Jeremy. (This used to be commit 65150c408a5254215de89c8c774c33c4d011c2c0)
2000-05-03Fixed silly bug where I wasn't checking for matching fd's in closing a file.Jeremy Allison1-7/+24
This caused smbd crashes on SIGKILL. Jeremy. (This used to be commit d4dcefd12d14df112f083c312acbea0196bc5c23)
2000-05-03Added range info to the panic message to track down the bug withJeremy Allison1-1/+5
locktest. Jeremy. (This used to be commit 91f038356b7efa04cf4bfa5e6afd8b144b6b4ad5)
2000-05-03- clear dead locks at startupAndrew Tridgell1-2/+47
- fixed a bug which caused lock records to not decrease in size (This used to be commit 51624a3a2f5a4ac55b4f26f572a2fc399f9c808e)
2000-05-03Fix for stacking locks in brlock and POSIX. Windows only allows a read lockJeremy Allison2-92/+130
to overlay a write lock on the same fnum. When overlaying read locks onto a write lock, the number of locks is counted, and the first unlock removes the write lock and downgrades this to a read lock. Do the same when mapping to POSIX. Jeremy. (This used to be commit 74d42644e6e52808037975e909aa56c850838b76)
2000-05-02Implemented the last (I hope:-) part of the locking puzzle, the referenceJeremy Allison1-23/+90
counting when Windows downgrades a write lock to a read lock, then reference counts the unlocks to match the locks. With this code the POSIX unlock isn't done until the final Windows unlock. Jeremy. (This used to be commit 6eb4fb6eef367f68169d6ec1c816226b1ad9f110)
2000-05-02split the username in the vuser structure into a separateAndrew Tridgell1-1/+2
userdom_struct. As the name implies this also contains a domain (unused at the moment). This will be important shortly, as operation in appliance mode needs the domain to be always carried with the username. (This used to be commit ee8546342d5be90e730372b985710d764564b124)
2000-05-02Moved uglyness needed in fcntl locking (64->32 bit mapping, NFSJeremy Allison1-3/+121
errors etc.) into locking/posix.c, where it is needed. fcntl_lock in lib/util.c is now very small and clean. Added (*lock) op to vfs layer. Jeremy. (This used to be commit 46092ee1410faa4e3c143d80a960a8adaa19d7fc)
2000-05-02Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison1-8/+8
of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a)
2000-05-01locking/posix.c: Fixed double-free nasty crash bug found by insure.Jeremy Allison1-3/+0
utils/make_smbcodepage.c: utils/make_unicodemap.c: Insure 'make install' fixes. Jeremy. (This used to be commit 3b25f7368be3877e9ad27498bc9451ec88d4b07f)
2000-05-01added TDB_INTERNAL, TDB_NOLOCK and TDB_NOMMAP flags.Andrew Tridgell1-3/+3
TDB_INTERNAL replaces the old method of passing a null filename (This used to be commit 8ec815920d46f205b9f3fff82397c731753c3a10)
2000-04-30- removed all our old wildcard matching code and replaced it with aAndrew Tridgell1-2/+2
call to ms_fnmatch(). This also removes all the Win9X semantics stuff and a bunch of other associated cruft. - moved the stat cache code into statcache.c - fixed the uint16 alignment requirements of ascii_to_unistr() and unistr_to_ascii() - trans2 SMB_FIND_FILE_BOTH_DIRECTORY_INFO returns the short name as unicode always (at least thats what NT4 does) - fixed some errors in the in-memory tdb code. Still ugly, but doesn't crash as much (This used to be commit 03e9cea004bbba72161a5323cf3b4556c94aed8e)
2000-04-29Removed tdb locking calls (picky Andrew...:-)Jeremy Allison1-25/+12
(This used to be commit 6bded3b74e974b97d54acf9289f4cf812e2b1af7)
2000-04-28Ok - this is the *third* implementation of this (third time's the charm :-).Jeremy Allison3-1122/+137
This implementation keeps all POSIX lock records in a separate in memory tdb database only known about in locking/posix.c. In addition, the pending close fd's are also held in a tdb which has an array of fd's indexed by device and inode. The walk-split code uglyness has been moved to posix.c from brlock.c, which is the only place that needs to know about it, and the extra functions hacked into brlock to expose internal state have been removed. This implementation passes smbtorture locktest4, the only thing I need to check now for completeness is what to do about lock upgrade/downgrades which Win32 allows under some *very* strange circumstances. Jeremy. (This used to be commit 3f655de1c764b9ee1472a111621d4317f19f624d)
2000-04-28Split off of POSIX locking into separate unit as Andrew requested.Jeremy Allison1-0/+1208
Done so I don't lose my edits... :-). Jeremy. (This used to be commit 31a57be658f3fa3569a552e9c5d30174f5a51649)
2000-04-28Forgot to close when "posix locking" is set to False.Jeremy Allison1-2/+5
Jeremy. (This used to be commit b812f09ba8ef074c9ff0747ea03a1e33f1ebbe71)
2000-04-28Added optimization where we are single opener (don't free POSIX locks).Jeremy Allison1-1/+21
Jeremy. (This used to be commit a2deb91128d59ad04f4ec858ffe4e30f2afb0edd)
2000-04-28Made changes suggested by Andrew review.Jeremy Allison1-37/+52
fd_close now calls fd_close_posix() directly. set_posix_lock/release_posix_lock() now handle the reference counting. More changes due when this gets moved to the file locking/posix.c Jeremy. (This used to be commit 239abd48f049c6a8d2bbc0636eacf347ab77588c)
2000-04-27Ok - this is more subtle than it looks :-).Jeremy Allison2-7/+15
When a file is being closed, once it passes the fnum and tid tests then the locking context should be ignored when removing all locks. This is what is done in the brl close case, but when you have outstanding POSIX locks, then you cannot remove all the brl locks in one go, you have to get the lock list and call do_unlock individually. As this uses global_smbpid as the locking context, you need to make sure that this is set correctly for the specific lock being removed. I now do this by storing the smbpid in each entry in the unlock list returned from the query call. I removed the smbpid from fsp (not needed) and things seem ok (even with the stupid smbpid tricks that smbtorture plays :-). Jeremy. (This used to be commit 6baa96bb466915cc17e8cbad50254d6bd47b967b)
2000-04-27Fixed subtle unlocking bug when a file is closed. We need to store theJeremy Allison2-16/+32
smbpid used when a file was opened in the files_struct. Else we use the wrong global_smbpid when we are closing the file and trying to remove the brl locks - this causes the brl locks to be left when the file is closed as the samba_context check fails. Jeremy. (This used to be commit 2746e5602e493e5b022764b4b839eb4d2f14363b)
2000-04-27Did the rewrite Andrew wanted where all knowledge of POSIX locking isJeremy Allison1-5/+179
removed from the smbd/open.c code. We now use a dlink list of structures indexed by dev/inode to store all pending fd's for close. This could be rewritten to use lib/hash.c if this is discovered to be too slow in use. Andrew, please take a look and let me know if this is what you had in mind. Jeremy. (This used to be commit 0487841120a7584da9a2b83b9574562c415d7024)
2000-04-27Fixed crash bugs Andrew pointed out with LOCK4 smbtortureJeremy Allison1-10/+7
test. Was miscounting posix locks, plus was not taking into account the case where other_fsp == fsp in the 'move locks' case. DOH ! This code will be re-written anyway :-). Jeremy. (This used to be commit 5278ec016cb24d8263fe6e7c1d389f466270ef24)
2000-04-25Added the hard code :-).Jeremy Allison2-77/+453
HEAD should now map brl locks correctly into POSIX locks, including the really nasty case of large range unlock. There is a lot of pretty ASCII art in locking/brlock.c explaining exactly how this code works. If it is unclear, please ask me. Jeremy. (This used to be commit 135855dbd3b8934a49229b81646cd4469acba926)
2000-04-24Added the code that keeps fd's open across a close if there are other fsp'sJeremy Allison1-36/+23
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)
2000-04-23fixed a locking database bug - it was actually harmless except thatAndrew Tridgell1-2/+10
smbstatus could display the wrong filename when files change dev/inum after a rename (This used to be commit 990b16fcf7af74f376db157a3e5de7bb68c1a4a1)
2000-04-22This is a *big* checkin that may break some things, but implements theJeremy Allison1-1/+2
new open mechanism Andrew & I discussed. config.sub: configure: Included the QNX patch. include/vfs.h: smbd/vfs-wrap.c: smbd/vfs.c: Added ftruncate vfs call (needed). Note that we will also need locking calls in the vfs (to be added). lib/util_unistr.c: nmbd/nmbd_processlogon.c: Fix for NT domain logons causing nmbd to core dump. Also fix for sidsize DOS bug. locking/locking.c: Check value of ret before using it for memdup. printing/printing.c: Convert print_fsp_open to return an allocated fsp. rpc_server/srv_lsa.c: Fix for NT domain logons. I have removed all use of lp_share_modes() from the code (although I left the parameter in the table for backwards compatibility). It no longer makes sense for this to exist. smbd/close.c: Removed lp_share_modes(). smbd/fileio.c: Fixed parameters to unlock_share_entry call in panic code. smbd/files.c: Correctly set the unix_ERR_code to ERRnofids on fsp allocation fail. smbd/nttrans.c: smbd/reply.c: smbd/trans2.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. smbd/open.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. In addition I have fixed a long standing race condition in the deny mode processing w.r.t. two smbd's creating a file. Andrew, please note that your original idea of using open with O_EXCL in this case would not work (I went over the races very carefully) and so we must re-check deny modes *after* the open() call returns. This is because there is a race between the open with O_EXCL and the lock of the share mode entry. Imagine the case where the first smbd does the open with O_EXCL and a deny mode of DENY_ALL, but is pre-empted before it locks the share modes and creates the deny mode entry for DENY_ALL. A second smbd could then come in with O_RDONLY and a deny mode of DENY_NONE and the two opens would be allowed. The *only* way to fix this race is to lock the share modes after the open and then do the deny mode checks *after* this lock in the case where the file did not originally exist. This code will need extensive testing but seems to initially work. Jeremy. (This used to be commit ab0ecc39d688f16b9692fe90b991f0b89287070a)
2000-04-18locking/locking.c: Fixed placeholder code for POSIX locking.Jeremy Allison1-17/+49
printing/printing.c: Cast tdb_delete to (tdb_traverse_func) to stop warning. tmpfile gives mirror warning. smbd/groupname.c: Remember to file_lines_free() on exit. tdb/tdb.h: Add tdb_traverse_func typedef. Jeremy (This used to be commit 204ca1195c86499bd9beb273ce573db7a56ccead)
2000-04-13Typo - missing '}'.Jeremy Allison1-0/+1
Jeremy. (This used to be commit 0216d81f061ee599a798fdbf25625fbbbd88ef08)
2000-04-12Removed "ole locking compat" parameter (no longer used).Jeremy Allison1-18/+113
We now get/set/check POSIX locks, but I still need to code up the close fd braindamage... Jeremy. (This used to be commit 3de058bd43976853b0ed2b6b5529e2a3a08909eb)
2000-04-12Implmented mapping of lock offset/count from 64 bit MS rangesJeremy Allison1-13/+157
to either 63 or 31 bit POSIX ranges. Code to get these locks not yet added. Jeremy. (This used to be commit 9c3b9146a3baff4b2e403ae8fac6c48df1b7e642)
2000-04-12Code to map tdb locks onto POSIX. Mainly placeholder code at the moment,Jeremy Allison1-9/+157
but the structure is done enough so that Andrew can look it over and give a yea/nay decision. Jeremy. (This used to be commit db96f83e34a139f47776fcbb5c1624fbf9d9943b)
2000-04-11include/byteorder.h: ALIGN4/ALIGN2 macros.Jeremy Allison1-3/+3
include/includes.h: Added SMB_BIG_UINT_BITS. lib/util.c: Removed align2/align4 - use macros. libsmb/namequery.c: Use ALIGN2. locking/locking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Needed to move to hiding POSIX locks at a lower layer. nmbd/nmbd_processlogon.c: Use ALIGN2/ALIGN4 macros. smbd/blocking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. smbd/reply.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Jeremy. (This used to be commit 491eea8a20bf80d426625479326211dc975857a6)
2000-04-10the first of a bunch of changes to code with getting rid of the fd_ptrAndrew Tridgell1-6/+23
element in the fsp pretty mechanical stuff, but it affects lots of files. (This used to be commit 368b0bc1b122ece18d11854c1506517816a01a82)
2000-02-07Fixed compile warning in locking.c:traverse_fn()Tim Potter1-1/+2
(This used to be commit eefc8972217e5a700b90f13ab040a0919f184d23)
2000-02-041) added void* state argument to tdb_traverse. guess what! there wereLuke Leighton2-15/+10
two places i found where it was appropriate to _use_ that third argument, in locking.c and brlock.c! there was a static traverse_function and i removed the static variable, typecast it to a void*, passed it to tdb_traverse and re-cast it back to the traverse_function inside the tdb_traverse function. this makes the use of tdb_traverse() reentrant, which is never going to happen, i know, i just don't like to see statics lying about when there's no need for them. as i had to do in samba-tng, all uses of tdb_traverse modified to take the new void* state argument. 2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient. i don't know how the other samba team members would react if i deleted rpcclient from cvs main. damn, that code's so old, it's unreal. 20 rpcclient commands, instead of about 70 in SAMBA_TNG. (This used to be commit 49d7f0afbc1c5425d53019e234d54ddf205c8e9a)