summaryrefslogtreecommitdiff
path: root/source3/locking/brlock.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r17279: conn->cnum is the tid we've given to the client. This has nothing to ↵Volker Lendecke1-6/+6
do with our internal share number. Funny that it worked at all :-) Volker (This used to be commit afa6e9094604afe1ef929cd936fbfa07b5473fd2)
2007-10-10r17276: Don't change the POSIX lock ref count if posix locking = no.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 42dec2192c1261090f2fac7a123c384f5c133587)
2007-10-10r17181: Fix the build farm RAW-READ bug. When making a copyJeremy Allison1-1/+3
of the lock array in order to delete them individually it's also important to make a copy of the *size* of this array. Otherwise the unlock decrements the termination index of your for loop :-). Doh ! Big thanks to Volker for showing me how to set up the build farm to track this one down. This is not a 3.0.23a issue. Jeremy. (This used to be commit 2c82a159ae6a4cc83989f2b453508358db516d67)
2007-10-10r17105: Fix the race Volker found - we had a non-lockedJeremy Allison1-7/+7
region between detecting a pending lock was needed and when we added the blocking lock record. Make sure that we hold the lock over all this period. Removed the old code for doing blocking locks on SMB requests that never block (the old SMBlock and friends). Discovered something interesting about the strange NT_STATUS_FILE_LOCK_CONFLICT return. If we asked for a lock with zero timeout, and we got an error of NT_STATUS_FILE_LOCK_CONFLICT, treat it as though it was a blocking lock with a timeout of 150 - 300ms. This only happens when timeout is sent as zero and can be seen quite clearly in ethereal. This is the real replacement for old do_lock_spin() code. Re-worked the blocking lock select timeout to correctly use milliseconds instead of the old second level resolution (far too coarse for this work). Jeremy. (This used to be commit b81d6d1ae95a3d3e449dde629884b565eac289d9)
2007-10-10r17098: Samba3 now cleanly passes Samba4 RAW-LOCK tortureJeremy Allison1-33/+24
test. Phew - that was painful :-). But what it means is that we now implement lock cancels and I can add lock cancels into POSIX lock handling which will fix the fast/slow system call issue with cifsfs ! Jeremy. (This used to be commit f1a9cf075b87c76c032d19da0168424c90f6cb3c)
2007-10-10r17046: Ensure we're using the right pointers ...Jeremy Allison1-11/+7
Jeremy. (This used to be commit a8df1863bf2817a82a55c816ba1f685828c5b6ec)
2007-10-10r17043: Fix memleak when processing CIFS POSIX lock/unlockJeremy Allison1-4/+5
requests. Maybe the Linux kernel OOM killer will be kinder to smbd now :-). Back to tdbtorture tests on cifsfs. Jeremy. (This used to be commit 1201383e7ab2413795a395491af0a4d3877b1c8b)
2007-10-10r17041: Trying to track down a *big* memory leak in the new lock code.Jeremy Allison1-1/+1
Fix a small one first.... (easy to valgrind). Jeremy (This used to be commit 43d24fbd41ed745a5b21514b526e655663c509ee)
2007-10-10r16987: Fix the logic errors in ref-counting Windows locks.Jeremy Allison1-2/+6
Hopefully will fix the build farm. Still a few errors in RAW-LOCK to look at though... Jeremy. (This used to be commit edd72d37de570fdad09f7ee983b5b22a1613e558)
2007-10-10r16973: Fix subtle logic error in lock ref counting found byJeremy Allison1-4/+4
cifsfs client code. Jeremy. (This used to be commit 53094435d89088124041d57078c21a12e761e2bf)
2007-10-10r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison1-106/+198
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
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)