summaryrefslogtreecommitdiff
path: root/source3/locking/brlock.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r15419: Never write the same function twice :-). In a traversalJeremy Allison1-62/+60
function we must copy the data before modifying. Jeremy. (This used to be commit ef4c70f58edf15dc93b22f2c80e15113ee2a46df)
2007-10-10r15402: Fix for bug #3587. Dead entries can be left in the lockingJeremy Allison1-1/+102
db. Make this db self-cleaning on first read of entry after open, and also on smbstatus -b call. Needs more testing when I get back from Boston but passes valgrind at first look. Jeremy. (This used to be commit c66531096325848d1476054df5d53ad05c2ffc83)
2007-10-10r15269: Fix incorrect boolean in assert to make POSIX lock testsJeremy Allison1-1/+1
pass with CIFSFS. Jeremy. (This used to be commit 89b604285ebe77b7cc2e0d5593117c0c5dc5ed1c)
2007-10-10r15255: Add return statement after abort to placate fussy compilers. Closes ↵Tim Potter1-0/+2
#3721. (This used to be commit ab5a55ec8b27146fccba97f320d649bb19bc6f11)
2007-10-10r15083: Using talloc with destructors is nice and all, but in thisJeremy Allison1-9/+5
case it's in a performace critical path and it *hurts* us. Go back to plain malloc/free with an explicit destructor call. Jeremy. (This used to be commit 1c99aed563c29e1b3d70939878af747a0660bfec)
2007-10-10r15060: The brlock code gets called a lot. Ensure we keep theJeremy Allison1-29/+13
key around while we're using it - saves many calls to locking_key() (now deleted). Jeremy. (This used to be commit 2f8b527dcf4a36fbb933ce79c720c0425de76b4a)
2007-10-10r15026: Fix warning until POSIX locking finished.Jeremy Allison1-2/+1
Jeremy. (This used to be commit 15f39a4c720e9645f941742310b6c6d7d7fc96d5)
2007-10-10r15018: Merge Volker's ipc/trans2/nttrans changes overJeremy Allison1-315/+985
into 3.0. Also merge the new POSIX lock code - this is not enabled unless -DDEVELOPER is defined. This doesn't yet map onto underlying system POSIX locks. Updates vfs to allow lock queries. Jeremy. (This used to be commit 08e52ead03304ff04229e1bfe544ff40e2564fc7)
2007-10-10r14763: Add a new tuning parameter, open files database hash size,Jeremy Allison1-2/+4
this allows us to experiment with ensuring the tdb hash size for our open files and locking db are appropriately sized. Make the hash size larger by default (10007 instead of 1049) and make the locking db hash size the same as the open file db hash size. Jeremy. (This used to be commit e7225f7e813423c3e2a94af6a9d7ce8a1b50a166)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-5/+2
realloc can return NULL in one of two cases - (1) the realloc failed, (2) realloc succeeded but the new size requested was zero, in which case this is identical to a free() call. The error paths dealing with these two cases should be different, but mostly weren't. Secondly the standard idiom for dealing with realloc when you know the new size is non-zero is the following : tmp = realloc(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } However, there were *many* *many* places in Samba where we were using the old (broken) idiom of : p = realloc(p, size) if (!p) { return error; } which will leak the memory pointed to by p on realloc fail. This commit (hopefully) fixes all these cases by moving to a standard idiom of : p = SMB_REALLOC(p, size) if (!p) { return error; } Where if the realloc returns null due to the realloc failing or size == 0 we *guarentee* that the storage pointed to by p has been freed. This allows me to remove a lot of code that was dealing with the standard (more verbose) method that required a tmp pointer. This is almost always what you want. When a realloc fails you never usually want the old memory, you want to free it and get into your error processing asap. For the 11 remaining cases where we really do need to keep the old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR, which can be used as follows : tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the pointer p, even on size == 0 or realloc fail. All this is done by a hidden extra argument to Realloc(), BOOL free_old_on_error which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR macros (and their array counterparts). It remains to be seen what this will do to our Coverity bug count :-). Jeremy. (This used to be commit 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r10656: BIG merge from trunk. Features not copied overGerald Carter1-12/+12
* \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
2007-10-10r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunkHerb Lewis1-0/+3
so our numbers don't get out of sync (This used to be commit 58e307664e02ebf0415f19ed625d2f166d9cb1cc)
2007-10-10r5634: Fix 64-bit overflow problems found by BlueArc torture tester.Jeremy Allison1-9/+0
We still have a few strange bugs with 64-bit locking values. I will get traces. Jeremy. (This used to be commit ff4c201d93e1f59ce61e9341f7f94ce92389ed7b)
2007-10-10r4108: As check_self is *always* False in every invokation, remove theJeremy Allison1-11/+6
logic for it. We still pass Samba4 RAW-LOCK test. Jeremy. (This used to be commit 596f23051363f8cc8896119b3eca0663a61a38c3)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-1/+1
allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r3050: Steal from Samba4 :-). Make us pass most of the new lock tests ↵Jeremy Allison1-17/+56
(except for the cancel lock which I have to add). Jeremy. (This used to be commit cf7f89999e0c6becd4617c812400d1e71b9c0a30)
2007-10-10r3008: when checking for the existance of a lock we are only doing a singleAndrew Tridgell1-3/+0
tdb call, so there is no need to get the chainlock. This reduces the number of tdb locking calls made on file IO (This used to be commit 78e904c27b31d7123b521c446247d6ff558c84cc)
2007-10-10r1011: fix bad merge (from a few months ago) and ensure that we always use ↵Gerald Carter1-2/+2
tdb_open_log() instead of tdb_open_ex() (This used to be commit e65564ab4aa1240e84b8d272510aa770cad0ed0e)
2004-02-12merge from old APP_HEADGerald Carter1-2/+2
* remove corrupt tdb and shutdown (only for printing tdbs, connections, sessionid & locking) * decrement smbd counter in connections.tdb in smb_panic() * various Makefile hack to get things to link 'max smbd processes' looks like it might be broken. The counter KEY is not being set. Will look into that tomorrow. (This used to be commit 6e22c5da929b6d9a4e32dc704c83112b2ad8fcfd)
2003-10-09Changes to allow Samba3 to pass the Samba4 RAW-READ tests.Jeremy Allison1-2/+7
Jeremy. (This used to be commit e7565dbba696adbb0fd8cca6b86a1a7e5a655f2e)
2003-04-04Fix for very subtle POSIX lock interaction race condition found byJeremy Allison1-1/+12
Herb. We need to unlock POSIX locks before notifying pending lock processes. Jeremy. (This used to be commit 6999eef51c3e597b3b2cd9cc26138acdfbb6a23a)
2003-02-27Fix to allow blocking lock notification to be done rapidly (no waitJeremy Allison1-6/+76
for smb -> smb lock release). Adds new PENDING_LOCK type to lockdb (does not interfere with existing locks). Jeremy. (This used to be commit 766928bbba1e597c9c2b12458dd8d37e6080593e)
2003-02-22When checking is_locked() new WRITE locks conflict with existing READ locks evenJeremy Allison1-3/+10
if the context is the same. See LOCKTEST7 in smbtorture. Jeremy. (This used to be commit 1698092ba5a169de369ad1182a6f270de174c3f5)
2002-07-15updated the 3.0 branch from the head branch - ready for alpha18Andrew Tridgell1-6/+17
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
2002-03-10this attempts to handle the rather bizarre lock cache semantics inAndrew Tridgell1-0/+14
w2k. It isn't entirely accurate, but its close (This used to be commit e02d7364707c4939efa4ff0ddf9b6d4f48e5d411)
2002-03-05accept the 0/0 lock but don't treat it in any sort of special wayAndrew Tridgell1-1/+0
(This used to be commit 8f7bf38de16a1f5316aa6a413fb697c43862c4c6)
2002-01-30Removed version number from file header.Tim Potter1-2/+1
Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2001-10-02Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.Tim Potter1-2/+0
(This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e)
2001-09-17move to SAFE_FREE()Simo Sorce1-8/+8
(This used to be commit e61aec84edaf55b9ee087b076d2f1311033dc839)
2001-09-06got rid of USE_TDB_MMAP_FLAG as its not needed any moreAndrew Tridgell1-1/+1
(This used to be commit c26e0d3f27a05ecc8bd2390f9aab7f9451524e47)
2001-09-06use NTSTATUS not BOOL in do_lock()Andrew Tridgell1-9/+15
(This used to be commit b1b2a5fa5d084dad8ae47777419ab75db1e51eff)
2001-08-27converted smbd to use NTSTATUS by defaultAndrew Tridgell1-11/+60
major changes include: - added NSTATUS type - added automatic mapping between dos and nt error codes - changed all ERROR() calls to ERROR_DOS() and many to ERROR_NT() these calls auto-translate to the client error code system - got rid of the cached error code and the writebmpx code We eventually will need to also: - get rid of BOOL, so we don't lose error info - replace all ERROR_DOS() calls with ERROR_NT() calls but that is too much for one night (This used to be commit 83d9896c1ea8be796192b51a4678c2a3b87f7518)
2001-08-26Don't use CLEAR_IF_FIRST if opening read-only.Jeremy Allison1-1/+1
Jeremy. (This used to be commit f5ba19c12989dd1e996473869468afcfc5dce72e)
2001-08-24we now have all but the dreaded 0/0 lock workingAndrew Tridgell1-30/+67
(This used to be commit 98b6aef18c793187f392f944af516c8b9ebf86e9)
2001-08-12this is a big global fix for the ptr = Realloc(ptr, size) bug.Simo Sorce1-2/+4
many possible mem leaks, and segfaults fixed. someone should port this fix to 2.2 also. (This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
2001-07-30Added "use mmap" for HPUX.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 840802f10677cb0009cb4df4c37c7d01aa5edacd)
2001-06-30Fixed the first locking error (test #8 found by locktest code fromJeremy Allison1-3/+30
Clarion locktest. Jeremy. (This used to be commit 5c42845b5bb6fafd0ebf93fbdd23d9bf861da865)
2001-06-04use LDSHFLAGS not -shared in several placesAndrew Tridgell1-1/+1
(This used to be commit 8ec9c87b5d1a7dae17d5b1a30f58effaf5e69e4b)
2001-05-23Stupid typo. Should be if (!tdb).Jeremy Allison1-1/+1
Jeremy. (This used to be commit d3496897f167a8deb1d0034797e8b29f2c51acef)
2001-05-22Defensive brlock and locking database cleaning code.Jeremy Allison1-6/+43
Jeremy. (This used to be commit d7aa42e4593b02ee6e487f7a4633bd7e7620ef2f)
2001-03-11Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMRJeremy Allison1-2/+0
RPC code to merge with new passdb code. Currently rpcclient doesn't compile. I'm working on it... Jeremy. (This used to be commit 0be41d5158ea4e645e93e8cd30617c038416e549)
2000-12-06Changed to sourceforge tdb code. This includes spinlocks (so we now haveJeremy Allison1-13/+13
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-06-13add some bracketsAndrew Tridgell1-1/+1
(This used to be commit bf67721ef5cc6d5ad1762fca320ef612025b4593)
2000-05-10Using a structure for a tdb key can lead to insideous, hardHerb Lewis1-20/+21
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 Allison1-1/+2
to correctly set the fnum, as the brl_conflict code looks at it. Jeremy. (This used to be commit df87259a356b91989604a10b3691480dcd16cf3f)
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-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 Allison1-1/+1
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-04-28Ok - this is the *third* implementation of this (third time's the charm :-).Jeremy Allison1-295/+1
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)