summaryrefslogtreecommitdiffstats
path: root/source3/smbd/blocking.c
Commit message (Collapse)AuthorAgeFilesLines
* This patch looks bigger than it is. It does 2 things. 1). Renames smbpid -> ↵Jeremy Allison2010-05-071-27/+27
| | | | | | smblctx in our locking code. 2). Widens smblctx to 64-bits internally. Preparing to use the SMB2 handle as the locking context. Jeremy.
* Make us pass all SMB2 lock tests except MULTIPLE-UNLOCK and CONTEXT. Them ↵Jeremy Allison2010-05-071-2/+6
| | | | | | next :-). Jeremy.
* Fix more SMB2 locking. We still crash but this won't last :-).Jeremy Allison2010-05-061-3/+2
| | | | Jeremy.
* s3: only include gen_ndr headers where needed.Günther Deschner2010-05-061-0/+1
| | | | | | | | | | | | | | | | | This shrinks include/includes.h.gch by the size of 7 MB and reduces build time as follows: ccache build w/o patch real 4m21.529s ccache build with patch real 3m6.402s pch build w/o patch real 4m26.318s pch build with patch real 3m6.932s Guenther
* Fixed issue with return in a void function found by Björn JACKE <bj@SerNet.DE>Jeremy Allison2010-05-051-1/+2
| | | | Jeremy.
* Plumb the SMB2 front end into the blocking lock backend.Jeremy Allison2010-04-301-5/+16
| | | | | | | | | | Metze, you'll probably be happier with this work as it doesn't abuse tevent in the way you dislike. This is a first cut at the code, which will need lots of testing but I'm hoping this will give people an idea of where I'm going with this. Jeremy.
* Carefully label SMB1-specific locking calls.Jeremy Allison2010-04-291-5/+14
| | | | Jeremy.
* Move the global blocking lock records into the smb1 state.Jeremy Allison2010-04-291-21/+30
| | | | Jeremy
* Move to using 64-bit mid values in our internal open file database.Jeremy Allison2010-04-121-2/+2
| | | | | | | This will allow us to share logic much easier between SMB1 and SMB2 servers. Jeremy
* Plumb SMB2 stubs into all the places we defer SMB1 operations.Jeremy Allison2010-04-091-1/+1
| | | | | | | | Rename functions to be internally consistent. Next step is to cope queueing single (non-compounded) SMB2 requests to put some code inside the stubs. Jeremy.
* Stop smb2 from calling into smb1 blocking lock request code.Jeremy Allison2010-04-081-0/+14
| | | | | | | | | | | Allocate a uint16_t internal SMB1 mid for an SMB2 request. Add a back pointer from the faked up smb_request struct to the smb2 request. Getting ready to add restart code for blocking locks, share mode violations and oplocks in SMB2. Jeremy.
* s3/smbd: change locking behavior when "lock spin time = 0".Steven Danneman2010-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | The "lock spin time" parameter mimics the following Windows setting which by default is 250ms in Windows and 200ms in Samba. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\LockViolationDelay When a client sends repeated, non-blocking, contending BRL requests to a Windows server, after the first Windows starts treating these requests as timed blocking locks with the above timeout. As an efficiency, I've changed the behavior when this setting is 0, to skip this logic and treat all requests as non-blocking locks. This gives the smbd server behavior similar to the 3.0 release with the do_spin_lock() implementation. I've also changed the blocking lock parameter in the call from push_blocking_lock_request() to true as all requests made in this path are blocking by definition.
* Fix trailing whitespace errors I added (sorry).Jeremy Allison2010-02-051-2/+2
| | | | Jeremy.
* s3-brlock: add a minimim retry time for pending blocking locksAndrew Tridgell2010-02-051-0/+20
| | | | | | | | | | | | | | | | | When we are waiting on a pending byte range lock, another smbd might exit uncleanly, and therefore not notify us of the removal of the lock, and thus not trigger the lock to be retried. We coped with this up to now by adding a message_send_all() in the SIGCHLD and cluster reconfigure handlers to send a MSG_SMB_UNLOCK to all smbd processes. That would generate O(N^2) work when a large number of clients disconnected at once (such as on a network outage), which could leave the whole system unusable for a very long time (many minutes, or even longer). By adding a minimum re-check time for pending byte range locks we avoid this problem by ensuring that pending locks are retried at a more regular interval.
* Second part of the fix for bug 6828 - infinite timeout occurs when byte lock ↵Jeremy Allison2009-10-261-6/+9
| | | | | | | | held outside of samba. Fixes case where a connection with a pending lock can me marked "idle", and ensures that the lock queue timeout is always recalculated. Jeremy.
* Fix bug 6828 - infinite timeout occurs when byte lock held outside of sambaJeremy Allison2009-10-201-8/+18
| | | | Jeremy.
* s3: Change fsp->fsp_name to be an smb_filename struct!Tim Prouty2009-07-201-7/+8
|
* s3:smbd: use new simplified snb_signing code in the serverStefan Metzmacher2009-03-231-3/+2
| | | | | | | | | We keep the seqnum/mid mapping in the smb_request structure. This also moves one global variable into the smbd_server_connection struct. metze
* Add VFS ops for Windows BRL: Lock, Unlock and Cancel:Zack Kirsch2009-02-131-48/+59
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove typedef struct blocking_lock_record and move references to struct ↵Zack Kirsch2009-02-131-19/+19
| | | | blocking_lock_record.
* S3: New module interface for SMB message statistics gatheringtodd stecher2009-02-091-2/+4
| | | | | | | This changelist allows for the addition of custom performance monitoring modules through smb.conf. Entrypoints in the main message processing code have been added to capture the command, subop, ioctl, identity and message size statistics.
* Remove the global variable "chain_size"Volker Lendecke2009-01-311-6/+1
|
* Add a new implementation of chain_replyVolker Lendecke2009-01-161-6/+0
| | | | | | This the global variable "orig_inbuf" in the old chain_reply code. This global variable was one of the reasons why we had the silly restriction to not allow async requests within a request chain.
* s3:smbd: move all globals and static variables in globals.[ch]Stefan Metzmacher2009-01-081-15/+6
| | | | | | The goal is to move all this variables into a big context structure. metze
* s3:events: change event_add_timed() prototype to match samba4Stefan Metzmacher2009-01-051-2/+2
| | | | metze
* Do not write into inbuf for the transs requestVolker Lendecke2008-11-081-1/+0
| | | | | Instead, fix up the outbuf in send_xx_reply. In those routines, we know what we are returning.
* Remove the change to the user context in process_blocking_lock_queue()Volker Lendecke2008-11-081-76/+8
|
* Convert blocking.c to store a smb_request instead of just inbufVolker Lendecke2008-11-041-88/+54
|
* Simplify logic of cancel_pending_lock_requests_by_fid()Volker Lendecke2008-11-041-20/+18
| | | | | The only caller of this function is locking_close_file(). This checks itself if brl_lock != NULL. The additional check is not necessary here.
* Slightly simplify logic in process_lockingX()Volker Lendecke2008-11-041-7/+8
| | | | The "else" is pointless here, we did a "return True" in the if branch.
* Slightly simplify logic in remove_pending_lock_requests_by_mid()Volker Lendecke2008-11-041-13/+21
| | | | Use "continue" for (SVAL(blr->inbuf,smb_mid) != mid)
* Slightly simplify logic in cancel_pending_lock_requests_by_fid()Volker Lendecke2008-11-041-20/+24
| | | | Use a "continue" for (blr->fsp->fnum != fsp->fnum)
* Convert blocking.c to use tallocVolker Lendecke2008-11-041-23/+15
|
* Make "inbuf" a talloc child of "smb_request" for normal smb requestsVolker Lendecke2008-11-041-0/+2
| | | | | | This is necessary if we want to keep the whole smb_request for deferred ops. The explicit settings of req->inbuf will be removed once all those deferring operations are converted to store the whole request and not just the inbuf.
* Fix nonempty blank linesVolker Lendecke2008-11-031-14/+14
|
* Remove some inbuf references by adding "cmd" to smb_requestVolker Lendecke2008-11-021-1/+1
|
* Apply some const to get_lock_*()Volker Lendecke2008-11-011-4/+6
|
* Use {u,}int64_t instead of SMB_BIG_{U,}INT.Jelmer Vernooij2008-10-141-12/+12
|
* Remove the chain_fsp globalVolker Lendecke2008-10-131-1/+0
|
* Some more talloc_tos()Volker Lendecke2008-01-101-5/+5
| | | | (This used to be commit 444e35e7df1f13fc285183da8fb41b30ad99a3fa)
* Fix %d / size_t printf arg missmatch.Jeremy Allison2008-01-051-2/+2
| | | | | Jeremy. (This used to be commit 3e3205309b75edf7d29633525adfdceb5f8856eb)
* Fix interesting bug found with make valgrindtest. When cancellingJeremy Allison2008-01-041-10/+14
| | | | | | | | a lock due to file closure make sure we null out the fsp pointer so it isn't dangling. This is an old bug (not related to the new changes). Jeremy. (This used to be commit b5ee972b0c04b4d119573d95ac458a3b6be30c5c)
* Refactor the crypto code after a very helpful conversationJeremy Allison2008-01-041-13/+21
| | | | | | | with Volker. Mostly making sure we have data on the incoming packet type, not stored in the smb header. Jeremy. (This used to be commit c4e5a505043965eec77b5bb9bc60957e8f3b97c8)
* Add new parameter, "min receivefile size" (by default setJeremy Allison2007-10-301-2/+2
| | | | | | | | | | to zero). If non-zero, writeX calls greater than this value will be left in the socket buffer for later handling with recvfile (or userspace equivalent). Definition of recvfile for your system is left as an exercise for the reader (I'm working on getting splice working :-). Jeremy. (This used to be commit 11c03b75ddbcb6e36b231bb40a1773d1c550621c)
* RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison2007-10-181-15/+15
| | | | | | | | 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)
* r24809: Consolidate the use of temporary talloc contexts.Volker Lendecke2007-10-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the two functions talloc_stackframe() and talloc_tos(). * When a new talloc stackframe is allocated with talloc_stackframe(), then * the TALLOC_CTX returned with talloc_tos() is reset to that new * frame. Whenever that stack frame is TALLOC_FREE()'ed, then the reverse * happens: The previous talloc_tos() is restored. * * This API is designed to be robust in the sense that if someone forgets to * TALLOC_FREE() a stackframe, then the next outer one correctly cleans up and * resets the talloc_tos(). The original motivation for this patch was to get rid of the sid_string_static & friends buffers. Explicitly passing talloc context everywhere clutters code too much for my taste, so an implicit talloc_tos() is introduced here. Many of these static buffers are replaced by a single static pointer. The intended use would thus be that low-level functions can rather freely push stuff to talloc_tos, the upper layers clean up by freeing the stackframe. The more of these stackframes are used and correctly freed the more exact the memory cleanup happens. This patch removes the main_loop_talloc_ctx, tmp_talloc_ctx and lp_talloc_ctx (did I forget any?) So, never do a tmp_ctx = talloc_init("foo"); anymore, instead, use tmp_ctx = talloc_stackframe() :-) Volker (This used to be commit 6585ea2cb7f417e14540495b9c7380fe9c8c717b)
* r24791: Fix logic error in timeout of blocking lock processing found byJeremy Allison2007-10-101-22/+29
| | | | | | | Ronnie. If a lock timeout expires, we must check we can get the lock before responding with failure. Volker is writing a torture test. Jeremy. (This used to be commit 45380f356b99d575645873b05af17c504b091dc8)
* r24702: Remove the old API pointersVolker Lendecke2007-10-101-3/+1
| | | | (This used to be commit 17df313db42199e26d7d2044f6a1d845aacd1a90)
* r24404: Remove get_OutBuffer usage from blocking.cVolker Lendecke2007-10-101-27/+14
| | | | (This used to be commit cb8fab5663db2cb408e1b85a7287d3670b09d503)
* r24163: Remove the send_trans2_replies_new wrapperVolker Lendecke2007-10-101-1/+1
| | | | | | This changes send_trans2_replies to not depend on large buffers anymore and finishes the trans2 conversion. (This used to be commit b1d133e4ffa8c9b8219ba6e7b83e23ca4bdd1616)