summaryrefslogtreecommitdiff
path: root/source3/locking/brlock.c
AgeCommit message (Collapse)AuthorFilesLines
2009-02-20s3 BRL: Add more clarifying comments and add implied logic to make ↵Zack Kirsch1-2/+6
conditional more clear
2009-02-13Add VFS ops for Windows BRL: Lock, Unlock and Cancel:Zack Kirsch1-19/+47
This patch adds 3 new VFS OPs for Windows byte range locking: BRL_LOCK_WINDOWS, BRL_UNLOCK_WINDOWS and BRL_CANCEL_WINDOWS. Specifically: * I renamed brl_lock_windows, brl_unlock_windows and brl_lock_cancel to *_default as the default implementations of the VFS ops. * The blocking_lock_record (BLR) is now passed into the brl_lock_windows and brl_cancel_windows paths. The Onefs implementation uses it - future implementations may find it useful too. * Created brl_lock_cancel to do what brl_lock/brl_unlock do: set up a lock_struct and call either the Posix or Windows lock function. These happen to be the same for the default implementation. * Added helper functions: increment_current_lock_count() and decrement_current_lock_count(). * Minor spelling correction in brl_timeout_fn: brl -> blr. * Changed blocking_lock_cancel() to return the BLR that it has cancelled. This allows us to assert its the lock that we wanted to cancel. If this assert ever fires, this path will need to take in the BLR to cancel, rather than choosing on its own. * Adds a small helper function: find_blocking_lock_record_by_id(). Used by the OneFS implementation, but could be useful for others.
2009-02-10Fix an uninitialized variable. Tim, please check!Volker Lendecke1-1/+1
2009-02-09s3 oplocks: Make the level2 oplock contention API more granularTim Prouty1-11/+74
This replaces release_level2_oplocks_on_change with contend_level2_oplock_begin/end in order to contend level2 oplocks throughout an operation rather than just at the begining. This is necessary for some kernel oplock implementations, and also lays the groundwork for better correctness in Samba's standard level2 oplock handling. The next step for non-kernel oplocks is to add additional state to the share mode lock struct that prevents any new opens from granting oplocks while a contending operation is in progress. All operations that contend level 2 oplocks are now correctly spanned except for aio and synchronous writes. The two write paths both have non-trivial error paths that need extra care to get right. RAW-OPLOCK and the rest of 'make test' are still passing with this change.
2008-04-11Quieten valgrind message on make valgrindtest. This doesn'tJeremy Allison1-0/+5
seem to be valid (vl - feel free to confirm). Jeremy. (This used to be commit 43b0254d93540eeaddaa32d76dd9271f4dc2ebff)
2008-03-17Merge leftovers of 0e1a86bc845 in 3-0-ctdbVolker Lendecke1-1/+1
(This used to be commit 64b1625f8e3bca43504871747bef6631e1b18f44)
2008-01-20Fix some "set but never used" warningsVolker Lendecke1-5/+0
(This used to be commit 4a6dadc5178f4861e9c032321939db3b639734b5)
2008-01-16Merge CTDB-related fixes from samba-ctdb 3.0 branch ↵Alexander Bokovoy1-14/+15
(http://samba.org/~tridge/3_0-ctdb) Signed-off-by: Alexander Bokovoy <ab@samba.org>(This used to be commit 0c8e23afbbb2d081fc23908bafcad04650bfacea)
2007-12-10Tiny simplificationsVolker Lendecke1-5/+2
locking.c:open_read_only was unused don't export the silly boolean flag locking_init(bool read_only) (This used to be commit 2f3c865707010bc7c463a02782dbee3dc2479da1)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-28/+28
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-10r25055: Add file_id_string_tosVolker Lendecke1-1/+1
This removes file_id_string_static and file_id_string_static2 (This used to be commit 638c848c9afe374feb30e34c494f89b2a6c64f7b)
2007-10-10r24266: Remove the "open files database hash size" parameterVolker Lendecke1-2/+1
This has been superseded by the "tdb_hashsize:<tdbname>" parameter (This used to be commit df40d336afd256f05a0ec3724cc2096fb7114d81)
2007-10-10r24034: Print the full cluster pid in print_lock_structVolker Lendecke1-2/+2
(This used to be commit ff1996ce4b0edfee90758c85ea0ac653877a1b9f)
2007-10-10r23885: Fix make test on opi.Volker Lendecke1-0/+1
(This used to be commit b2adb28808fe25d420bc12834ca8bc70779bb653)
2007-10-10r23882: Fix Coverity id 389 -- finally (I hope)Volker Lendecke1-7/+11
(This used to be commit 9b8f2d8bd144700306819480bcb260d2c20969ae)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23759: Fix make test -- sorryVolker Lendecke1-2/+2
(This used to be commit cbbc70604e815f4ffd25d040ca0a4ef58e651523)
2007-10-10r23755: Fix Coverity id 384Volker Lendecke1-1/+7
(This used to be commit ebb410ca1e08d6f062154c9f8b3970682c6eeebd)
2007-10-10r23516: Fix bug found & fixed by Doug Rudoff (doug_rudoff@isilon.com)Jeremy Allison1-0/+6
- when cleaning up invalid locks make sure we mark the lck struct as modified so it'll get saved back correctly (that was the original intent). Jeremy. (This used to be commit cbf0829abcc3689edd7ab225054dfc79d43c6309)
2007-10-10r23510: Tidy calls to smb_panic by removing trailing newlines. Print theJames Peach1-5/+5
failed expression in SMB_ASSERT. (This used to be commit 171dc060e2a576d724eed1ca65636bdafffd7713)
2007-10-10r23316: Ouch... This would not have run in production without cluster codeVolker Lendecke1-2/+2
anyway. (This used to be commit ca1d0ff03d038372d5886ff1aa409494721142f4)
2007-10-10r23204: Add MSG_SMB_BRL_VALIDATE. Tridge, this is a bit different from your bzrVolker Lendecke1-0/+106
branch, please check if it fulfils your needs. Two changes: The validation is not done inside the brlock.c traverse_fn, it's done as a separate routine. Secondly, this patch does not call the checker routines in smbcontrol directly but depends on a running smbd. (This used to be commit 7e39d77c1f90d9025cab08918385d140e20ca25b)
2007-10-10r23195: Add void *private_data to brl_forallVolker Lendecke1-10/+28
(This used to be commit c91b2bdc160d76bf0b0770fe7f92cbc7124d6c3c)
2007-10-10r23183: Check in a change made by Tridge:Volker Lendecke1-11/+9
This replaces the internal explicit dev/ino file id representation by a "struct file_id". This is necessary as cluster file systems and NFS don't necessarily assign the same device number to the shared file system. With this structure in place we can now easily add different schemes to map a file to a unique 64-bit device node. Jeremy, you might note that I did not change the external interface of smb_share_modes.c. Volker (This used to be commit 9b10dbbd5de8813fc15ebbb6be9b18010ffe8139)
2007-10-10r23169: Merge 535 of Tridge's bzr tree:Volker Lendecke1-2/+5
store the right data after cleaning lock records. This fixes RAW-BENCH-LOCK after a recovery on a cluster (This used to be commit 3da3086dbf594fbdc4cfabf78f8d3ea1df4dc8ce)
2007-10-10r23165: Convert brlock.tdb to dbwrapVolker Lendecke1-38/+51
(This used to be commit 84f9885cf8cc57dcf3c2738d6b245de314890a41)
2007-10-10r23014: For all branches, ensure that if we're blocked on a POSIXJeremy Allison1-3/+22
lock we know nothing about that we retry the lock every 10 seconds instead of waiting for the standard select timeout. This is how we used to (and are supposed to) work. Jeremy. (This used to be commit fa18fc25a50cf13c687ae88e7e5e2dda1120e017)
2007-10-10r22846: Chunk one to replace message_send_pid with messaging_send: Deep insideVolker Lendecke1-23/+28
locking/locking.c we have to send retry messages to timed lock holders. The majority of this patch passes a "struct messaging_context" down there. No functional change, survives make test. (This used to be commit bbb508414683eeddd2ee0d2d36fe620118180bbb)
2007-10-10r22736: Start to merge the low-hanging fruit from the now 7000-line cluster ↵Volker Lendecke1-6/+6
patch. This changes "struct process_id" to "struct server_id", keeping both is just too much hassle. No functional change (I hope ;-)) Volker (This used to be commit 0ad4b1226c9d91b72136310d3bbb640d2c5d67b8)
2007-10-10r22688: Change lock_data in struct byte_range_lock from void * to struct ↵Volker Lendecke1-24/+15
lock_struct * (This used to be commit 8e0e278961ebf2fa4301874d522636699ace1b9b)
2007-10-10r22588: Make all uses of TALLOC_MEMDUP consistent.Jeremy Allison1-3/+8
Jeremy. (This used to be commit 8ad13718af0ba1fcb10a6f1631b1ed3cb8d11175)
2007-10-10r22009: change TDB_DATA from char * to unsigned char *Stefan Metzmacher1-4/+4
and fix all compiler warnings in the users metze (This used to be commit 3a28443079c141a6ce8182c65b56ca210e34f37f)
2007-10-10r21723: Make use of the per-hashchain "freelists"Volker Lendecke1-0/+3
(This used to be commit f3421ae4cfa263c0e7a8e934b40342ee9885d239)
2007-10-10r19668: Convert the locking params to use struct share_param instead of snumVolker Lendecke1-8/+8
(This used to be commit 609dbec600048718b86cd1ecdc2ce49bbdeb803c)
2007-10-10r17924: Get rid of warnings now that talloc is merged.Volker Lendecke1-3/+1
Destructors now take a pointer to the "real" destroyed object as an argument. Volker (This used to be commit 70edd716ef0ccb218fe18d1233bd30abe46b62bf)
2007-10-10r17452: Some C++ warningsVolker Lendecke1-2/+3
(This used to be commit e4b8c79a9d6f7323953121887af4f482d04a9228)
2007-10-10r17346: Add optimisation vl needs for the cluster code whereJeremy Allison1-8/+37
we don't get the chainlock when getting the byte range lock record read-only. Jeremy. (This used to be commit fcd798ca0c1b76adb2bcda4a99c40c7aacb0addb)
2007-10-10r17314: Optimisation for POSIX locking. If we're downgradingJeremy Allison1-29/+66
a POSIX lock (applying a read-lock) and we overlap pending read locks then send them an unlock message, we may have allowed them to proceed. Jeremy. (This used to be commit a7a0b6ba50f4cf7c5a0a29809fdff9e1266a29e7)
2007-10-10r17293: After the results from the cluster tests in Germany,Jeremy Allison1-6/+0
fix the messaging code to call the efficient calls : save_re_uid() set_effective_uid(0); messaging_op restore_re_uid(); instead of using heavyweight become_root()/unbecome_root() pairs around all messaging code. Fixup the messaging code to ensure sec_init() is called (only once) so that non-root processes still work when sending messages. This is a lighter weight solution to become_root()/unbecome_root() (which swaps all the supplemental groups) and should be more efficient. I will migrate all server code over to using this (a similar technique should be used in the passdb backend where needed). Jeremy. (This used to be commit 4ace291278d9a44f5c577bdd3b282c1231e543df)
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)